Pointer Difficulty in LAMMPS Source Code

Hi all,

I’m currently trying to make use of some functions in the Integrate class from within another class. however when I try to compile the module using the call (in the form of update->integrate->ev_set()) I get compilation errors saying things like:

error: invalid use of incomplete type ‘struct LAMMPS_NS::Integrate’
error: forward declaration of ‘struct LAMMPS_NS::Integrate’

This happens despite inheriting from the Pointers class, which as I understand it should include a pointer to the update object, and thus a means of accessing the functionality in Integrate. The only thing that occurs to me is that ev_set() is a protected function and so it may be an encapsulation issue I’m running into. At the same time, I’m hesitant to modify the integrate.cpp/h files to make my class a friend, so I would greatly appreciate it if someone could help me understand this issue and offer a solution to correct it, ideally with a minimum of alteration to LAMMPS base classes.

Thomas Allen
Dept. of Chemistry, UIUC

#include "integrate.h"

As Daniel indicates, you can’t access anything inside the Integrate
class unless you include its header. However, since ev_set() is not
public, you will still get an error. Currently, only classes
that derive from Integrate (like Verlet, Respa) invoke ev_set(),
so that is why it is organized that way.