Accessing atom properties during simulation runs
In this section, we will learn how to access the properties of atoms during a simulation run using the Atom
class.
The Atom
class represented in atom.cpp
and atom.h
provides access to various atom properties, including the atom type, molecular ID, position, velocity, and force. These quantities are listed in the atom.h
header file, as follows:
These quantities can be accessed from other classes by importing this header file into their .cpp
files:
#include "atom.h"
Variables can be declared to read these quantities by using arrow operators that point to quantities in atom.h
. For example, as you can see in the preceding screenshot, to access the position of an atom defined by x
in atom.h
(line 58), we use the following line:
double **x = atom->x;
Here, **
indicates that x
is stored as a 2D array, where one dimension represents the atom index...