[lammps-users] HOW IS THE LAMMPS RUNNING?

Hello Lammps

Suppose I want to use the tersoff potential(pair_tersoff.cpp), but in
the SRC/main.cpp I could not find pair_tersoff.cpp or pair_tersoff.h are
included as #include "pair_tersoff.cpp" and "pair_tersoff.h".

How can Lammps use the pair_tersoff.cpp ?

Could anybody explain how the code is running? I think any c++ program
must run from int main(). Why doesn't main.cpp include pair_tersoff.cpp?

Thank you!

Jian Yao

Hello Lammps

Suppose I want to use the tersoff potential(pair_tersoff.cpp), but in

please explain what you mean by "use".

the SRC/main.cpp I could not find pair_tersoff.cpp or pair_tersoff.h are
included as #include "pair_tersoff.cpp" and "pair_tersoff.h".

How can Lammps use the pair_tersoff.cpp ?

pair styles are activated through the Force:new_pair() method.

Could anybody explain how the code is running? I think any c++ program
must run from int main(). Why doesn't main.cpp include pair_tersoff.cpp?

why should it include pair_tersoff.cpp???

true, any c/c++ starts from main(), but you only need to include
(header) files that contain function prototypes or class definitions
that are used by main(). correspondingly for other files.
please update your knowledge of c/c++.

also, please keep in mind that lammps achieves its modularity and
extensiblity through smart use of the c++ class inheritance
mechanism and a few carefully crafted macros. also you have to
understand how "virtual" and "pure" methods work.

thus the implementation is not your standard "hello world"
type of code and you may have to work your way up through
the advanced section of your c++ programming book(s).

cheers,
   axel.