md.improper

Overview

md.improper.harmonic Harmonic improper potential.

Details

Improper potentials.

Impropers add forces between specified quadruplets of particles and are typically used to model rotation about chemical bonds without having bonds to connect the atoms. Their most common use is to keep structural elements flat, i.e. model the effect of conjugated double bonds, like in benzene rings and its derivatives.

By themselves, impropers that have been specified in an input file do nothing. Only when you specify an improper force (i.e. improper.harmonic), are forces actually calculated between the listed particles.

class hoomd.md.improper.coeff

Define improper coefficients.

The coefficients for all improper force are specified using this class. Coefficients are specified per improper type.

Examples:

my_coeffs = improper.coeff();
my_improper_force.improper_coeff.set('polymer', k=330.0, r=0.84)
my_improper_force.improper_coeff.set('backbone', k=330.0, r=0.84)
set(type, **coeffs)

Sets parameters for one improper type.

Parameters:
  • type (str) – Type of improper (or list of types).
  • coeffs – Named coefficients (see below for examples)

Calling set() results in one or more parameters being set for a improper type. Types are identified by name, and parameters are also added by name. Which parameters you need to specify depends on the improper force you are setting these coefficients for, see the corresponding documentation.

All possible improper types as defined in the simulation box must be specified before executing hoomd.run(). You will receive an error if you fail to do so. It is not an error, however, to specify coefficients for improper types that do not exist in the simulation. This can be useful in defining a force field for many different types of impropers even when some simulations only include a subset.

To set the same coefficients between many particle types, provide a list of type names instead of a single one. All types in the list will be set to the same parameters.

Examples:

my_improper_force.improper_coeff.set('polymer', k=330.0, r0=0.84)
my_improper_force.improper_coeff.set('backbone', k=1000.0, r0=1.0)
my_improper_force.improper_coeff.set(['improperA','improperB'], k=100, r0=0.0)

Note

Single parameters can be updated. If both k and r0 have already been set for a particle type, then executing coeff.set('polymer', r0=1.0) will update the value of r0 and leave the other parameters as they were previously set.

class hoomd.md.improper.harmonic

Harmonic improper potential.

The command improper.harmonic specifies a harmonic improper potential energy between every quadruplet of particles in the simulation.

\[V(r) = \frac{1}{2}k \left( \chi - \chi_{0} \right )^2\]

where \(\chi\) is angle between two sides of the improper.

Coefficients:

  • \(k\) - strength of force, k (in energy units)
  • \(\chi_{0}\) - equilibrium angle, chi (in radians)

Coefficients \(k\) and \(\chi_0\) must be set for each type of improper in the simulation using improper_coeff.set().

Examples:

harmonic.improper_coeff.set('heme-ang', k=30.0, chi=1.57)
harmonic.improper_coeff.set('hydro-bond', k=20.0, chi=1.57)
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)