Exploring the Variable class
In this section, we will outline the Variable
class and its source code in the variable.cpp
and variable.h
files. This class can assign variables in order to store constants or calculate atom and group properties, among other functionalities (see https://lammps.sandia.gov/doc/variable.html).
A variable can return scalar values or arrays of values that are useful for conveying information from one part of the script to another during a simulation run. An equal style variable sets the variable to a provided constant value or to a formula that performs a mathematical calculation or extracts a group, atom, region, compute, fix property, and more. The following screenshot from the set()
method shows the relevant code:
As you can see, upon detecting the equal
keyword (line 401), the find()
method is used to locate the name of the variable...