How to use a function from other files in lammps

Dear all,

This may be a cpp question, but it is lammps related.

In lammps I can use pointer to use functions from other objects, like in verlet.cpp,

Dear all,

This may be a cpp question, but it is lammps related.

In lammps I can use pointer to use functions from other objects, like in
verlet.cpp,

force->pair->compute(eflag,vflag)

is used to calculate the pairwise force. While, how to use a function which
is not defined in pair.h but is defined in my pair_foo.h. I can define the
function in pair.h and it works. But it is not very clean. Is there some
other way to reach the function without define in pair.h file?

there are different ways to add "functions". which one is best depends
on the boundary conditions. it only needs to become a class member, if
it references any other class members. you can also declare standalone
functions and make them globally visible or only local (static). thus
you have to be more specific to get suitable advice, but you probably
need to get a bit better an understanding of C++ syntax and good
programming practices, too. the book i usually recommend for this is
steve oualline's "practical c++ programming":
http://www.oualline.com/books/index.html

axel.