pair

Pair force classes apply a force and virial on every particle in the simulation state commensurate with the potential energy:

Upair,total=12i=0Nparticles1ji,(i,j)exclusionsUpair(rij)U_\mathrm{pair,total} = \frac{1}{2} \sum_{i=0}^\mathrm{N_particles-1} \sum_{j \ne i, (i,j) \notin \mathrm{exclusions}} U_\mathrm{pair}(r_{ij})

where rij=minimum_image(rjri)\vec{r}_{ij} = \mathrm{minimum\_image}(\vec{r}_j - \vec{r}_i). Pair applies a short range cutoff using a hoomd.md.nlist.NeighborList for performance and assumes that both U(r)U(r) and its derivatives are 0 when rijrcutr_{ij} \ge r_\mathrm{cut}. Pair also ignores particle pairs that are excluded in the neighbor list.

Specifically, the force F\vec{F} on each pair of particles i,ji,j is:

F={Upair(r)r<rcut0rrcut\vec{F} = \begin{cases} -\nabla U_\mathrm{pair}(r) & r < r_{\mathrm{cut}} \\ 0 & r \ge r_{\mathrm{cut}} \\ \end{cases}

where the cutoff radius rcutr_{\mathrm{cut}} is given by Pair.r_cut.

Tip

Set Pair.r_cut to 0 to skip computations for non-interacting pairs.

Pair splits half the energy from each pair interaction onto particles ii and jj:

Ui=12ji,(i,j)exclusionsUpair(rij)[rij<rcut]U_i = \frac{1}{2} \sum_{j \ne i, (i,j) \notin \mathrm{exclusions}} U_\mathrm{pair}(r_{ij}) [r_{ij} < r_\mathrm{cut}]

and similarly for virials.

Shifting/smoothing mode

The function Upair(r)U_\mathrm{pair}(r) depends on the chosen form of the pair potential U(r)U(r) (by the Pair subclass) and the mode (Pair.mode):

Upair(r)={U(r)mode is noneU(r)U(rcut)mode is shiftS(r)U(r)mode is xplorron<rcutU(r)U(rcut)mode is xplorronrcutU_\mathrm{pair}(r) = \begin{cases} U_(r) & \mathrm{mode\ is\ \mathrm{none}} \\ U(r) - U(r_{\mathrm{cut}}) & \mathrm{mode\ is\ shift} \\ S(r) \cdot U_(r) & \mathrm{mode\ is\ xplor} \land r_{\mathrm{on}} < r_{\mathrm{cut}} \\ U(r) - U(r_{\mathrm{cut}}) & \mathrm{mode\ is\ xplor} \land r_{\mathrm{on}} \ge r_{\mathrm{cut}} \end{cases}

where S(r)S(r) is the XPLOR smoothing function:

S(r)={1r<ron(rcut2r2)2(rcut2+2r23ron2)(rcut2ron2)3ronrrcut0r>rcutS(r) = \begin{cases} 1 & r < r_{\mathrm{on}} \\ \frac{(r_{\mathrm{cut}}^2 - r^2)^2 \cdot (r_{\mathrm{cut}}^2 + 2r^2 - 3r_{\mathrm{on}}^2)}{(r_{\mathrm{cut}}^2 - r_{\mathrm{on}}^2)^3} & r_{\mathrm{on}} \le r \le r_{\mathrm{cut}} \\ 0 & r > r_{\mathrm{cut}} \\ \end{cases}

where ronr_{\mathrm{on}} is given by Pair.r_on.

The XPLOR smoothing function S(r)S(r) ensures that both the potential energy and the force going smoothly to 0 at r=rcutr = r_{\mathrm{cut}}, reducing the rate of energy drift in long simulations. ronr_{\mathrm{on}} controls the point at which the smoothing starts. Set it to modify only the tail of the potential. The WCA potential and it’s first derivative already go smoothly to 0 at the cutoff, so there is no need to apply the smoothing function. In such mixed systems, set ronr_{\mathrm{on}} to a value greater than rcutr_{\mathrm{cut}} for those pairs that interact via WCA in order to enable shifting of the WCA potential to 0 at the cutoff.

Tail correction

Some pair potentials can optionally apply isotropic integrated long range tail corrections when the tail_correction parameter is True. These corrections are only valid when the shifting/smoothing mode is set to "none". Following Sun 1998, the pressure and energy corrections ΔP\Delta P and ΔE\Delta E are given by:

ΔP=2π3i=1nρij=1nρjrcut(rdUij(r)dr)r2dr\Delta P = \frac{-2\pi}{3} \sum_{i=1}^{n} \rho_i \sum_{j=1}^{n} \rho_j \int_{r_\mathrm{cut}}^{\infty} \left( r \frac{\mathrm{d}U_{ij}(r)}{\mathrm{d}r} \right) r^2 \mathrm{d}r

and

ΔE=2πi=1nNij=1nρjrcutUij(r)r2dr,\Delta E = 2\pi \sum_{i=1}^{n} N_i \sum_{j=1}^{n} \rho_j \int_{r_\mathrm{cut}}^{\infty} U_{ij}(r) r^2 \mathrm{d}r,

where nn is the number of unique particle types in the system, ρi\rho_i is the number density of particles of type ii in the system, Uij(r)U_{ij}(r) is the pair potential between particles of type ii and jj, and NiN_i is the number of particles of type ii in the system. These expressions assume that the radial pair distribution functions gij(r)g_{ij}(r) are unity at the cutoff and beyond.

The pressure shift ΔP\Delta P appears in the additional virial term WadditionalW_\mathrm{additional} (Force.additional_virial) and the energy shift appears in the additional energy UadditionalU_\mathrm{additional} (Force.additional_energy).

Warning

The value of the tail corrections depends on the number of each type of particle in the system, and these are precomputed when the pair potential object is initialized. If the number of any of the types of particles changes, the tail corrections will yield invalid results.

Anisotropic potentials

For anisotropic potentials see hoomd.md.pair.aniso

Modules

Classes