Al,
you must be doing something wrong that you are not reporting. here is a quick demonstration.
I am attaching two files which are the lj/cut pair style from LAMMPS but renamed to be a new pair style “mything” implemented as a class PairMyThing so you can try for yourself.
I have a (CMake based) build folder where I have a successfully built LAMMPS compile, so that when I type “make” I get the following:
...
[ 10%] Generating includes/lammps/kspace.h
[ 10%] Built target kspace.h
[ 10%] Generating includes/lammps/lattice.h
[ 10%] Built target lattice.h
[ 10%] Generating C++ sources with cythonize...
[ 10%] Generating C++ sources with cythonize...
[100%] Built target lammps
[100%] Built target lmp
Now I copy the new files to the src folder and rerun cmake and then type “make” again:
...
[ 8%] Generating includes/lammps/kspace.h
[ 8%] Built target kspace.h
[ 8%] Generating includes/lammps/lattice.h
[ 8%] Built target lattice.h
[ 9%] Generating C++ sources with cythonize...
Consolidate compiler generated dependencies of target lammps
[ 9%] Building CXX object CMakeFiles/lammps.dir/home/akohlmey/compile/lammps/src/force.cpp.o
[ 9%] Building CXX object CMakeFiles/lammps.dir/home/akohlmey/compile/lammps/src/lammps.cpp.o
[ 9%] Building CXX object CMakeFiles/lammps.dir/home/akohlmey/compile/lammps/src/pair_mything.cpp.o
[ 9%] Generating C++ sources with cythonize...
[ 9%] Linking CXX shared library liblammps.so
[100%] Built target lammps
Consolidate compiler generated dependencies of target lmp
[100%] Linking CXX executable lmp
[100%] Built target lmp
Clearly the newly added source code was compiled and looking at the output of “./lmp -h” confirms that there is a pair style mything:
...
* Pair styles:
adp adp/omp agni agni/omp airebo
airebo/intel airebo/morse airebo/morse/intel airebo/morse/omp
airebo/omp atm awpmd/cut beck beck/omp
...
morse/smooth/linear morse/smooth/linear/omp morse/soft
multi/lucy multi/lucy/rx multi/lucy/rx/kk
multi/lucy/rx/kk/device multi/lucy/rx/kk/host mything
nb3b/harmonic nm/cut nm/cut/coul/cut nm/cut/coul/cut/omp
nm/cut/coul/long nm/cut/coul/long/omp nm/cut/omp
And I can run the also attached modified version of the LJ benchmark input with the new executable where it shows the name of the pair style in the neighbor list summary:
...
Neighbor list info ...
update every 20 steps, delay 0 steps, check no
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 2.8
ghost atom cutoff = 2.8
binsize = 1.4, bins = 24 24 24
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair mything, perpetual
attributes: half, newton on
pair build: half/bin/atomonly/newton
stencil: half/bin/3d
bin: standard
...
So, either you are not doing one of these steps correctly, or your source code is not correct, or you are not using the correct executable.
You can check with the attached files that I used for this demonstration…
pair_mything.h (2.1 KB)
pair_mything.cpp (20.1 KB)
in.mything (471 Bytes)