Making a new potential


I would like to make a new type of potential that is not currently supported by Lammps. Unfortunately, I am not very familiar with the development of large C++ codes and hacking is not something I ever do well, so I apologize in advance for
asking this question.

The feature I want to add is similar to
pair_lj_cut_coul_long.cpp/.h, so I’ve copied these two files to pair_t1_t2_t3_t4.cpp/.h. I think I see how to modify the code to do what I want, but for the moment I’ve just exactly copied the files, and only replaced PairLJCutCoulLong (in all places it appears) with PairT1T2T3T4. In addition, I’ve replaced
PairStyle(lj/cut/coul/long,PairT1T2T3T4) with

PairStyle(t1/t2/t3/t4,PairT1T2T3T4) in pair_t1_t2_t3_t4.h.

I then rebuild (first make clean-all, then make) Lammps and everything seems fine.

However, when I modify my input file (which worked fine with pair_style lj/cut/coul/long) to pair_style t1/t2/t3/t4, I get
ERROR: Invalid pair style (…/force.cpp:175). So, obviously I’ve missed something, or done something wrong.

I would appreciate any help, or if you could point me to a helpful resource.
I’ve found
to be very helpful, but unfortunately, I’m still misunderstanding something.



Did you change the ifdef lines in the header file to
correspond to what you have named the potential?

See doc/Section_modify.html and the slides
in the recent workshop (on web site) for
the developer’s session, on How to Modify LAMMPS.