Introducing parent and child classes
As mentioned in Chapter 2, LAMMPS Syntax and Source Code Hierarchy, certain styles are given in the source code that can support child classes. These styles serve as parent classes and their child classes inherit their methods, thereby ensuring a degree of uniformity in the child classes that makes classification and syntax synthesis more streamlined. In this section, we will describe some of these parent classes and some of the inherited methods in their child classes.
fix.cpp and fix.h
These are the parent classes of all fixes used in LAMMPS. Among other purposes, they read the first three arguments common to all fixes (fix ID, group ID, and fix style) and sets up energy or virial computations. The following screenshot shows the code snippet from fix.cpp
that invokes an instance of LAMMPS and reads the three common arguments:
All fixes inherit these three arguments from fix...