Detailed Description
Lennard-Jones pair force.
The command pair.lj specifies that a Lennard-Jones type pair force should be added to every non-bonded particle pair in the simulation.
\begin{eqnarray*} V_{\mathrm{LJ}}(r) = & 4 \varepsilon \left[ \left( \frac{\sigma}{r} \right)^{12} - \alpha \left( \frac{\sigma}{r} \right)^{6} \right] & r < r_{\mathrm{cut}} \\ = & 0 & r \ge r_{\mathrm{cut}} \\ \end{eqnarray*}
For an exact definition of the force and potential calculation and how cutoff radii are handled, see pair.
The following coefficients must be set per unique pair of particle types. See hoomd_script.pair or the Quick Start Tutorial for information on how to set coefficients.
- \( \varepsilon \) -
epsilon(in energy units) - \( \sigma \) -
sigma(in distance units) - \( \alpha \) -
alpha(unitless)- optional: defaults to 1.0
- \( r_{\mathrm{cut}} \) -
r_cut(in distance units)- optional: defaults to the global r_cut specified in the pair command
- \( r_{\mathrm{on}} \) -
r_on(in distance units)- optional: defaults to the global r_cut specified in the pair command
pair.lj is a standard pair potential and supports a number of energy shift / smoothing modes. See hoomd_script.pair.pair for a full description of the various options.
Example:
For more information on setting pair coefficients, including examples with wildcards, see pair_coeff.set().
The cutoff radius r_cut passed into the initial pair.lj command sets the default r_cut for all pair interactions. Smaller (or larger) cutoffs can be set individually per each type pair. The cutoff distances used for the neighbor list will by dynamically determined from the maximum of all r_cut values specified among all type pair parameters among all pair potentials.
- MPI Support
- This command works in MPI parallel jobs.
- Examples:
- analyze_imd, create_random_polymers, dump_dcd, init_create_empty, init_reset, and init_xml.
Public Member Functions | |
| def | __init__ |
| Specify the Lennard-Jones pair force. More... | |
| def | set_params |
| Set parameters controlling the way forces are computed. More... | |
| def | disable |
| Disables the force. More... | |
| def | benchmark |
| Benchmarks the force computation. More... | |
| def | enable |
| Enables the force. More... | |
Constructor & Destructor Documentation
| def __init__ | ( | self, | |
| r_cut, | |||
name = None |
|||
| ) |
Specify the Lennard-Jones pair force.
- Parameters
-
r_cut Default cutoff radius (in distance units) name Name of the force instance
Example:
- Note
- Pair coefficients for all type pairs in the simulation must be set before it can be started with run()
Member Function Documentation
|
inherited |
Benchmarks the force computation.
- Parameters
-
n Number of iterations to average the benchmark over
Examples:
The value returned by benchmark() is the average time to perform the force computation, in milliseconds. The benchmark is performed by taking the current positions of all particles in the simulation and repeatedly calculating the forces on them. Thus, you can benchmark different situations as you need to by simply running a simulation to achieve the desired state before running benchmark().
- Note
- There is, however, one subtle side effect. If the benchmark() command is run directly after the particle data is initialized with an init command, then the results of the benchmark will not be typical of the time needed during the actual simulation. Particles are not reordered to improve cache performance until at least one time step is performed. Executing run(1) before the benchmark will solve this problem.
To use this command, you must have saved the force in a variable, as shown in this example:
|
inherited |
Disables the force.
- Parameters
-
log Set to True if you plan to continue logging the potential energy associated with this force.
Examples:
Executing the disable command will remove the force from the simulation. Any 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.
To use this command, you must have saved the force in a variable, as shown in this example:
|
inherited |
|
inherited |
Set parameters controlling the way forces are computed.
- Parameters
-
mode (if set) Set the mode with which potentials are handled at the cutoff
valid values for mode are: "none" (the default), "shift", and "xplor"
- none - No shifting is performed and potentials are abruptly cut off
- shift - A constant shift is applied to the entire potential so that it is 0 at the cutoff
- xplor - A smoothing function is applied to gradually decrease both the force and potential to 0 at the cutoff when ron < rcut, and shifts the potential to 0 ar the cutoff when ron >= rcut. (see pair above for formulas and more information)
Examples:

