md.charge

Overview

md.charge.pppm Long-range electrostatics computed with the PPPM method.

Details

Electrostatic potentials.

Charged interactions are usually long ranged, and for computational efficiency this is split into two parts, one part computed in real space and on in Fourier space. You don’t need to worry about this implementation detail, however, as charge commands in hoomd automatically initialize and configure both the long and short range parts.

Only one method of computing charged interactions should be used at a time. Otherwise, they would add together and produce incorrect results.

class hoomd.md.charge.pppm(group, nlist)

Long-range electrostatics computed with the PPPM method.

Parameters:
  • group (hoomd.group) – Group on which to apply long range PPPM forces. The short range part is always applied between all particles.
  • nlist (hoomd.md.nlist) – Neighbor list

D. LeBard et. al. 2012 describes the PPPM implementation details in HOOMD-blue. Please cite it if you utilize the PPPM functionality in your work.

pppm specifies both the long-ranged and short range parts of the electrostatic force should be computed between all charged particles in the simulation. In other words, pppm initializes and sets all parameters for its own hoomd.md.pair.ewald, so do not specify an additional one.

The command supports additional screening of interactions, according to the Ewald summation for Yukawa potentials. This is useful if one wants to compute a screened interaction (i.e. a solution to the linearized Poisson-Boltzmann equation), yet the cut-off radius is so large that the computation with a purely short-ranged potential would become inefficient. In that case, the inverse Debye screening length can be supplied using set_params(). Also see Salin, G and Caillol, J. 2000, <http://dx.doi.org/10.1063/1.1326477>.

Parameters:

  • Nx - Number of grid points in x direction
  • Ny - Number of grid points in y direction
  • Nz - Number of grid points in z direction
  • order - Number of grid points in each direction to assign charges to
  • \(r_{\mathrm{cut}}\) - Cutoff for the short-ranged part of the electrostatics calculation

Parameters Nx, Ny, Nz, order, \(r_{\mathrm{cut}}\) must be set using set_params() before any hoomd.run() can take place.

See Units for information on the units assigned to charges in hoomd.

Note

pppm takes a particle group as an option. This should be the group of all charged particles (hoomd.group.charged()). However, note that this group is static and determined at the time pppm is specified. If you are going to add charged particles at a later point in the simulation with the data access API, ensure that this group includes those particles as well.

Important

In MPI simulations, the number of grid point along every dimensions must be a power of two.

Example:

charged = group.charged();
pppm = charge.pppm(group=charged)
disable(log=False)

Disable the force.

Parameters:log (bool) – Set to True if you plan to continue logging the potential energy associated with this force.

Examples:

force.disable()
force.disable(log=True)

Executing the disable command will remove the force from the simulation. Any hoomd.run() command executed after disabling a force will not calculate or use the force during the simulation. A disabled force can be re-enabled with enable().

By setting log to True, the values of the force can be logged even though the forces are not applied in the simulation. For forces that use cutoff radii, setting log=True will cause the correct r_cut values to be used throughout the simulation, and therefore possibly drive the neighbor list size larger than it otherwise would be. If log is left False, the potential energy associated with this force will not be available for logging.

enable()

Enable the force.

Examples:

force.enable()

See disable().

get_energy(group)

Get the energy of a particle group.

Parameters:group (hoomd.group) – The particle group to query the energy for.
Returns:The last computed energy for the members in the group.

Examples:

g = group.all()
energy = force.get_energy(g)
get_net_force(group)

Get the force of a particle group.

Parameters:group (hoomd.group) – The particle group to query the force for.
Returns:The last computed force for the members in the group.

Examples

g = group.all() force = force.get_net_force(g)

get_net_virial(group)

Get the virial of a particle group.

Parameters:group (hoomd.group) – The particle group to query the virial for.
Returns:The last computed virial for the members in the group.

Examples

g = group.all() virial = force.get_net_virial(g)

set_params(Nx, Ny, Nz, order, rcut, alpha=0.0)

Sets PPPM parameters.

Parameters:
  • Nx (int) – Number of grid points in x direction
  • Ny (int) – Number of grid points in y direction
  • Nz (int) – Number of grid points in z direction
  • order (int) – Number of grid points in each direction to assign charges to
  • rcut (float) – Cutoff for the short-ranged part of the electrostatics calculation
  • alpha (float, optional) – Debye screening parameter (in units 1/distance) .. versionadded:: 2.1

Examples:

pppm.set_params(Nx=64, Ny=64, Nz=64, order=6, rcut=2.0)

Note that the Fourier transforms are much faster for number of grid points of the form 2^N.