pyscf.qmmm.pbc package#
Submodules#
pyscf.qmmm.pbc.itrf module#
- class pyscf.qmmm.pbc.itrf.QMMMGrad(scf_grad)[source]#
Bases:
object- contract_hcore_mm(dm, mol=None)#
Nuclear gradients of the electronic energy
- 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
- to_gpu = NotImplemented#
- class pyscf.qmmm.pbc.itrf.QMMMSCF(method, mm_mol)[source]#
Bases:
QMMM- Gradients()#
- as_scanner = NotImplemented#
- 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]#
- 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.mm_mole module#
- class pyscf.qmmm.pbc.mm_mole.Cell(atoms, a, rcut_ewald=None, rcut_hcore=None, charges=None, zeta=None)[source]#
-
Cellclass 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.
- 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