How to incorporate custom fix, not already in src directory, and rebuild LAMMPS (29Aug2024)

There is a new ‘fix’ file I found externally, say e.g. ‘fix_new.cpp’ and ‘fix_new.h’.
I have just drag-and-dropped them in the ‘src/MISC’ directory. But on entering the command ‘make yes-MISC’ all other fixes except the new one is getting installed.

How to add the new one so that I can work with it in simulations?

You either have to modify the src/MISC/Install.sh script or copy the files directly to the src/ folder.

BTW: we are now generally discouraging the use of the traditional build system and will gradually move to only support building LAMMPS with CMake, where make yes-/no-<package> is replaced by -D PKG_PACKAGE=yes/no.

1 Like

I copied those directly to the src/ folder. But on executing an input script containing this fix (e.g. fix 3 all new … …) the following error is shown -
"ERROR: Illegal fix new command (…/fix_new.cpp:40)
Last command: fix 3 all new {Dr} {fp} 0.0
"
Am I missing something?

Thanks!

Very likely. But there is not enough information here to say what.
There is plenty of information about adding code to LAMMPS in the Programmer’s Guide part of the LAMMPS manual.

https://docs.lammps.org/Developer_write.html
https://docs.lammps.org/Modify_fix.html

So either study the manual and figure it out by yourself, or provide all the information and files needed to reproduce your issue.

1 Like