AEAM LAMMPS plugin

Hello Dear LAMMPS users,

I am going to install the AEAM plugin from the link below:

Unfortunately, I encounter different errors every time. If possible, please tell me all the steps to install this plugin.

Regars

Unless you provide us with exact details of what kinds of errors you encounter, what steps you did to compile/install the plugin(s) and - most importantly - what version of the LAMMPS source code you are using and what platform with what compilers you are compiling on, it is not going to be possible to address them.

There is not much to compiling as a plugin. The information is in the README and the LAMMPS manual section on plugins.

In general, please pay attention to the posted forum guidelines.

I appreciate your response. You’re correct in your assessment. I’m currently working with the LAMMPS version dated August 2, 2023, on a Linux (Ubuntu) platform. I compiled this specific LAMMPS version, and subsequently, I acquired the associated plugin from its GitHub repository by cloning it into the ‘lammps/2Aug2023/src’ directory. Towards the end of this process, I utilized the following command to install the plugin:

cmake -S . -B build -DLAMMPS_SOURCE_DIR=/path/to/lammps/src

However, I encountered this error during this installation steps:

– The CXX compiler identification is GNU 9.4.0
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
CMake Error at CMakeLists.txt:19 (include):
include could not find load file:

LAMMPSInterfacePlugin
CMake Error at USER-AEAM/CMakeLists.txt:20 (include):
include could not find load file:

LAMMPSInterfacePlugin
CMake Error at USER-BFIELD/CMakeLists.txt:20 (include):
include could not find load file:

LAMMPSInterfacePlugin
CMake Error at USER-REBOMOS/CMakeLists.txt:20 (include):
include could not find load file:

LAMMPSInterfacePlugin
– Configuring incomplete, errors occurred!

Thank you.

That is a very bad idea. These plugin sources are a separate project and have no place within the LAMMPS source tree as such.

Please use some common sense here!! The text “/path/to/lammps/src” is not supposed to be used literally (and how should anybody know where exactly your LAMMPS sources are located?), but you have to replace it with the path to the “src” folder in your actual LAMMPS source tree. From that the CMake script can figure out the location of other files in the LAMMPS distribution it needs to read to complete its job and the errors you see will go away.

That said, since you are already compiling LAMMPS from source and not trying to compile the plugins as add-ons to an existing binary, you could follow a much simpler procedure: Just copy the pair_aeam.h and pair_aeam.cpp files to the “src” folder of your LAMMPS source and just recompile LAMMPS. It should pick up the files and include them in to the LAMMPS executable directly. No fiddling with plugin loading is required (unless that is something that excites you technically, but I don’t have the impression that you care about such things much :wink:).

Hello Axel
I am adding potential to Lammps. Lammps version 2Aug2023 is used and I am working in Ubuntu Linux environment.
I have already done the installation as you suggested without any problems. In fact, I recompiled by copying the following files and there was no problem:
Pair_aeam.cpp & pair_aeam.h

But now I proceed with the same method, but I get the following error:

../pair_aeam.cpp:681:32: error: ‘int LAMMPS_NS::NeighRequest::full’ is protected within this context
  681 |  neighbor->requests[irequest]->full = 1;
      |                                ^~~~
In file included from ../pair_aeam.cpp:24:
../neigh_request.h:56:7: note: declared protected here
   56 |   int full;    // full neigh list
      |       ^~~~
../pair_aeam.cpp: In member function ‘virtual void LAMMPS_NS::PairAEAM::read_file(char*)’:
../pair_aeam.cpp:737:24: error: ‘class LAMMPS_NS::Atom’ has no member named ‘count_words’
  737 |     int nwords = atom->count_words(line);
      |                        ^~~~~~~~~~~
../pair_aeam.cpp:729:36: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
  729 |   for (i=0; i<nheader1; i++) fgets (line , MAXLINE , fptr);
      |                              ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
../pair_aeam.cpp:774:8: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
  774 |   fgets(line,MAXLINE,fptr);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~
../pair_aeam.cpp:797:9: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
  797 |    fgets(line,MAXLINE,fptr);
      |    ~~~~~^~~~~~~~~~~~~~~~~~~
../pair_aeam.cpp: In member function ‘void LAMMPS_NS::PairAEAM::grab(FILE*, int, double*)’:
../pair_aeam.cpp:1070:10: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
 1070 |     fgets(line,MAXLINE,fptr);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
make[1]: *** [Makefile:114: pair_aeam.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/hossein/lammps-2Aug2023/src/Obj_mpi'
make: *** [Makefile:392: mpi] Error 2

Thank you for guiding me.
Regards

You must have copied some older version of the files that are not from the lammps-plugins repository. The whole point of that repository is to update files that are not part of LAMMPS and where the developers have stopped updating them, so that they can be compiled with a current version of LAMMPS.

Unfortunately, I did not understand your meaning correctly. I have copied the files Pair_aeam.cpp and pair_aeam.h in the src folder and recompiled. Please explain in more detail if possible

The files you have copied are different from the ones in the lammps-plugin repository. I can tell from the error messages you get. For example:

Your file has this code on line 681, the version in the repository has lammps-plugins/USER-AEAM/pair_aeam.cpp at 03600f1f14e68ec1615c8403dffaa47658e2c465 · lammps/lammps-plugins · GitHub :

      file->drho[i] = values.next_double();

There is nothing more to explain. The mistake is yours and must have been what I said it is. You cannot compile source code written for an old version of LAMMPS together with a current version of LAMMPS. There were internal changes (for the better) that broke compatibility.

Dear Axel
Thank you very much for your help. I followed your advice and it compiled correctly.

Regards