LAMMPS version: LAMMPS (2 Aug 2023 - Update 2)
Hi all,
I want to do umbrella sampling with LAMMPS and PLUMED. I installed LAMMPS (version included in the message) with PLUMED package.
Installed packages:
H5MD KSPACE MANYBODY MOLECULE PLUMED RIGID
I am getting this error:
Error: ERROR: Incompatible API version for PLUMED in fix plumed. Only Plumed 2.4.x, 2.5.x, 2.6.x, 2.7.x, 2.8.x are tested and supported. (src/src/PLUMED/fix_plumed.cpp:81)
I have tried this with PLUMED 2.6.6, PLUMED 2.7.4 and PLUMED 2.8.4.
All of the three give me the same error. Could some please shed some light on this?
Thank you.
If you have already a properly installed plumed 2.8.x, you need to tell LAMMPS to not download and compile it’s own version.
Also try updating to a more recent version of LAMMPS which should include compatibility with plumed 2.9.x
I do have an installed version of PLUMED 2.8.x.
However, I am using spack to install LAMMPS. I install it with
spack install lammps+plumed+h5md+manybody
If I run spack edit lammps
, then I see:
if "+user-plumed" in spec or "+plumed" in spec:
args.append(self.define("DOWNLOAD_PLUMED", False))
if "+shared" in self.spec["plumed"]:
args.append(self.define("PLUMED_MODE", "shared"))
It looks like, with I use +plumed
, DOWNLOAD_PLUMED
is by default set to no
.
Spack is not directly supported by the LAMMPS developers so if that does not work as expected, you have to consult with the people that do the spack packaging.
You need either LAMMPS version 2 Aug 2023 - Update4 (not yet released) or LAMMPS version 27 June2024 for support of version 2.9.x.
If you want to use a local plumed2 installation, it has to be found with pkgconf or pkg-config and then it will be automatically integrated. At least that is what I see when compiling LAMMPS with CMake.
I see. That makes sense. I, now, tried to install LAMMPS from source and I get the error:
[100%] Linking CXX executable lmp
/usr/bin/ld: plumed_build-prefix/lib/libplumed.a(kernel.o): in function `std::vector<double, std::allocator<double> >::operator=(std::vector<double, std::allocator<double> > const&) [clone .isra.0]':
ClusterAnalysisBase.cpp:(.text+0x6d71): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: plumed_build-prefix/lib/libplumed.a(kernel.o): in function `std::vector<unsigned int, std::allocator<unsigned int> >::operator=(std::vector<unsigned int, std::allocator<unsigned int> > const&) [clone .isra.0]':
ClusterAnalysisBase.cpp:(.text+0x6f71): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: plumed_build-prefix/lib/libplumed.a(kernel.o): in function `PLMD::adjmat::ClusterAnalysisBase::getNodePropertyDerivatives(unsigned int const&, PLMD::MultiValue&) const':
(.text+0x75f5): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: plumed_build-prefix/lib/libplumed.a(kernel.o): in function `PLMD::adjmat::SMACMatrix::readOrientationConnector(unsigned int const&, unsigned int const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)':
(.text+0x191a6): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: (.text+0x191b6): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: plumed_build-prefix/lib/libplumed.a(kernel.o):(.text+0x191c6): more undefined references to `std::__throw_bad_array_new_length()' follow
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/lmp.dir/build.make:112: lmp] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:205: CMakeFiles/lmp.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
I run the following commands:
rm -r build; mkdir build
cd build
spack unload --all
spack load /lneghc5 # [email protected]
spack load /jjak3m4 # [email protected]
spack load /du2i3iz
spack load /dofbtkg
spack load /buybdha
spack load /b74lmhc
spack load /5adixt7
spack load /7kcqcor
cmake ../cmake -D PKG_PLUMED=yes -D DOWNLOAD_PLUMED=yes -D PKG_EXTRA-FIX=yes -D PKG_MOLECULE=yes -D PKG_H5MD=yes -D PKG_EXTRA-PAIR=yes -D PKG_MANYBODY=yes -D PKG_DPD-BASIC=yes -D PKG_KSAPCE=yes
cmake ../cmake # use N cores
cmake --build . -j 24
When using this, I do not use my installed version of PLUMED, I would very happily let LAMMPS compile its own version of PLUMED.
I cannot reproduce this. What platform are you on? What compiler do you use.
On my Fedora 40 machine with gcc 14.2 this compiles and links just fine.
Making fix plumed compatible with an external version 2.9.x you need the following change to the LAMMPS source:
diff --git a/src/PLUMED/fix_plumed.cpp b/src/PLUMED/fix_plumed.cpp
index f06d5474f6..4948187615 100644
--- a/src/PLUMED/fix_plumed.cpp
+++ b/src/PLUMED/fix_plumed.cpp
@@ -77,9 +77,9 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) :
int api_version=0;
p->cmd("getApiVersion",&api_version);
- if ((api_version < 5) || (api_version > 9))
+ if ((api_version < 5) || (api_version > 10))
error->all(FLERR,"Incompatible API version for PLUMED in fix plumed. "
- "Only Plumed 2.4.x, 2.5.x, 2.6.x, 2.7.x, 2.8.x are tested and supported.");
+ "Only Plumed 2.4.x, 2.5.x, 2.6.x, 2.7.x, 2.8.x, 2.9.x are tested and supported.");
#if !defined(MPI_STUBS)
// If the -partition option is activated then enable
Or you can just download: https://github.com/lammps/lammps/archive/refs/heads/maintenance.tar.gz
Or use:
git clone -b maintenance --depth=1 GitHub - lammps/lammps: Public development project of the LAMMPS MD software package lammps-maintenance
Hi Alex,
Thank you so very much for trying. I was using gcc 10.5. I switched to gcc 12.3 and it works now.
I am fine with PLUMED 2.8. But thanks a lot of sharing the necessary resources!
However, I after asking LAMMPS to download and link PLUMED, I still get the same error:
ERROR: Incompatible API version for PLUMED in fix plumed. Only Plumed 2.4.x, 2.5.x, 2.6.x, 2.7.x, 2.8.x are tested and supported. (src/src/PLUMED/fix_plumed.cpp:81)
LAMMPS installs PLUMED 2.8.2
[src]$ pwd
~/softwares/lammps-2Aug2023/build/plumed_build-prefix/src
[ src]$ ls
plumed_build plumed_build-build plumed_build-stamp plumed-src-2.8.2.tgz
That is impossible. There is some detail missing where something goes wrong.
I tried with the 2Aug2023 version and with the latest maintenance tree and I tried with internal and external plumed and do not get this error.
Hi Alex,
Yes it does work. I had so many versions of LAMMPS installed yesterday that I got confused. If I use the LAMMPS 2Aug2023 update 3 version and let LAMMPS download it’s own PLUMED it works perfectly.
Thank you so much for looking at this so closely.