PLUMED compilation withe LAMMPS error

948 views
Skip to first unread message

Anna Lappala

unread,
Dec 2, 2013, 9:35:41 AM12/2/13
to plumed...@googlegroups.com
Dear PLUMED users/developers!


I have done the following to patch my lammps with plumed, and after I attempt to 

make package-USER-PLUMED
followed by
make openmpi

I get this error upon compilation:


lfftw   -lstdc++ -o ../lmp_openmpi
fix_plumed.o: In function `LAMMPS_NS::FixPlumed::post_force(int)':
fix_plumed.cpp:(.text+0x1b7): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x1d3): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x2d5): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x2fb): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x315): undefined reference to `plumed_cmd'
fix_plumed.o:fix_plumed.cpp:(.text+0x33b): more undefined references to `plumed_cmd' follow
fix_plumed.o: In function `LAMMPS_NS::FixPlumed::FixPlumed(LAMMPS_NS::LAMMPS*, int, char**)':
fix_plumed.cpp:(.text+0x82b): undefined reference to `plumed_create'
fix_plumed.cpp:(.text+0x84e): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x92a): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x944): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x95e): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0xb80): undefined reference to `plumed_cmd'
fix_plumed.o:fix_plumed.cpp:(.text+0xbad): more undefined references to `plumed_cmd' follow
fix_plumed.o: In function `PLMD::Plumed::~Plumed()':
fix_plumed.cpp:(.text._ZN4PLMD6PlumedD2Ev[_ZN4PLMD6PlumedD5Ev]+0x15): undefined reference to `plumed_finalize'
fix_plumed.o: In function `PLMD::Plumed::~Plumed()':
fix_plumed.cpp:(.text._ZN4PLMD6PlumedD0Ev[_ZN4PLMD6PlumedD0Ev]+0x16): undefined reference to `plumed_finalize'
collect2: error: ld returned 1 exit status
make[1]: *** [../lmp_openmpi] Error 1
make[1]: Leaving directory `/home/anna/Downloads/lammps-14Mar13/src/Obj_openmpi'
make: *** [openmpi] Error 2


Thank you in advanced for any input!

With best wishes,
Anna

davide branduardi

unread,
Dec 2, 2013, 9:47:33 AM12/2/13
to plumed...@googlegroups.com
Hi Anna!
It looks like the linking is not aware of plumed. Can you send also
what is before lfftw -lstdc++ ?
I guess that for some reason the compiler is not aware of plumed.
D
******************************************************
Davide Branduardi
davide.b...@gmail.com
Web:
https://sites.google.com/site/davidebranduardi
******************************************************
> --
> You received this message because you are subscribed to the Google Groups
> "PLUMED users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to plumed-users...@googlegroups.com.
> To post to this group, send email to plumed...@googlegroups.com.
> Visit this group at http://groups.google.com/group/plumed-users.
> For more options, visit https://groups.google.com/groups/opt_out.

Anna Lappala

unread,
Dec 2, 2013, 9:58:22 AM12/2/13
to plumed...@googlegroups.com
Dear Davide! Thank you for your reply!

Here it is:

mpic++ -O2 -funroll-loops -fstrict-aliasing -Wall -W -Wno-uninitialized -DLAMMPS_GZIP   -DFFT_FFTW -I/home/s0793217/localfft/include   -c velocity.cpp
velocity.cpp:343:6: warning: unused parameter ‘narg’ [-Wunused-parameter]
velocity.cpp:512:6: warning: unused parameter ‘narg’ [-Wunused-parameter]
velocity.cpp:551:6: warning: unused parameter ‘narg’ [-Wunused-parameter]
velocity.cpp:631:6: warning: unused parameter ‘narg’ [-Wunused-parameter]
mpic++ -O2 -funroll-loops -fstrict-aliasing -Wall -W -Wno-uninitialized -DLAMMPS_GZIP   -DFFT_FFTW -I/home/s0793217/localfft/include   -c verlet.cpp
mpic++ -O2 -funroll-loops -fstrict-aliasing -Wall -W -Wno-uninitialized -DLAMMPS_GZIP   -DFFT_FFTW -I/home/s0793217/localfft/include   -c write_restart.cpp
write_restart.cpp: In member function ‘void LAMMPS_NS::WriteRestart::command(int, char**)’:
write_restart.cpp:85:31: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
mpic++ -O   -L/home/s0793217/localfft/lib   angle.o atom.o atom_map.o atom_vec_atomic.o atom_vec_body.o atom_vec_charge.o atom_vec.o atom_vec_ellipsoid.o atom_vec_hybrid.o atom_vec_line.o atom_vec_sphere.o atom_vec_tri.o balance.o body.o bond.o bond_hybrid.o change_box.o comm.o compute_angle_local.o compute_atom_molecule.o compute_bond_local.o compute_centro_atom.o compute_cluster_atom.o compute_cna_atom.o compute_com.o compute_com_molecule.o compute_contact_atom.o compute_coord_atom.o compute.o compute_dihedral_local.o compute_displace_atom.o compute_erotate_sphere_atom.o compute_erotate_sphere.o compute_group_group.o compute_gyration.o compute_gyration_molecule.o compute_heat_flux.o compute_improper_local.o compute_inertia_molecule.o compute_ke_atom.o compute_ke.o compute_msd.o compute_msd_molecule.o compute_pair.o compute_pair_local.o compute_pe_atom.o compute_pe.o compute_pressure.o compute_property_atom.o compute_property_local.o compute_property_molecule.o compute_rdf.o compute_reduce.o compute_reduce_region.o compute_slice.o compute_stress_atom.o compute_temp_com.o compute_temp.o compute_temp_deform.o compute_temp_partial.o compute_temp_profile.o compute_temp_ramp.o compute_temp_region.o compute_temp_sphere.o compute_ti.o create_atoms.o create_box.o delete_atoms.o delete_bonds.o dihedral.o displace_atoms.o domain.o dump_atom.o dump_cfg.o dump.o dump_custom.o dump_dcd.o dump_image.o dump_local.o dump_xyz.o error.o finish.o fix_adapt.o fix_addforce.o fix_ave_atom.o fix_ave_correlate.o fix_aveforce.o fix_ave_histo.o fix_ave_spatial.o fix_ave_time.o fix_balance.o fix_box_relax.o fix.o fix_deform.o fix_deposit.o fix_drag.o fix_dt_reset.o fix_efield.o fix_enforce2d.o fix_evaporate.o fix_external.o fix_gravity.o fix_heat.o fix_indent.o fix_langevin.o fix_lineforce.o fix_minimize.o fix_momentum.o fix_move.o fix_nh.o fix_nh_sphere.o fix_nph.o fix_nph_sphere.o fix_npt.o fix_npt_sphere.o fix_nve.o fix_nve_limit.o fix_nve_noforce.o fix_nve_sphere.o fix_nvt.o fix_nvt_sllod.o fix_nvt_sphere.o fix_orient_fcc.o fix_planeforce.o fix_plumed.o fix_press_berendsen.o fix_print.o fix_read_restart.o fix_recenter.o fix_respa.o fix_restrain.o fix_setforce.o fix_shake.o fix_shear_history.o fix_spring.o fix_spring_rg.o fix_spring_self.o fix_store_force.o fix_store_state.o fix_temp_berendsen.o fix_temp_rescale.o fix_thermal_conductivity.o fix_tmd.o fix_ttm.o fix_viscosity.o fix_viscous.o fix_wall.o fix_wall_harmonic.o fix_wall_lj126.o fix_wall_lj93.o fix_wall_reflect.o fix_wall_region.o force.o group.o image.o improper.o input.o integrate.o irregular.o kspace.o lammps.o lattice.o library.o main.o math_extra.o memory.o min_cg.o min.o min_fire.o min_hftn.o minimize.o min_linesearch.o min_quickmin.o min_sd.o modify.o neigh_bond.o neighbor.o neigh_derive.o neigh_full.o neigh_gran.o neigh_half_bin.o neigh_half_multi.o neigh_half_nsq.o neigh_list.o neigh_request.o neigh_respa.o neigh_stencil.o output.o pair_beck.o pair_born_coul_wolf.o pair_born.o pair_buck_coul_cut.o pair_buck.o pair_coul_cut.o pair_coul_debye.o pair_coul_dsf.o pair_coul_wolf.o pair.o pair_dpd.o pair_dpd_tstat.o pair_gauss.o pair_hybrid.o pair_hybrid_overlay.o pair_lj96_cut.o pair_lj_cubic.o pair_lj_cut_coul_cut.o pair_lj_cut_coul_debye.o pair_lj_cut_coul_dsf.o pair_lj_cut.o pair_lj_expand.o pair_lj_gromacs_coul_gromacs.o pair_lj_gromacs.o pair_lj_smooth.o pair_lj_smooth_linear.o pair_mie_cut.o pair_morse.o pair_soft.o pair_table.o pair_yukawa.o procmap.o random_mars.o random_park.o read_data.o read_dump.o reader.o reader_native.o reader_xyz.o read_restart.o region_block.o region_cone.o region.o region_cylinder.o region_intersect.o region_plane.o region_prism.o region_sphere.o region_union.o replicate.o rerun.o respa.o run.o set.o special.o thermo.o timer.o universe.o update.o variable.o velocity.o verlet.o write_restart.o     -lfftw   -lstdc++ -o ../lmp_openmpi
fix_plumed.o: In function `LAMMPS_NS::FixPlumed::post_force(int)':
fix_plumed.cpp:(.text+0x1b7): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x1d3): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x2d5): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x2fb): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x315): undefined reference to `plumed_cmd'
fix_plumed.o:fix_plumed.cpp:(.text+0x33b): more undefined references to `plumed_cmd' follow
fix_plumed.o: In function `LAMMPS_NS::FixPlumed::FixPlumed(LAMMPS_NS::LAMMPS*, int, char**)':
fix_plumed.cpp:(.text+0x82b): undefined reference to `plumed_create'
fix_plumed.cpp:(.text+0x84e): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x92a): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x944): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x95e): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0xb80): undefined reference to `plumed_cmd'
fix_plumed.o:fix_plumed.cpp:(.text+0xbad): more undefined references to `plumed_cmd' follow
fix_plumed.o: In function `PLMD::Plumed::~Plumed()':
fix_plumed.cpp:(.text._ZN4PLMD6PlumedD2Ev[_ZN4PLMD6PlumedD5Ev]+0x15): undefined reference to `plumed_finalize'
fix_plumed.o: In function `PLMD::Plumed::~Plumed()':
fix_plumed.cpp:(.text._ZN4PLMD6PlumedD0Ev[_ZN4PLMD6PlumedD0Ev]+0x16): undefined reference to `plumed_finalize'
collect2: error: ld returned 1 exit status
make[1]: *** [../lmp_openmpi] Error 1
make[1]: Leaving directory `/home/anna/Downloads/lammps-14Mar13/src/Obj_openmpi'
make: *** [openmpi] Error 2


Sangyun Lee

unread,
Jan 31, 2014, 3:22:44 PM1/31/14
to plumed...@googlegroups.com
Dear Anna,

I met the same problem as you.
Could you tell me whether you solved this problem?

With best wishes,
Sangyun

Sangyun Lee

unread,
Jan 31, 2014, 3:25:52 PM1/31/14
to plumed...@googlegroups.com
Dear Anna,

I have the same problem as you, when compling LAMMPS+PLUMED.

Could you tell me whether you solved this problem?

With best wishes,
Sangyun

Paolo Raiteri

unread,
Feb 3, 2014, 8:21:37 AM2/3/14
to plumed...@googlegroups.com
Guys,

as Davide said, it seems that all the plumed files are missing.
I guess plumed compiled successfully and there were also no errors during the patching of lammps?
You can test that plumed2 works by running a command like this:

Paolos-iMac:~> plumed help
Usage: plumed [options] [command] [command options]
  plumed [command] -h|--help: to print help for a specific command
Options:
  [help|-h|--help]          : to print this help
  [--has-mpi]               : fails if plumed is running without MPI
  [--has-matheval]          : fails if plumed is compiled without matheval
  [--has-almost]            : fails if plumed is compiled without almost
  [--has-dlopen]            : fails if plumed is compiled without dlopen
  [--load LIB]              : loads a shared object (typically a plugin library)
  [--standalone-executable] : tells plumed not to look for commands implemented as scripts
Commands:
  plumed driver : analyze trajectories with plumed
  plumed driver-float : analyze trajectories with plumed (single precision version)
  plumed gentemplate : print out a template input for a particular action
  plumed info : provide informations about plumed
  plumed manual : print out a description of the keywords for an action in html
  plumed simplemd : run lj code
  plumed sum_hills : sum the hills with  plumed
  plumed mklib : compile a .cpp file into a shared library
  plumed newcv : create a new collective variable from a template
  plumed patch : patch an MD engine

If plumed doesn't work you may not have copied the three lines in the file sourceme.sh in your .profile or .bashrc file

Also in the lammps root directory you should have three valid links:

Paolos-iMac:lammps> pwd
/Users/paolo/Programs/lammps
Paolos-iMac:~>ls -ltr
lrwxr-xr-x     1 paolo  staff    57B Oct 11 13:07 Plumed.cmake -> /Users/paolo/Programs/plumed2/src/lib/Plumed.cmake.static
lrwxr-xr-x     1 paolo  staff    50B Oct 11 13:07 Plumed.h -> /Users/paolo/Programs/plumed2/src/wrapper/Plumed.h
lrwxr-xr-x     1 paolo  staff    55B Oct 11 13:07 Plumed.inc -> /Users/paolo/Programs/plumed2/src/lib/Plumed.inc.static
drwxr-xr-x  1184 paolo  staff    39K Nov 21 09:13 src
...

It those three links are not pointing to valid files, than you're probably better off restarting from scratch the patching procedure.
I'm not using a super recent version of lammps, maybe it's 6 months old, but I don't think it should make a huge difference.

Tomorrow, I may try patching the latest version, just to make sure the patch still works ok.

Cheers,
Paolo

merc...@gmail.com

unread,
Aug 30, 2018, 7:30:13 AM8/30/18
to PLUMED users
Dear Plumed developers/users,

Writing in continuation to this discussion because I have thought that this is seems to be same problem I am having but no solution was provided here in the end. 
I am trying to compile and install LAMMPS after patching it with PLUMED. 
I firstly clone LAMMPS with: 

git clone -b stable https://github.com/lammps/lammps.git lammps

I then patch the code successfully using:
plumed patch --static -p

and select the patch "lammps-6Apr13". 
The patching is successful and the three links point to existing files: 

lrwxrwxrwx  1 dmlocal dmlocal   83 Aug 30 12:50 Plumed.h -> /local/home/dmlocal/programs/compiled/plumed_2.3_cc/include/plumed/wrapper/Plumed.h
lrwxrwxrwx  1 dmlocal dmlocal   88 Aug 30 12:50 Plumed.inc -> /local/home/dmlocal/programs/compiled/plumed_2.3_cc/lib/plumed/src/lib/Plumed.inc.static
lrwxrwxrwx  1 dmlocal dmlocal   90 Aug 30 12:50 Plumed.cmake -> /local/home/dmlocal/programs/compiled/plumed_2.3_cc/lib/plumed/src/lib/Plumed.cmake.static

I then enter the /src directory of LAMMPS to make the USER-PLUMED program with: "make yes-USER-PLUMED". The installation is successful and I end up with the files 

Makefile.package
Makefile.package.settings
fix_plumed.h
fix_plumed.cpp

I then configure LAMMPS with the following command (using cmake): 

cmake -C ../cmake/presets/std_nolib.cmake -D PKG_GPU=on -DBUILD_DOC=ON -DBUILD_OMP=ON -DCMAKE_C_COMPILER=/usr/bin/gcc-7 -DGPU_ARCH=sm_60 -DGPU_API=cuda -DBUILD_MPI=OFF -DCMAKE_CXX_COMPILER=/usr/bin/g++-7 -DCMAKE_INSTALL_PREFIX=/local/home/dmlocal/programs/compiled/lammps -D BUILD_SHARED_LIBS=OFF ../cmake

The compilation runs successfully but when it's time to link the executable I end up with this: exactly what Anna experienced. 
....
[100%] Building CXX object CMakeFiles/lmp.dir/local/home/dmlocal/programs/source/lammps/src/GPU/pair_born_coul_wolf_cs_gpu.cpp.o
[100%] Building CXX object CMakeFiles/lmp.dir/local/home/dmlocal/programs/source/lammps/src/GPU/pair_born_coul_long_cs_gpu.cpp.o
[100%] Building CXX object CMakeFiles/lmp.dir/local/home/dmlocal/programs/source/lammps/src/GPU/pair_coul_long_cs_gpu.cpp.o
[100%] Linking CXX executable lmp
CMakeFiles/lmp.dir/local/home/dmlocal/programs/source/lammps/src/fix_plumed.cpp.o: In function `LAMMPS_NS::FixPlumed::post_force(int)':
fix_plumed.cpp:(.text+0x26a): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x292): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x2ae): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x2d6): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x2f4): undefined reference to `plumed_cmd'
CMakeFiles/lmp.dir/local/home/dmlocal/programs/source/lammps/src/fix_plumed.cpp.o:fix_plumed.cpp:(.text+0x323): more undefined references to `plumed_cmd' follow
CMakeFiles/lmp.dir/local/home/dmlocal/programs/source/lammps/src/fix_plumed.cpp.o: In function `LAMMPS_NS::FixPlumed::~FixPlumed()':
fix_plumed.cpp:(.text+0xc95): undefined reference to `plumed_finalize'
CMakeFiles/lmp.dir/local/home/dmlocal/programs/source/lammps/src/fix_plumed.cpp.o: In function `LAMMPS_NS::FixPlumed::~FixPlumed()':
fix_plumed.cpp:(.text+0xe75): undefined reference to `plumed_finalize'
CMakeFiles/lmp.dir/local/home/dmlocal/programs/source/lammps/src/fix_plumed.cpp.o: In function `LAMMPS_NS::FixPlumed::FixPlumed(LAMMPS_NS::LAMMPS*, int, char**)':
fix_plumed.cpp:(.text+0xf40): undefined reference to `plumed_create'
fix_plumed.cpp:(.text+0xf7a): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x1001): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x101d): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x1039): undefined reference to `plumed_cmd'
fix_plumed.cpp:(.text+0x113c): undefined reference to `plumed_cmd'
CMakeFiles/lmp.dir/local/home/dmlocal/programs/source/lammps/src/fix_plumed.cpp.o:fix_plumed.cpp:(.text+0x116a): more undefined references to `plumed_cmd' follow
CMakeFiles/lmp.dir/local/home/dmlocal/programs/source/lammps/src/fix_plumed.cpp.o: In function `PLMD::Plumed::~Plumed()':
fix_plumed.cpp:(.text._ZN4PLMD6PlumedD2Ev[_ZN4PLMD6PlumedD5Ev]+0x1d): undefined reference to `plumed_finalize'
CMakeFiles/lmp.dir/local/home/dmlocal/programs/source/lammps/src/fix_plumed.cpp.o: In function `PLMD::Plumed::~Plumed()':
fix_plumed.cpp:(.text._ZN4PLMD6PlumedD0Ev[_ZN4PLMD6PlumedD5Ev]+0x2d): undefined reference to `plumed_finalize'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/lmp.dir/build.make:10054: lmp] Error 1
make[1]: *** [CMakeFiles/Makefile2:179: CMakeFiles/lmp.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
...

I have tried compiling both static and dynamic, and with different compilers (always matching between PLUMED and LAMMPS compilations). At this stage I don't really understand what can it be. The same PLUMED executable successfully works patching gromacs. I have also tried to install LAMMPS version from the 02.04.13 seeing a patch dating back to the 06.04.13, but without success. 
Could you please help me solving this issue? I am not really sure what is going wrong. 

Thank you in advance for your time. 

Cheers,
Davide
Reply all
Reply to author
Forward
0 new messages