25. qmmm — QM/MM interface

QM part interface

pyscf.qmmm.itrf.add_mm_charges(scf_method, coords, charges, unit=None)

Modify the QM method using the (non-relativistic) potential generated by MM charges. Note the static Coulomb interactions of the background charges are not included in the total energy.

Args:

scf_method : a HF or DFT object

coords
: 2D array, shape (N,3)
MM particle coordinates
charges
: 1D array
MM particle charges
Kwargs:
unit
: str
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
Note:
1. if MM charge and X2C correction are used together, function mm_charge needs to be applied after X2C decoration (.x2c method), eg mf = mm_charge(scf.RHF(mol).x2c()), [(0.5,0.6,0.8)], [-0.5]). 2. Once mm_charge function is applied on the SCF object, it affects all the post-HF calculations eg MP2, CCSD, MCSCF etc

Examples:

>>> mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='ccpvdz', verbose=0)
>>> mf = mm_charge(dft.RKS(mol), [(0.5,0.6,0.8)], [-0.3])
>>> mf.kernel()
-101.940495711284
pyscf.qmmm.itrf.mm_charge(scf_method, coords, charges, unit=None)[source]

Modify the QM method using the (non-relativistic) potential generated by MM charges. Note the static Coulomb interactions of the background charges are not included in the total energy.

Args:

scf_method : a HF or DFT object

coords
: 2D array, shape (N,3)
MM particle coordinates
charges
: 1D array
MM particle charges
Kwargs:
unit
: str
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
Note:
1. if MM charge and X2C correction are used together, function mm_charge needs to be applied after X2C decoration (.x2c method), eg mf = mm_charge(scf.RHF(mol).x2c()), [(0.5,0.6,0.8)], [-0.5]). 2. Once mm_charge function is applied on the SCF object, it affects all the post-HF calculations eg MP2, CCSD, MCSCF etc

Examples:

>>> mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='ccpvdz', verbose=0)
>>> mf = mm_charge(dft.RKS(mol), [(0.5,0.6,0.8)], [-0.3])
>>> mf.kernel()
-101.940495711284
pyscf.qmmm.itrf.mm_charge_grad(scf_grad, coords, charges, 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)
Once mm_charge_grad function is applied on the SCF object, it affects all post-HF calculations eg MP2, CCSD, MCSCF etc
coords
: 2D array, shape (N,3)
MM particle coordinates
charges
: 1D array
MM particle charges
Kwargs:
unit
: str
Bohr, AU, Ang (case insensitive). Default is the same to mol.unit
Returns:
Same gradeints method object as the input scf_grad method

Examples:

>>> from pyscf import gto, scf, grad
>>> mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='ccpvdz', verbose=0)
>>> mf = mm_charge(scf.RHF(mol), [(0.5,0.6,0.8)], [-0.3])
>>> mf.kernel()
-101.940495711284
>>> hfg = mm_charge_grad(grad.hf.RHF(mf), coords, charges)
>>> hfg.kernel()
[[-0.25912357 -0.29235976 -0.38245077]
 [-1.70497052 -1.89423883  1.2794798 ]]