pyscf.qmmm package

Submodules

pyscf.qmmm.itrf module

QM/MM helper functions that modify the QM methods.

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

Embedding the one-electron (non-relativistic) potential generated by MM point 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. It does not include the static Coulomb interactions of the MM point 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

Kwargs:
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

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.add_mm_charges_grad(scf_grad, atoms_or_coords, charges, 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_grada HF or DFT gradient object (grad.HF or grad.RKS etc)

Once the add_mm_charges_grad was applied, it affects all post-HF calculations eg MP2, CCSD, MCSCF etc

coords2D array, shape (N,3)

MM particle coordinates

charges1D array

MM particle charges

Kwargs:
unitstr

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 ]]
pyscf.qmmm.itrf.mm_charge(scf_method, atoms_or_coords, charges, unit=None)

Embedding the one-electron (non-relativistic) potential generated by MM point 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. It does not include the static Coulomb interactions of the MM point 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

Kwargs:
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

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, atoms_or_coords, charges, 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_grada HF or DFT gradient object (grad.HF or grad.RKS etc)

Once the add_mm_charges_grad was applied, it affects all post-HF calculations eg MP2, CCSD, MCSCF etc

coords2D array, shape (N,3)

MM particle coordinates

charges1D array

MM particle charges

Kwargs:
unitstr

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 ]]
pyscf.qmmm.itrf.qmmm_for_scf(scf_method, mm_mol)

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

Args:

mm_mol : MM Mole object

pyscf.qmmm.itrf.qmmm_grad_for_scf(scf_grad)

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.mm_mole module

Mole class for MM particles

class pyscf.qmmm.mm_mole.Mole(atoms, charges=None)

Bases: pyscf.gto.mole.Mole

Mole 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:

charges : fractional charges of MM particles

pyscf.qmmm.mm_mole.create_mm_mol(atoms_or_coords, charges=None, unit='Angstrom')

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

Module contents