Problem in adding new pair potential and update potential

Dear all,
Currently, I am doing simulation of carbon-nickel interaction. Where the potential I used is shibuta potential. Here the link For that, to meet my condition. I should to create a pair style cpp class. One is pair_shibuta.cpp and pair_shibuta.h.

Then I put all files inside src directory of lammps-9Dec14 (version). After that, I was do the following steps:

  1. Open cygwin terminal (I use windows 8). Then go to src of lammps.
  2. Go to lib/meam then typing
    $ make -f Makefile.gfortran
  3. Go to lib/poems then typing
    $ make -f Makefile.g++
  4. Go to src/STUBS then typing
    $ make
  5. Typing:
    make makelib // to create Makelib file, where now pair_shibuta is listed make makeshlib // to create Makeshlib file, where now pair_shibuta is listed
    make makelist make serial

Everyting is going fine. I have folder Obj_serial inside src directory and got lmp_serial.exe. Inside Obj_serial I found pair_shibuta.d and pair_shibuta.o mean shibuta potential is listed inside lmp_serial.exe. After that, I create an input file which describe interaction of carbon and nickel surface. But, I met error “invalid pair style (…force.cpp)”. When I open force.cpp file, I knew that pair_shibuta is not listed inside lmp_serial.exe at all. Based on the shibuta potential, this potential need 9 or 8 parameters.

To solve this problem, I was try to modify Morse potential. Then did the same steps like before. But, I got error “incorrect arg …” . In input file, I wrote the code (snippet)

pair_style hybrid morse 3.0 eam/fs/omp airebo/omp 9.5409 1 1
pair_coeff 1 2 morse 2.4673 1.3 1.8706 1.7628 0.0628 -0.5351 1 2.7 3.0

I knew this error tell to me that pair coefficient is not correct. But, when I change the code above like below

pair_style hybrid morse 3.0 eam/fs/omp airebo/omp 9.5409 1 1
pair_coeff 1 2 morse 2.4673 1.8706 3.0

lammps can execute. This is very strenght. How come, lmp_serial know the original code of pair_morse.cpp meanwhile I was edit it before rebuild? So, please tell me how to solve this problem. I also did the same step like above on window7 in cygwin environment. But, I met the same result as well.


Ibnu Syuhada
Doctor Student of Bandung Institute of Technology, Indonesia

there is no way to give advice on this, since you don't provide any
details on the actual code that you wrote and what your skill level in
C++ programming is. from your description it seems that you made
mistakes in your code and particularly didn't follow exactly *all* the
steps necessary to add a new potential file to LAMMPS. there are many
ways to make mistakes, and the compilation procedure is the easiest
and least error prone step of them all.


IDEA: If the intention as you say is to try to modify the Morse potential I think you could try to open the actual fix.cpp for the MORSE potential and modify the variables to change an actual potential and then recompile …. Trying to implement a new potential in lammps seems something not trivial (at least at my current level of programming skills) , but certainly I bet you would need to look at the Source Code into a deeply level (something not willing to do personally). Also I want to say its terrific the amount of c++ programming you can learn by looking/browsing the LAMMPS’s Source Code ……=)

FWIW, with the provided code, i have no problems compiling and
including the custom pair potential style. so i cannot reproduce the
problem. it has to be something in the process of compiling.

since the compilation is done on windows, all bets are off. i would
recommend to install a virtual machine software and then use a linux
virtual machine or use a linux machine directly. development (and
debugging) is *so* much easier on linux.