Reviewing the compute KE class
In this section, we'll study the methods implemented in the compute KE
class, which calculates kinetic energy of a group of atoms.
The kinetic energy (KE) of an atom of mass m and linear velocity is calculated using the following equation:
The compute_ke.cpp
class can be used to calculate the kinetic energy of a specified group of atoms. In a LAMMPS input script, the corresponding syntax is as follows:
compute COMPUTE_ID GROUP_ID ke
As you can see, the COMPUTE_ID
parameter is the unique ID of the compute defined, while the GROUP_ID
parameter is the ID of the group of atoms that the compute acts on. This is described in detail in the LAMMPS manual (https://lammps.sandia.gov/doc/compute_ke.html). First, we will look at the constructor method, ComputeKE::ComputeKE()
, of this class.
ComputeKE::ComputeKE()
This constructor method inherits from the Compute
parent class (line 26) and checks the number...