wca

mdhelper.openmm.pair.wca(cutoff: float | Quantity, *, mix: str = 'arithmetic', powers: dict[str, float] | tuple[float, float] = (12, 6), global_params: dict[str, float | Quantity] = None, per_params: list = None, tab_funcs: dict[str, ndarray[int | float] | Quantity | Discrete2DFunction] = None) CustomNonbondedForce[source]

Implements the generalized Weeks–Chander–Andersen (WCA) pair potential.

The potential energy between two WCA particles is given by

\[\begin{split}\begin{gather*} u_\mathrm{WCA}(r_{12})=\begin{cases} C_\mathrm{Mie}\epsilon_{12}\left[ \left(\dfrac{\sigma_{12}}{r_{12}}\right)^{\gamma_\mathrm{r}} -\left(\dfrac{\sigma_{12}}{r_{12}}\right)^{\gamma_\mathrm{a}} \right]+\epsilon_{12},&\mathrm{if}\,r_{12}<r_\mathrm{WCA}\\ 0,&\mathrm{if}\,r_{12}\geq r_\mathrm{WCA} \end{cases}\\ C_\mathrm{Mie}=\frac{\gamma_\mathrm{r}} {\gamma_\mathrm{r}-\gamma_\mathrm{a}} \left(\frac{\gamma_\mathrm{r}}{\gamma_\mathrm{a}}\right) ^{\gamma_\mathrm{a}/(\gamma_\mathrm{r}-\gamma_\mathrm{a})} \end{gather*}\end{split}\]

where \(\sigma_{12}\) is the average particle size in \(\mathrm{nm}\), \(\epsilon_{12}\) is the dispersion energy in \(\mathrm{kJ/mol}\), \(\gamma_\mathrm{r}\) and \(\gamma_\mathrm{a}\) are the powers for the repulsive and attractive terms, respectively, and \(r_\mathrm{WCA}=(\gamma_\mathrm{r}/\gamma_\mathrm{a}) ^{1/(\gamma_\mathrm{r}-\gamma_\mathrm{a})}\sigma_{12}\) is the cutoff distance.

After creating the pair potentials, particles should be registered using openmm.openmm.CustomNonbondedForce.addParticle().

Parameters:
cutofffloat or openmm.unit.Quantity

Shared cutoff distance \(r_\mathrm{cut}\) for all nonbonded interactions in the simulation sytem. Must be less than half the minimum periodic simulation box dimension.

Reference unit: \(\mathrm{nm}\).

powerstuple or dict, keyword-only, default: (12, 6)

Powers \(\gamma_\mathrm{r}\) and \(\gamma_\mathrm{a}\), in that order. If a dict is provided, use the keys "r" and "a", respectively.

mixstr, keyword-only, default: "arithmetic"

Mixing rule for \(\sigma_{12}\) and \(\epsilon_{12}\).

Valid values:

  • "arithmetic": Lorentz-Berthelot combining rule.

    \[\begin{split}\begin{gather*} \sigma_{12}=\frac{\sigma_1+\sigma_2}{2}\\ \epsilon_{12}=\sqrt{\epsilon_1\epsilon_2} \end{gather*}\end{split}\]

    Per-particle parameters: \((\sigma_i,\,\epsilon_i)\).

  • "geometric": Geometric mixing rule.

    \[\begin{split}\begin{gather*} \sigma_{12}=\sqrt{\sigma_1\sigma_2}\\ \epsilon_{12}=\sqrt{\epsilon_1\epsilon_2} \end{gather*}\end{split}\]

    Per-particle parameters: \((\sigma_i,\,\epsilon_i)\).

  • "sixthpower": Sixth-power mixing rule.

    \[\begin{split}\begin{gather*} \sigma_{12}=\left(\frac{\sigma_1^6 +\sigma_2^6}{2}\right)^{1/6}\\ \epsilon_{12}=\frac{2\sqrt{\epsilon_1\epsilon_2} \sigma_1^3\sigma_2^3}{\sigma_1^6+\sigma_2^6} \end{gather*}\end{split}\]

    Per-particle parameters: \((\sigma_i,\,\epsilon_i)\).

  • "sigma12 = ...; epsilon12 = ...;": Custom mixing rule. The string containing the expression for \(\sigma_{12}\) and \(\epsilon_{12}\) must be written in valid C++ syntax, with any custom global and per-particle parameters and tabulated functions defined in global_params, per_params, and tab_funcs, respectively.

global_paramsdict, keyword-only, optional

Additional global parameters for use in the definition of \(\sigma_{12}\) and \(\epsilon_{12}\).

per_paramslist, keyword-only, optional

Additional per-particle parameters for use in the definition of \(\sigma_{12}\) and \(\epsilon_{12}\).

tab_funcsdict, keyword-only, optional

Optional tabulated functions for use in the definition of \(\sigma_{12}\) and \(\epsilon_{12}\).

Returns:
pair_wcaopenmm.CustomNonbondedForce

WCA pair potential.