forces¶
-
class
atomsmm.forces.
NonbondedExceptionsForce
[source]¶ Bases:
atomsmm.forces._AtomsMM_CustomBondForce
A special class designed to compute only the exceptions of an OpenMM NonbondedForce object.
-
class
atomsmm.forces.
DampedSmoothedForce
(alpha, cutoff_distance, switch_distance, degree=1)[source]¶ Bases:
atomsmm.forces._AtomsMM_CustomNonbondedForce
A damped-smoothed version of the Lennard-Jones/Coulomb potential.
\[\begin{split}& V(r)=\left\{ 4\epsilon\left[ \left(\frac{\sigma}{r}\right)^{12}-\left(\frac{\sigma}{r}\right)^6 \right]+\frac{q_1 q_2}{4\pi\epsilon_0}\frac{\mathrm{erfc}(r)}{r} \right\}S(r) \\ & \sigma=\frac{\sigma_1+\sigma_2}{2} \\ & \epsilon=\sqrt{\epsilon_1\epsilon_2} \\ & S(r)=[1+\theta(r-r_\mathrm{switch})u^3(15u-6u^2-10)] \\ & u=\frac{r^n-r_\mathrm{switch}^n}{r_\mathrm{cut}^n-r_\mathrm{switch}^n}\end{split}\]Warning
Long-range dispersion correction is not employed.
In the equations above, \(\theta(x)\) is the Heaviside step function. Note that the switching function employed here, with u being a quadratic function of r, is slightly different from the one normally used in OpenMM, in which u is a linear function of r.
- Parameters
alpha (Number or unit.Quantity) – The Coulomb damping parameter (in inverse distance unit).
cutoff_distance (Number or unit.Quantity) – The distance at which the nonbonded interaction vanishes.
switch_distance (Number or unit.Quantity) – The distance at which the switching function begins to smooth the approach of the nonbonded interaction towards zero.
degree (int, optional, default=1) – The degree n in the definition of the switching variable u (see above).
-
class
atomsmm.forces.
NearNonbondedForce
(cutoff_distance, switch_distance, adjustment=None, subtract=False, actual_cutoff=None)[source]¶ Bases:
atomsmm.forces._AtomsMM_CustomNonbondedForce
,atomsmm.forces.NearForce
This is a smoothed version of the Lennard-Jones + Coulomb potential
\[V_\mathrm{LJC}(r)=4\epsilon\left[ \left(\frac{\sigma}{r}\right)^{12}-\left(\frac{\sigma}{r}\right)^6 \right]+\frac{1}{4\pi\epsilon_0}\frac{q_1 q_2}{r}.\]The smoothing is accomplished by application of a 5th-order spline function \(S(u(r))\), which varies softly from 1 down to 0 along the range \(r_\mathrm{switch} \leq r \leq r_\mathrm{cut}\). Such function is
\[S(u)=1+u^3(15u-6u^2-10),\]where
\[\begin{split}u(r)=\begin{cases} 0 & r < r_\mathrm{switch} \\ \dfrac{r-r_\mathrm{switch}}{r_\mathrm{cut}-r_\mathrm{switch}} & r_\mathrm{switch} \leq r \leq r_\mathrm{cut} \\ 1 & r > r_\mathrm{cut} \end{cases}.\end{split}\]Such type of smoothing is essential for application in multiple time-scale integration using the RESPA-2 scheme described in Refs. [2], [3], and [4].
Three distinc versions are available:
Applying the switch directly to the potential:
\[V(r)=S(u(r))V_\mathrm{LJC}(r).\]Applying the switch to a shifted version of the potential:
\[V(r)=S(u(r))\left[V_\mathrm{LJC}(r)-V_\mathrm{LJC}(r_\mathrm{cut})\right]\]Applying the switch to the force that results from the potential:
\[\begin{split}& V(r)=V^\ast_\mathrm{LJC}(r)-V^\ast_\mathrm{LJC}(r_\mathrm{cut}) \\ & V^\ast_\mathrm{LJC}(r)=\left\{ 4\epsilon\left[f_{12}(u(r))\left(\frac{\sigma}{r}\right)^{12}-f_6(u(r))\left(\frac{\sigma}{r}\right)^6\right] + \frac{f_1(u(r))}{4\pi\epsilon_0}\frac{q_1 q_2}{r} \right\}\end{split}\]where \(f_n(u)\) is the solution of the 1st order differential equation
\[\begin{split}& f_n-\frac{u+b}{n}\frac{df_n}{du}=S(u) \\ & f_n(0)=1 \\ & b=\frac{r_\mathrm{switch}}{r_\mathrm{cut}-r_\mathrm{switch}}\end{split}\]As a consequence of this modification, \(V^\prime(r)=S(u(r))V^\prime_\mathrm{LJC}(r)\).
Note
In all cases, the Lorentz-Berthelot mixing rule is applied for unlike-atom interactions.
- Parameters
cutoff_distance (unit.Quantity) – The distance at which the nonbonded interaction vanishes.
switch_distance (unit.Quantity) – The distance at which the switching function begins to smooth the approach of the nonbonded interaction towards zero.
adjustment (str, optional, default=None) – A keyword for modifying the potential energy function. If it is None, then the switching function is applied directly to the original potential. Other options are ‘shift’ and ‘force-switch’. If it is ‘shift’, then the switching function is applied to a potential that is already null at the cutoff due to a previous shift. If it is ‘force-switch’, then the potential is modified so that the switching function is applied to the forces rather than the potential energy.
subtract (bool, optional, default=False) – Whether to substract (rather than add) the force.
actual_cutoff (unit.Quantity, optional, default=None) – The cutoff that will actually be used by OpenMM. This is often required for compatibility with other forces in the same force group. If it is None, then the passed cutoff_distance (see above) will be used.
-
class
atomsmm.forces.
NearExceptionForce
(cutoff_distance, switch_distance, adjustment=None, subtract=False)[source]¶ Bases:
atomsmm.forces._AtomsMM_CustomBondForce
,atomsmm.forces.NearForce
-
class
atomsmm.forces.
FarNonbondedForce
(preceding, cutoff_distance, switch_distance=None)[source]¶ Bases:
atomsmm.forces._AtomsMM_CompoundForce
The complement of NearNonbondedForce and NonbondedExceptionsForce classes in order to form a complete OpenMM NonbondedForce.
Note
Except for the shifting, this model is the ‘far’ part of the RESPA2 scheme of Refs. [2] and [3], with the switching function applied to the potential rather than to the force.
- Parameters
preceding (
NearNonbondedForce
) – The NearNonbondedForce object with which this Force is supposed to match.cutoff_distance (Number or unit.Quantity) – The distance at which the nonbonded interaction vanishes.
switch_distance (Number or unit.Quantity, optional, default=None) – The distance at which the switching function begins to smooth the approach of the nonbonded interaction towards zero. If this is None, then no switching will be done prior to the potential cutoff.
nonbondedMethod (openmm.NonbondedForce.Method, optional, default=PME) – The method to use for nonbonded interactions. Allowed values are NoCutoff, CutoffNonPeriodic, CutoffPeriodic, Ewald, PME, or LJPME.
ewaldErrorTolerance (Number, optional, default=1E-5) – The error tolerance for Ewald summation.
-
class
atomsmm.forces.
SoftcoreLennardJonesForce
(cutoff_distance=None, use_switching_function=None, switch_distance=None, use_dispersion_correction=None, parameter='lambda')[source]¶ Bases:
atomsmm.forces._AtomsMM_CustomNonbondedForce
A softened version of the Lennard-Jones potential.
\[\begin{split}& V(r)=4\lambda\epsilon\left(\frac{1}{s^2} - \frac{1}{s}\right) \\ & s = \left(\frac{r}{\sigma}\right)^6 + \frac{1}{2}(1-\lambda) \\ & \sigma=\frac{\sigma_1+\sigma_2}{2} \\ & \epsilon=\sqrt{\epsilon_1\epsilon_2}\end{split}\]- Parameters
cutoff_distance (Number or unit.Quantity) – The distance at which the nonbonded interaction vanishes.
switch_distance (Number or unit.Quantity) – The distance at which the switching function begins to smooth the approach of the nonbonded interaction towards zero.
-
class
atomsmm.forces.
SoftcoreForce
(cutoff_distance, switch_distance=None)[source]¶ Bases:
atomsmm.forces._AtomsMM_CustomNonbondedForce
A softened version of the Lennard-Jones+Coulomb potential.
\[\begin{split}& V(r) = V_\mathrm{vdw}(r) + V_\mathrm{coul}(r) & V_\mathrm{vdw}(r)=4\lambda_\mathrm{vdw}\epsilon\left(\frac{1}{s^2} - \frac{1}{s}\right) \\ & s = \left(\frac{r}{\sigma}\right)^6 + \frac{1}{2}(1-\lambda_\mathrm{vdw}) \\ & \sigma=\frac{\sigma_1+\sigma_2}{2} \\ & \epsilon=\sqrt{\epsilon_1\epsilon_2} & V_\mathrm{coul}(r)=\lambda_\mathrm{coul}\frac{q_1 q_2}{4\pi\epsilon_0}\frac{1}{r}\end{split}\]- Parameters
cutoff_distance (Number or unit.Quantity) – The distance at which the nonbonded interaction vanishes.
switch_distance (Number or unit.Quantity) – The distance at which the switching function begins to smooth the approach of the nonbonded interaction towards zero.