# energy

Calculate simple bond, angle, dihedral, and non-bonded energy terms (no PME).

`energy [<name>] [<mask1>] [out <filename>] [nobondstoh] [bond] [angle] [dihedral] {[nb14]|[e14]|[v14]} {[nonbond]|[elec] [vdw]} [{nokinetic|kinetic [ketype {vel|vv}] [dt <dt>]}] [ etype { simple | directsum [npoints <N>] | ewald [cut <cutoff>] [dsumtol <dtol>] [ewcoeff <coeff>] [erfcdx <dx>] [skinnb <skinnb>] [ljswidth <width>] [rsumtol <rtol>] [maxexp <max>] [mlimits <X>,<Y>,<Z>] | pme [cut <cutoff>] [dsumtol <dtol>] [ewcoeff <coeff>] [erfcdx <dx>] [skinnb <skinnb>] [ljswidth <width>] [order <order>] [nfft <nfft1>,<nfft2>,<nfft3>] [ljpme [ewcoefflj <ljcoeff>]] } ]`

`[<name>`] Data set name.
`[<mask1>]` Mask of atoms to calculate energy for.
`[out <filename>]` File to write results to.
`[nobondstoh]` Skip calculating the energy of bonds to hydrogen.
`[bond]` Calculate bond energy.
`[angle]` Calculate angle energy.
`[dihedral]` Calculate dihedral energy.
`[nb14]` Calculate nonbonded 1-4 energy.
`[e14]` Calculate 1-4 electrostatics.
`[v14]` Calculate 1-4 van der Waals.
`[nonbond]` Calculate nonbonded energy (electrostatics and van der Waals).
`[elec]` Calculate electrostatic energy.
`[vdw]` Calculate van der Waals energy.
`[nokinetic]` Do not calculate kinetic energy even if velocity/force information present.
`[kinetic]` Attempt to calculate kinetic energy. Requires force and/or velocity information.
`ketype {vel|vv}` Specify kinetic energy type. If not specified, if velocity and force information use a velocity verlet-type calculation (vv), i.e. assume velocities are a half-step ahead of the forces. If only velocity information is present, calculate from on-step velocities (vel).
`dt <dt>` Time step for vv calculation in ps.
`[etype <type>]` Calculate electrostatics via specified type.
`[simple]` Use simple Coulomb term for electrostatics, no cutoff.
`[directsum]` Use direct summation method for electrostatics.
`[npoints <N>]` Number of cells in each direction to calculate the direct sum.
`[ewald]` Use Ewald summation for electrostatics. If van der Waals energy will be calculated a long-range correction for periodicity will be applied.
`cut <cutoff>` Direct space cutoff in Angstroms (default 8.0).
`dsumtol <dtol>` Direct sum tolerance (default 0.00001). Used to determine Ewald coefficient.
`rsumtol <rtol>` Reciprocal sum tolerance (default 0.00005). Used to determine number of reciprocal space vectors.
`ewcoeff <coeff>` Ewald coefficient in 1/Ang.
`skinnb` Used to determine pairlist atoms (added to cut, so pairlist cutoff is cut + skinnb); included in order to maintain consistency with results from sander.
`mlimits <X>,<Y>,<Z>` Explicitly set the number of reciprocal space vectors in each dimension.
`[pme]` Use particle mesh Ewald for electrostatics. If van der Waals energy will be calculated a long-range correction for periodicity will be applied.
`cut <cutoff>` Direct space cutoff in Angstroms (default 8.0).
`dsumtol <dtol>` Direct sum tolerance (default 0.00001). Used to determine Ewald coefficient.
`ewcoe<coe>` Ewald coefficient in 1/Ang.
`erfcdx <dx>` Spacing to use for the ERFC splines (default 0.0002 Ang.).
`skinnb` Used to determine pairlist atoms (added to cut, so pairlist cutoff is cut + skinnb); included in order to maintain consistency with results from sander.
`ljswidth <width>` If specified, use a force-switching form for the Lennard-Jones calculation from `<cutoff>-<width>` to `<cutoff>`.
`order <order>` Spline order for charges.
`nfft <nt1>,<nt2>,<nt3>` Explicitly set the number of FFT grid points in each dimension. Will be determined automatically if not specified.
`ljpme` If specified use particle mesh Ewald for calculating Lennard-Jones interactions.
`ewcoej` Ewald coefficient for Lennard-Jones PME (implies `ljpme`)

DataSet Aspects:
`[bond]` Bond energy.
`[angle]` Angle energy.
`[dih]` Dihedral energy.
`[vdw14]` 1-4 van der Waals energy.
`[elec14]` 1-4 electrostatic energy.
`[vdw]` van der Waals energy.
`[elec]` Electrostatic energy.
`[total]` Total energy.

Calculate the energy for atoms in `<mask>`. If no terms are specified, all terms are calculated. Note that the nonbonded energy terms for ’simple’ do not take into account periodicity and there is no distance cut-off. Electrostatics can also be determined via the direct sum, Ewald, or particle-mesh Ewald summation procedures. The particle
mesh Ewald functionality requires that CPPTRAJ be compiled with FFTW and a C++11 compliant compiler.

Calculation of energy terms requires that the associated topology file have parameters for any of the calculated terms, so for example angle calculations are not possible when using a PDB file as a topology, etc. All nonbonded calculations methods other than simple require unit cell parameters.

For example, to calculate all energy terms and write to a Grace-format file:

```parm DPDP.parm7
trajin DPDP.nc
energy DPDP out ene.agr```