ADMPQeqForce provides a support to coulombic energy calculation for constant potential model and constant charge model. Net charges on all atoms were equilibrated at setted constraint first, then charge related energys were carried out next.
First, assume the coulombic energy of the total system is:
where
The total coulombic energy is composed of the followling four parts.
Here, the first term
Note that we currently only consider Ewad3D (so called Ewald3DC method), instead of rigorous Ewald2D.
The second term is the short-range damping term, which can be different for different models and users can choose it by a key word DampMod or edit their own damping mode.
- For example, for EQeq model (
JPCL 3, 2506
), the damping kernel is ($K$ is the dielectric constant):
- Another typical example is the Tang-Toennies damping:
- The third common option is the damping corresponding to Guassian smeared charge (ewald.pdf (gitlab.com)):
Note that one can easily recover the point charge formula by setting
For this combination rule, it is perhaps it is more code-friendly if we define:
Then
- The short-range damping model Prof. Zhu Tong uses (double check with him for more details):
$$f(r) = \frac{r}{\left[r^3 + (1/\gamma_{ij})^3\right]^{1/3}} - 1$$
Typically, these damping functions must satisfy:
And are related to some nonlinear atomic parameters (
The JCP 147 126101
). The nonneutral correction is:
And there are also dipole boundary correction, which, in the case of nonneutral box, is (JCP 131 094107
):
The on-site energy is the self energy of each site, which is usually in the following form:
Note that quite often, it can be written as:
Which is equivalent to the above equation subject to a constant shift.
Also, for Gaussian smear charge, there is often a self-interaction term (ewald.pdf (gitlab.com)):
which can be also merged into Eqn 11. Therefore there is no need to design a separate term for this (?).
Once we have the coulombic energy, we can add different constraints to construct the optimization target function for charges. Depending on different scenarios, we usually have two types of constraints.
This constraint ensures that the total charge of a group of atoms is constant
And we need to find the proper value for both
Note that in this condition, the constraint term is always zero at stationary point, so it does not enter into force evaluations. Bottom line is, at stationary point, we can simply neglect its existence while calculating forces (NOTE that it is not true at points other than stationary points).
This constraint sets the electrostatic potential of a group of atoms to a predefined value
We need to find the proper value for
Note that for this condition, the constraint term (
Point is, once we find the stationary point
- J. Phys. Chem. Lett. 2012, 3, 17, 2506–2511; https://doi.org/10.1021/jz3008485
- J. Chem. Phys. 147, 126101 (2017); https://doi.org/10.1063/1.4998320
- J. Chem. Phys. 131, 094107 (2009); https://doi.org/10.1063/1.3216473
- J. Chem. Phys. 153, 174704 (2020); https://doi.org/10.1063/5.0028232
A typical xml
file to define an ADMPQeqForce frontend is:
<ADMPQeqForce coulomb14scale="1.0" DampMod="3" >
<Atom type="1" chi="1.39198761e+02" J="-6.51683561e-01" eta="0.08360402" />
<Atom type="2" chi="1.47411181e+02" J="-3.42450470e-02" eta="0.08360402" />
<Atom type="3" chi="7.58342711e+01" J="-5.62083783e-01" eta="0.08360402" />
<Atom type="4" chi="1.40533063e+02" J="-6.33544439e-01" eta="0.08360402" />
<Atom type="5" chi="1.37525951e+02" J="-6.63409032e-01" eta="0.08360402" />
</ADMPQeqForce>
The important tags in the frontend includes:
coulomb14scale
: the scaling factors for the 1-3 coulombic interactions between bonded atoms.DampMod
: the tag to set Short Range Damping model.
For each atom type, there is an <Atom/>
node, with the following tags:
type
: the label for the atomtype.chi
: the electronegtivitity for each atom atomtype.J
: the hardness for each atom atomtypeeta
: the length damping parameter used in calculating corresponding short range damping correction. The unit should be innm
To create a ADMP QEQ potential function, one needs to do the following in python:
hamilt = Hamiltonian('forcefield.xml')
pot = hamilt.createPotential(dmfftop, nonbondedCutoff=rc*unit.nanometer, nonbondedMethod=app.PME,
ethresh=1e-3, neutral=True, slab=True, constQ=True,
const_list=const_list, const_vals=const_val,
has_aux=True
)
Then the potential function, the parameters, and the generator can be accessed as:
efunc_pme = pots.dmff_potentials["ADMPQeqForce"]
params_pme = H.getParameters()["ADMPQeqForce"]
generator_pme = H.getGenerators()[0] # if ADMPQeqForce is the first force node in xml
A few keywords in createPotential
would impact the behavior of the function:
-
neutral
: bool type, if the total net charge of each residue is not zero, we should set this tag asTrue
to add nonneutral correction. -
slab
: bool type, if the system is with slab boundary, we should set this tag asTrue
to add Slab Boundary Corrections. -
constQ
: bool type, if the constraint condition is constant charge, we should set this tag asTrue
, elseFalse
for constant potential condition. -
const_list
: the atomic numbers of all residues with different constraints. -
const_vals
: the corresponding constraint valu on each residue. -
ethresh
: the accuracy of PME, used to setup the size of the meshgrid of PME. -
has_aux
: bool type, whether to intruduce auxilliary parameters, equilibrated atomic charges, etc.
ATTRIBUTES:
The following attributes are accessible via the ADMPQeqGenerator
:
-
coulomb14scale, damp_mod, ethresh, has_aux
: all these variables introduced above are accessible through generator. -
atom_keys
: character strings to identify the atomic type. -
key_type
: atomic keys to set attributes,class
ortype
. -
coeff_method, fourier_spacing
: parameters to setup ewald parameters used for calculating electrostatic energy of point-charge . -
mscales_coul
: mscale for PME. -
ffinfo
: the force field parameters registered in the generator.
METHODS
The following methods are accessible via ADMPQeqGenerator
:
overwrite(paramset)
: overwrite the parameters registered in the generator (i.e., the ffinfo object) using the values inparamset
.
The backend of the ADMP QEQ energy is an ADMPQeqForce
object. It contains the following attributes and methods:
ATTRIBUTES:
-
damp_mod
: bool type, the tag to set Short Range Damping model -
neutrial_flag
: bool type, the tag to add nonneutral correction -
slab_flag
: bool type, the tag to add Slab Boundary Corrections -
pbc_flag
: bool type, the tag to choose cutoff option or nocutoff -
constQ
: bool type, the tag to choose constant charge constraint or constant potential constraint -
const_list
: int array,the atomic numbers of all residues with different constraints -
const_value
: float array, the corresponding constraint valu on each residue -
init_q
: float array, intial atomic charge -
init_lagmt
: float array, inital lagrange multipliers on each constQ constraint -
kappa
: float, the range-separation parameter$\kappa$ used in PME calculation -
e_constraint
: constraint function that made a virtual energy -
e_sr
: short range damping energy function -
e_site
: on site energy function -
coul_energy
: point charge interaction energy function
METHOS
-
E_full
:This function constructs the charge related coulombic energy plus constraint energy. Inputs: q: Na: the inital atomic charge lagmt: Nr: the inital lagrange multipliers on each constQ constraint chi: Na: the atomic electronegtivity J: Na: the atomic hardness pos: N * 3: the positions matrix box: 3 * 3: box pairs: Np: interacting pair indices within cutoff distance eta: N: the atomic length damping parameter ds: Np: topology distance of pairs buffer_scales: N * 3: buffer scales on pairs mscales: (6,): mscale for PME Outputs: energy: charge related coulombic energy plus constraint energy
-
E_grads
:
Same as E_full
, only return the concatenation of gradients of funtion E_ful
on the first two paramters.
-
get_energy
:This contains charge equilbrant process, and retruns total energy after charge equilibration. Input: positions: Na * 3: positions box: 3 * 3: box pairs: Np * 3: interacting pair indices within cutoff topology mScales: (6,): mscale for PME eta: Na: the atomic length damping parameter chi: Na: the atomic electronegtivity J: Na: the atomic hardness aux: dict[str,array]: auxilliary parameters, including initial atomic charges and lagmt Output: energy: total energy after charge equilibration aux: auxilliary parameters, including equilibrated atomic charges and lagmt