[lammps-users] How to modify function

General comment:

I’ve been analyzing and dissecting LAMMPS for months (just found this email list) but still cannot see its overall design. As an exercise, I set out to change the simple LJ potential thinking it would be a matter of simply changing one or two lines of code. But it’s not that simple. There are computations to some “force” all over pair_lj_cut.cpp.

The documentation is mostly for using LAMMPS as is.

Specific question (my goal):

I have a two and three-body potential function similar to the Stillinger-Weber function. So, I cannot use tables as they are for pairs. How do I specifically need to change pair_sw.cpp?

I agree that lammps is a great code that seems to be gaining in popularity albeit I wish the code was documented.

General comment:

majid,

I've been analyzing and dissecting LAMMPS for months (just found this email
list) but still cannot see its overall design. As an exercise, I set out to

have you considered reading the papers that describe lammps
and its implementation? there also have been LAMMPS tutorials
at different locations (this is how i learned about it) and
most likely some material of it is still online somewhere.

change the simple LJ potential thinking it would be a matter of simply

i don't quite get what your probklem is. one of the most appealing
features if LAMMPS is that you can so very easily implement and add
new potential types and other features. ...and then LAMMPS even comes
with a documentation on how to add those features.
http://lammps.sandia.gov/doc/Section_modify.html

the key to it is that you _only_ have to care about the essential
parts and the "nasty stuff" is hidden in the framework that you
don't have to mess with.

changing one or two lines of code. But it's not that simple. There are
computations to some "force" all over pair_lj_cut.cpp.

please have a look at the documentation! those different force
calculations serve different purposes (regular Verlet integration,
r-RESPA integration, computing individual pair interactions).

if you don't care about r-RESPA, or supporting computes, you
can just disable them via setting respa_enable or single_enable
to zero. see pair.h header for explanation.

The documentation is mostly for using LAMMPS as is.

Specific question (my goal):

I have a two and three-body potential function similar to the
Stillinger-Weber function. So, I cannot use tables as they are for pairs.
How do I specifically need to change pair_sw.cpp?

how should we know?? the best way is to follow the documentation
and create a new class and then use the existing pair_sw.* files
as a template and just rename the references to PairSW accordingly.

I agree that lammps is a great code that seems to be gaining in popularity
albeit I wish the code was documented.

i strongly disagree here. compared to all other MD codes that i
encountered so far, i found LAMMPS to be very well documented
and extremely easy to modify (where it is intended to be modified,
that is), while maintaining excellent scaling. the main trick is
to start "thinking the LAMMPS way" when using and modifying it
and not to expect that it is working like some other code you
may be used to.

cheers,
   axel.