add potential

Dear lammps developers,

I write 2 files pair_mymorse.cpp and pair_mymorse.h that define a new class PairMymorse by making some minor changes to the two files pair_morse.cpp and pair_morse.h in the src dir and re-building LAMMPS with “make serial” , this is the screenshot of my compiling result:B7BEABB9@...6016....jpg


Do I need to change other files? If yes, which file? I am not very familiar with c++ code, and I need to use this new pair_style to perform my simulation, so could you please give me some detailed instruction? 
Thank you very much! 
Best regards
Michelle

It looks like either you forgot a declaration somewhere, maybe because you forgot to update the PairStyle macro in pair_mymorse.h. However, without the actual source files it is difficult to find out where the exact problem is.

B7BEABB9@...6016....jpg

Dear lammps developers,

I write 2 files pair_mymorse.cpp and pair_mymorse.h that define a new
class PairMymorse by making some minor changes to the two files
pair_morse.cpp and pair_morse.h in the src dir and re-building LAMMPS with
"make serial" , this is the screenshot of my compiling result:

Do I need to change other files? If yes, which file? I am not very familiar with c++ code, and I need to use this new pair_style to perform my simulation, so could you please give me some detailed instruction?

​the manual is quite specific on what needs to be done and anything beyond
is not a LAMMPS issue but knowing how to program and how to compile.
teaching you these skills i beyond the scope of this mailing list.

your quoted text looks funny. please make sure that your source code is
using plain ASCII encoding (best in the C locale)​ and not UTF-16 or
anything else that is weird and confuses tools written for plain (ASCII)
text.

axel.

B7BEABB9@...6016....jpg

I.e. Section 10 of the manual.

Steve

B7BEABB9@...6016....jpg

Dear Steve, Axel and Stefan, thank you so much for your sincere help. After modifying the lines “#ifndef LMP_PAIR_MYEXP1_H
#define LMP_PAIR_MYEXP1_H”, my compiling problem has been solved, and I get pair_mymorse.o and pair_mymorse.d files in the folder Obj_serial. I think now it’s OK
to use the command “pair_style mymorse 10.0”, but still I failed.

screenshot is like this DC4ED51D@...6022....jpgso what’s wrong this time?
Thank you so much!

Best regards,
Michelle

B7BEABB9@...6016....jpg

Dear Steve, Axel and Stefan, thank you so much for your sincere help.
After modifying the lines "#ifndef LMP_PAIR_MYEXP1_H
#define LMP_PAIR_MYEXP1_H", my compiling problem has been solved, and I
get pair_mymorse.o and pair_mymorse.d files in the folder Obj_serial. I
think now it's OK
to use the command "pair_style mymorse 10.0", but still I failed.

screenshot is like this so what's wrong this time?

​impossible to say from remote without being able to look over your
shoulder. most likely there is a mismatch between the string used in the
PairStyle() macro and what you have in your input. but there are several
other possible explanations. you can verify, if the binary you use contains
the mymorse style by using the -h flag and checking the list of available
pair styles printed.

axel.

DC4ED51D@...6022....jpg

B7BEABB9@...6016....jpg

Thank you! After verifying I find out that it is not included in the list of available pair styles, this is my PairStyle() line in pair_mymorse.hD8D6BE42@...6027....jpg

In the manual it says by putting the two source files in the src dir and re-building LAMMPS a new class is invoked, so I didn’t change other files in the src dir.
I attach my .cpp and .h files, in fact, they are derived from pair_morse.cpp and pair_morse.h. Then it is more convenient for you to figure out my problem.

Thank you so much!
sincere,
Michelle

B7BEABB9@...6016....jpg

DC4ED51D@...6022....jpg

pair_mymorse.cpp (10.6 KB)

pair_mymorse.h (1.99 KB)

Thank you! After verifying I find out that it is not included in the list
of available pair styles, this is my PairStyle() line in pair_mymorse.h
In the manual it says by putting the two source files in the src dir and
re-building LAMMPS a new class is invoked, so I didn't change other files
in the src dir.
I attach my .cpp and .h files, in fact, they are derived from
pair_morse.cpp and pair_morse.h. Then it is more convenient for you to
figure out my problem.

​when i put those files into my build directory, they build correctly and
there is no problem using the style from LAMMPS:

LAMMPS (14 Mar 2016-ICMS)
WARNING: OMP_NUM_THREADS environment is not set. (../comm.cpp:90)
  using 1 OpenMP thread(s) per MPI task
units real
pair_style mymorse 10.0
lattice fcc 4.32
Lattice spacing in x,y,z = 4.32 4.32 4.32
Total wall time: 0:00:19

axel.

D8D6BE42@...6027....jpg