pyscf.qmmm.pbc package#

Submodules#

pyscf.qmmm.pbc.itrf module#

class pyscf.qmmm.pbc.itrf.QMMM[source]#

Bases: object

class pyscf.qmmm.pbc.itrf.QMMMGrad(scf_grad)[source]#

Bases: object

contract_hcore_mm(dm, mol=None)#

Nuclear gradients of the electronic energy

dump_flags(verbose=None)[source]#
get_hcore(mol=None)[source]#
grad_ewald(dm=None, with_mm=False, mm_ewald_pot=None, qm_ewald_pot=None)[source]#

pbc correction energy grad w.r.t. qm and mm atom positions

grad_hcore_mm(dm, mol=None)[source]#

Nuclear gradients of the electronic energy

grad_nuc(mol=None, atmlst=None)[source]#
grad_nuc_mm(mol=None)[source]#
to_gpu = NotImplemented#
class pyscf.qmmm.pbc.itrf.QMMMSCF(method, mm_mol)[source]#

Bases: QMMM

Gradients()#
as_scanner = NotImplemented#
dump_flags(verbose=None)[source]#
energy_elec(dm=None, h1e=None, vhf=None)[source]#
energy_ewald(dm=None, mm_ewald_pot=None, qm_ewald_pot=None)[source]#
energy_nuc()[source]#
energy_tot(dm=None, h1e=None, vhf=None, mm_ewald_pot=None, qm_ewald_pot=None)[source]#
get_hcore(mol=None)[source]#
get_mm_ewald_pot(mol, mm_mol)[source]#
get_qm_charges(dm)[source]#
get_qm_dipoles(dm, s1r=None)[source]#
get_qm_ewald_pot(mol, dm, qm_ewald_hess=None)[source]#
get_qm_quadrupoles(dm, s1rr=None)[source]#
get_s1r()[source]#
get_s1rr()[source]#

int phi_u phi_v [3(r-Rc)otimes(r-Rc) - |r-Rc|^2] /2 dr

get_vdiff(mol, ewald_pot)[source]#
vdiff_uv = d Q_I / d dm_uv ewald_pot[0]_I
  • d D_Ix / d dm_uv ewald_pot[1]_Ix

  • d O_Ixy / d dm_uv ewald_pot[2]_Ixy

get_veff(mol=None, dm=None, dm_last=0, vhf_last=0, hermi=1, mm_ewald_pot=None, qm_ewald_pot=None)[source]#
nuc_grad_method()[source]#
to_gpu = NotImplemented#
pyscf.qmmm.pbc.itrf.add_mm_charges(scf_method, atoms_or_coords, a, charges, radii=None, rcut_ewald=None, rcut_hcore=None, unit=None)[source]#

Embedding the one-electron (non-relativistic) potential generated by MM point (or gaussian-distributed) charges into QM Hamiltonian.

The total energy includes the regular QM energy, the interaction between the nuclei in QM region and the MM charges, and the static Coulomb interaction between the electron density and the MM charges. The electrostatic interactions between reference cell and periodic images are also computed. It does not include the static Coulomb interactions of the MM charges, the MM energy, the vdw interaction or other bonding/non-bonding effects between QM region and MM particles.

Args:

scf_method : a HF or DFT object

atoms_or_coords2D array, shape (N,3)

MM particle coordinates

charges1D array

MM particle charges

a2D array, shape (3,3)

Lattice vectors

Kwargs:
radii1D array

The Gaussian charge distribution radii of MM atoms.

rcut_ewald: Float

Ewald real-space cutoff

rcut_hcore: Float

Real-space cutoff for exact QM-MM coupling

unitstr

Bohr, AU, Ang (case insensitive). Default is the same to mol.unit

Returns:

Same method object as the input scf_method with modified 1e Hamiltonian

Examples:

>>> mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='ccpvdz', verbose=0)
>>> mf = add_mm_charges(dft.RKS(mol), [(0.5,0.6,0.8)], np.eye(3)*10, [-0.3])
>>> mf.kernel()
pyscf.qmmm.pbc.itrf.add_mm_charges_grad(scf_grad, atoms_or_coords, a, charges, radii=None, rcut_ewald=None, rcut_hcore=None, unit=None)[source]#

Apply the MM charges in the QM gradients’ method. It affects both the electronic and nuclear parts of the QM fragment.

Args:

scf_grad : a HF or DFT gradient object (grad.HF or grad.RKS etc) coords : 2D array, shape (N,3)

MM particle coordinates

charges1D array

MM particle charges

a2D array, shape (3,3)

Lattice vectors

Kwargs:
radii1D array

The Gaussian charge distribution radii of MM atoms.

unitstr

Bohr, AU, Ang (case insensitive). Default is the same to mol.unit

Returns:

Same gradeints method object as the input scf_grad method

pyscf.qmmm.pbc.itrf.mm_charge_grad(scf_grad, atoms_or_coords, a, charges, radii=None, rcut_ewald=None, rcut_hcore=None, unit=None)#

Apply the MM charges in the QM gradients’ method. It affects both the electronic and nuclear parts of the QM fragment.

Args:

scf_grad : a HF or DFT gradient object (grad.HF or grad.RKS etc) coords : 2D array, shape (N,3)

MM particle coordinates

charges1D array

MM particle charges

a2D array, shape (3,3)

Lattice vectors

Kwargs:
radii1D array

The Gaussian charge distribution radii of MM atoms.

unitstr

Bohr, AU, Ang (case insensitive). Default is the same to mol.unit

Returns:

Same gradeints method object as the input scf_grad method

pyscf.qmmm.pbc.itrf.qmmm_for_scf(method, mm_mol)[source]#

Add the potential of MM particles to SCF (HF and DFT) method then generate the corresponding QM/MM method for the QM system.

Args:

mm_mol : MM Mole object

pyscf.qmmm.pbc.itrf.qmmm_grad_for_scf(scf_grad)[source]#

Add the potential of MM particles to SCF (HF and DFT) object and then generate the corresponding QM/MM gradients method for the QM system.

pyscf.qmmm.pbc.mm_mole module#

class pyscf.qmmm.pbc.mm_mole.Cell(atoms, a, rcut_ewald=None, rcut_hcore=None, charges=None, zeta=None)[source]#

Bases: Mole, Cell

Cell class for MM particles.

Args:

atoms : geometry of MM particles (unit Bohr).

[[atom1, (x, y, z)],
[atom2, (x, y, z)],
[atomN, (x, y, z)]]
Kwargs:
charges1D array

fractional charges of MM particles

zeta1D array

Gaussian charge distribution parameter. \(rho(r) = charge * Norm * exp(-\zeta * r^2)\)

get_ewald_params(precision=None, rcut=None)[source]#

Choose a reasonable value of Ewald ‘eta’ and ‘cut’ parameters. eta^2 is the exponent coefficient of the model Gaussian charge for nucleus at R: frac{eta^3}{pi^1.5} e^{-eta^2 (r-R)^2}

Choice is based on largest G vector and desired relative precision.

The relative error in the G-space sum is given by

precision ~ 4pi Gmax^2 e^{(-Gmax^2)/(4 eta^2)}

which determines eta. Then, real-space cutoff is determined by (exp. factors only)

precision ~ erfc(eta*rcut) / rcut ~ e^{(-eta**2 rcut*2)}

Returns:
ew_eta, ew_cutfloat

The Ewald ‘eta’ and ‘cut’ parameters.

get_ewald_pot(coords1, coords2=None, charges2=None)[source]#
get_lattice_Ls()[source]#

Get the (Cartesian, unitful) lattice translation vectors for nearby images. The translation vectors can be used for the lattice summation.

Kwargs:
discard:

Drop less important Ls based on AO values on grid

pyscf.qmmm.pbc.mm_mole.create_mm_cell(atoms_or_coords, a, charges=None, radii=None, rcut_ewald=None, rcut_hcore=None, unit='Angstrom')#

Create an MM object based on the given coordinates and charges of MM particles.

Args:
atoms_or_coordsarray-like

Cartesian coordinates of MM atoms, in the form of a 2D array: [(x1, y1, z1), (x2, y2, z2), …]

a(3,3) ndarray

Lattice primitive vectors. Each row represents a lattice vector Reciprocal lattice vectors are given by b1,b2,b3 = 2 pi inv(a).T

Kwargs:
charges1D array

The charges of MM atoms.

radii1D array

The Gaussian charge distribuction radii of MM atoms.

unitstring

The unit of the input. Default is ‘Angstrom’.

pyscf.qmmm.pbc.mm_mole.create_mm_mol(atoms_or_coords, a, charges=None, radii=None, rcut_ewald=None, rcut_hcore=None, unit='Angstrom')[source]#

Create an MM object based on the given coordinates and charges of MM particles.

Args:
atoms_or_coordsarray-like

Cartesian coordinates of MM atoms, in the form of a 2D array: [(x1, y1, z1), (x2, y2, z2), …]

a(3,3) ndarray

Lattice primitive vectors. Each row represents a lattice vector Reciprocal lattice vectors are given by b1,b2,b3 = 2 pi inv(a).T

Kwargs:
charges1D array

The charges of MM atoms.

radii1D array

The Gaussian charge distribuction radii of MM atoms.

unitstring

The unit of the input. Default is ‘Angstrom’.

Module contents#

QMMM with PBC