[lammps-users] question of compilation LAMMPS w/h MEAM library

Dear all,

Last week, I questioned how to compile LAMMPS w/h MEAM library, and thank Axel and Steve.
So I tried to compile following as Steve’s steps. But it failed.
Here is my new makefile.

nano = Test compiler, MPICH, FFTW, MEAM lib

SHELL = /bin/sh
#.IGNORE:

System-specific settings

CC = mpiCC
CCFLAGS = -I/usr/mpi/pgi/mvapich-1.0.0/include
-I~/local/include
-DFFT_FFTW -DLAMMPS_GZIP
DEPFLAGS = -M
LINK = mpiCC
LINKFLAGS = -L/usr/mpi/pgi/mvapich-1.0.0/lib
-L/lib
-L…/…/…/lib/meam
-L/opt/pgi/linux86/7.1-2/lib
USRLIB = -lfftw -lmpich -lmeam -lpgf90 -lpgf90_rpm1
-lpgf902 -lpgf90rtl -lpgftnrtl
SYSLIB =
ARCHIVE = ar
ARFLAGS = -rc
SIZE = size

Link target

Dear all,

Last week, I questioned how to compile LAMMPS w/h MEAM library, and thank
Axel and Steve.
So I tried to compile following as Steve's steps. But it failed.

Here is my new makefile.

# nano = Test compiler, MPICH, FFTW, MEAM lib

SHELL = /bin/sh
#.IGNORE:

# System-specific settings

CC = mpiCC
CCFLAGS = -I/usr/mpi/pgi/mvapich-1.0.0/include \
                -I~/local/include \
                -DFFT_FFTW -DLAMMPS_GZIP
DEPFLAGS = -M
LINK = mpiCC
LINKFLAGS = -L/usr/mpi/pgi/mvapich-1.0.0/lib \
                -L/lib \
                -L../../../lib/meam \

this has to be -L../../lib/meam

please see the examples provided in the MAKE directory.

                -L/opt/pgi/linux86/7.1-2/lib
USRLIB = -lfftw -lmpich -lmeam -lpgf90 -lpgf90_rpm1 \
                -lpgf902 -lpgf90rtl -lpgftnrtl
SYSLIB =
ARCHIVE = ar
ARFLAGS = -rc
SIZE = size

# Link target
--------------------------------------------------------------------------------------------------------------------------------------------------------

Error message is following:

/usr/bin/ld: cannot find -lmeam

no surprise here.

collect2: ld returned 1 exit status
make[1]: *** [../lmp_nano] error 1
make[1]: Leaving directory
`/net/jj/ph/u1/hsc081000/lammps-9Sep08/src/Obj_nano'
make: *** [nano] error 2

I definitely build MEAM lib in lib/meam and typed make yes-meam in src
directory and double checked it before building LAMMPS.
Now I don't know how to deal with that error.

just follow what the error message says.
it cannot find the library, so you may
have given the wrong location or it is not build.
since you are certain you built it, it must be
the location (as specified by the -L flag).

cheers,
   axel.

Dear Axel,

Thank you for reply.
I corrected the path and compiled it again. But there are lots of error messages as followed.

make[1]: Entering directory /net/jj/ph/u1/hsc081000/lammps-9Sep08/src/Obj_nano' mpiCC -g -O -L/usr/mpi/pgi/mvapich-1.0.0/lib -L../../lib/meam -L/opt/pgi/linux86/7.1-2/lib atom.o atom_vec.o atom_vec_atomic.o atom_vec_charge.o atom_vec_hybrid.o change_box.o comm.o compute.o compute_centro_atom.o compute_coord_atom.o compute_displace_atom.o compute_erotate_sphere.o compute_group_group.o compute_ke.o compute_ke_atom.o compute_pe.o compute_pe_atom.o compute_pressure.o compute_reduce.o compute_stress_atom.o compute_temp.o compute_temp_com.o compute_temp_deform.o compute_temp_partial.o compute_temp_ramp.o compute_temp_region.o compute_temp_sphere.o create_atoms.o create_box.o delete_atoms.o delete_bonds.o displace_atoms.o displace_box.o domain.o dump.o dump_atom.o dump_custom.o dump_dcd.o dump_xyz.o error.o finish.o fix.o fix_add_force.o fix_ave_atom.o fix_ave_force.o fix_ave_spatial.o fix_ave_time.o fix_com.o fix_coord_original.o fix_deform.o fix_deposit.o fix_drag.o fix_dt_reset.o fix_efield.o fix_enforce2d.o fix_gravity.o fix_gyration.o fix_heat.o fix_indent.o fix_langevin.o fix_line_force.o fix_minimize.o fix_momentum.o fix_msd.o fix_nph.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_plane_force.o fix_press_berendsen.o fix_print.o fix_rdf.o fix_recenter.o fix_respa.o fix_rigid.o fix_set_force.o fix_shake.o fix_shear_history.o fix_spring.o fix_spring_rg.o fix_spring_self.o fix_temp_berendsen.o fix_temp_rescale.o fix_thermal_conductivity.o fix_tmd.o fix_viscosity.o fix_viscous.o fix_wall_lj126.o fix_wall_lj93.o fix_wall_reflect.o fix_wiggle.o force.o group.o input.o integrate.o kspace.o lammps.o lattice.o library.o main.o memory.o min.o min_cg.o min_sd.o minimize.o modify.o neigh_bond.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 neighbor.o output.o pack.o pair.o pair_buck.o pair_buck_coul_cut.o pair_coul_cut.o pair_coul_debye.o pair_hybrid.o pair_hybrid_overlay.o pair_lj_cut.o pair_lj_cut_coul_cut.o pair_lj_cut_coul_debye.o pair_lj_expand.o pair_lj_gromacs.o pair_lj_gromacs_coul_gromacs.o pair_lj_smooth.o pair_meam.o pair_morse.o pair_soft.o pair_table.o pair_yukawa.o random_mars.o random_park.o read_data.o read_restart.o region.o region_block.o region_cylinder.o region_intersect.o region_prism.o region_sphere.o region_union.o replicate.o respa.o run.o set.o shell.o special.o temper.o thermo.o timer.o universe.o update.o variable.o velocity.o verlet.o write_restart.o -lfftw -lmpich -lmeam -lgfortran -lpthread -o ../lmp_nano ../../lib/meam/libmeam.a(meam_setup_done.o): In function alloyparams_’:
meam_setup_done.F:(.text+0x3e7): undefined reference to ftn_str_copy' ../../lib/meam/libmeam.a(meam_setup_done.o): In function compute_pair_meam_’:
meam_setup_done.F:(.text+0x7a9): undefined reference to pgf90_alloc' meam_setup_done.F:(.text+0x88b): undefined reference to pgf90_alloc’
meam_setup_done.F:(.text+0x96d): undefined reference to pgf90_alloc' meam_setup_done.F:(.text+0xa4f): undefined reference to pgf90_alloc’
meam_setup_done.F:(.text+0xb31): undefined reference to pgf90_alloc' ../../lib/meam/libmeam.a(meam_setup_done.o):meam_setup_done.F:(.text+0xc13): more undefined references to pgf90_alloc’ follow
…/…/lib/meam/libmeam.a(meam_setup_done.o): In function compute_pair_meam_': meam_setup_done.F:(.text+0xeba): undefined reference to pgf90io_src_info’
meam_setup_done.F:(.text+0xed2): undefined reference to pgf90io_ldw_init' meam_setup_done.F:(.text+0xef3): undefined reference to pgf90io_ldw’
meam_setup_done.F:(.text+0xefa): undefined reference to pgf90io_ldw_end' meam_setup_done.F:(.text+0xf10): undefined reference to pgf90io_src_info’
meam_setup_done.F:(.text+0xf28): undefined reference to pgf90io_ldw_init' meam_setup_done.F:(.text+0xf49): undefined reference to pgf90io_ldw’
meam_setup_done.F:(.text+0xf50): undefined reference to pgf90io_ldw_end' meam_setup_done.F:(.text+0xfe8): undefined reference to mth_i_dpowi’
meam_setup_done.F:(.text+0x1032): undefined reference to __mth_i_dpowi' ../../lib/meam/libmeam.a(meam_setup_done.o): In function phi_meam
’:
meam_setup_done.F:(.text+0x12ba): undefined reference to ftn_strcmp' meam_setup_done.F:(.text+0x143e): undefined reference to ftn_strcmp’
meam_setup_done.F:(.text+0x147a): undefined reference to ftn_str_copy' meam_setup_done.F:(.text+0x1495): undefined reference to ftn_strcmp’
meam_setup_done.F:(.text+0x18ec): undefined reference to __fmth_i_dlog' meam_setup_done.F:(.text+0x1946): undefined reference to fmth_i_dlog’
meam_setup_done.F:(.text+0x19dd): undefined reference to ftn_strcmp' meam_setup_done.F:(.text+0x1a19): undefined reference to ftn_str_copy’
meam_setup_done.F:(.text+0x1a34): undefined reference to ftn_strcmp' ../../lib/meam/libmeam.a(meam_setup_done.o): In function get_shpfcn
’:
meam_setup_done.F:(.text+0x1b49): undefined reference to ftn_strcmp' meam_setup_done.F:(.text+0x1b64): undefined reference to ftn_strcmp’
meam_setup_done.F:(.text+0x1b7f): undefined reference to ftn_strcmp' meam_setup_done.F:(.text+0x1bbe): undefined reference to ftn_strcmp’
…/…/lib/meam/libmeam.a(meam_setup_done.o):meam_setup_done.F:(.text+0x1c03): more undefined references to ftn_strcmp' follow ../../lib/meam/libmeam.a(meam_setup_done.o): In function get_zij2
’:
meam_setup_done.F:(.text+0x20f2): undefined reference to __mth_i_dpowi' ../../lib/meam/libmeam.a(meam_setup_done.o): In function get_densref
’:
meam_setup_done.F:(.text+0x21d6): undefined reference to __fmth_i_dexp' meam_setup_done.F:(.text+0x220f): undefined reference to __fmth_i_dexp’
meam_setup_done.F:(.text+0x2248): undefined reference to __fmth_i_dexp' meam_setup_done.F:(.text+0x2281): undefined reference to __fmth_i_dexp’
meam_setup_done.F:(.text+0x22b8): undefined reference to __fmth_i_dexp' ../../lib/meam/libmeam.a(meam_setup_done.o):meam_setup_done.F:(.text+0x22f0): more undefined references to _fmth_i_dexp’ follow
…/…/lib/meam/libmeam.a(meam_setup_done.o): In function get_densref_': meam_setup_done.F:(.text+0x239e): undefined reference to ftn_str_copy’
meam_setup_done.F:(.text+0x2406): undefined reference to ftn_strcmp' meam_setup_done.F:(.text+0x244f): undefined reference to ftn_strcmp’
meam_setup_done.F:(.text+0x2498): undefined reference to ftn_strcmp' meam_setup_done.F:(.text+0x24e1): undefined reference to ftn_strcmp’
meam_setup_done.F:(.text+0x2567): undefined reference to ftn_strcmp' ../../lib/meam/libmeam.a(meam_setup_done.o):meam_setup_done.F:(.text+0x25ea): more undefined references to ftn_strcmp’ follow
…/…/lib/meam/libmeam.a(meam_setup_done.o): In function get_densref_': meam_setup_done.F:(.text+0x2849): undefined reference to fmth_i_dexp’
meam_setup_done.F:(.text+0x287e): undefined reference to __fmth_i_dexp' ../../lib/meam/libmeam.a(meam_setup_done.o): In function zbl
’:
meam_setup_done.F:(.text+0x2910): undefined reference to __fmth_i_rpowr' meam_setup_done.F:(.text+0x292b): undefined reference to fmth_i_rpowr’
meam_setup_done.F:(.text+0x2982): undefined reference to __fmth_i_dexp' ../../lib/meam/libmeam.a(meam_setup_done.o): In function erose
’:
meam_setup_done.F:(.text+0x2a51): undefined reference to __fmth_i_dexp' ../../lib/meam/libmeam.a(meam_setup_done.o): In function interpolate_meam
’:
meam_setup_done.F:(.text+0x2b30): undefined reference to __c_mcopy8' ../../lib/meam/libmeam.a(meam_setup_done.o): In function .C12_407’:
meam_setup_done.F:(.data+0x2a8): undefined reference to pgf90_compiled' ../../lib/meam/libmeam.a(meam_setup_global.o): In function meam_setup_global
’:
meam_setup_global.F:(.text+0x23c): undefined reference to ftn_strcmp' meam_setup_global.F:(.text+0x27d): undefined reference to ftn_strcmp’
meam_setup_global.F:(.text+0x2c6): undefined reference to ftn_strcmp' meam_setup_global.F:(.text+0x2fa): undefined reference to ftn_strcmp’
meam_setup_global.F:(.text+0x32c): undefined reference to ftn_strcmp' ../../lib/meam/libmeam.a(meam_setup_global.o): In function .C1_428’:
meam_setup_global.F:(.data+0x68): undefined reference to pgf90_compiled' ../../lib/meam/libmeam.a(meam_setup_param.o): In function .C1_413’:
meam_setup_param.F:(.data+0x50): undefined reference to pgf90_compiled' ../../lib/meam/libmeam.a(meam_dens_init.o): In function calc_rho1
’:
meam_dens_init.F:(.text+0x9c3): undefined reference to __fmth_i_dexp' meam_dens_init.F:(.text+0xa00): undefined reference to __fmth_i_dexp’
meam_dens_init.F:(.text+0xa3d): undefined reference to __fmth_i_dexp' meam_dens_init.F:(.text+0xa7a): undefined reference to __fmth_i_dexp’
meam_dens_init.F:(.text+0xab6): undefined reference to __fmth_i_dexp' ../../lib/meam/libmeam.a(meam_dens_init.o):meam_dens_init.F:(.text+0xaf5): more undefined references to __fmth_i_dexp’ follow
…/…/lib/meam/libmeam.a(meam_dens_init.o): In function .C9_307': meam_dens_init.F:(.data+0xa0): undefined reference to pgf90_compiled’
…/…/lib/meam/libmeam.a(meam_dens_final.o): In function meam_dens_final_': meam_dens_final.F:(.text+0x5d5): undefined reference to __fmth_i_dlog’
meam_dens_final.F:(.text+0x60b): undefined reference to __fmth_i_dlog' meam_dens_final.F:(.text+0x638): undefined reference to __fmth_i_dlog’
…/…/lib/meam/libmeam.a(meam_dens_final.o): In function g_gam_': meam_dens_final.F:(.text+0x735): undefined reference to __fmth_i_dpowd’
meam_dens_final.F:(.text+0x792): undefined reference to __fmth_i_dexp' meam_dens_final.F:(.text+0x7b6): undefined reference to __fmth_i_dexp’
…/…/lib/meam/libmeam.a(meam_dens_final.o): In function dg_gam_': meam_dens_final.F:(.text+0x85b): undefined reference to __fmth_i_dpowd’
meam_dens_final.F:(.text+0x902): undefined reference to __fmth_i_dexp' meam_dens_final.F:(.text+0x93e): undefined reference to __fmth_i_dexp’
…/…/lib/meam/libmeam.a(meam_dens_final.o): In function .C3_294': meam_dens_final.F:(.data+0x60): undefined reference to pgf90_compiled’
…/…/lib/meam/libmeam.a(meam_force.o): In function meam_force_': meam_force.F:(.text+0x492): undefined reference to __fmth_i_dexp’
meam_force.F:(.text+0x4fa): undefined reference to __fmth_i_dexp' meam_force.F:(.text+0x55b): undefined reference to __fmth_i_dexp’
meam_force.F:(.text+0x5bc): undefined reference to __fmth_i_dexp' meam_force.F:(.text+0x66b): undefined reference to _fmth_i_dexp’
…/…/lib/meam/libmeam.a(meam_force.o):meam_force.F:(.text+0x6cf): more undefined references to __fmth_i_dexp' follow ../../lib/meam/libmeam.a(meam_force.o): In function .C1_570’:
meam_force.F:(.data+0x68): undefined reference to pgf90_compiled' ../../lib/meam/libmeam.a(meam_cleanup.o): In function meam_cleanup
’:
meam_cleanup.F:(.text+0x16): undefined reference to pgf90_dealloc' meam_cleanup.F:(.text+0x3d): undefined reference to pgf90_dealloc’
meam_cleanup.F:(.text+0x64): undefined reference to pgf90_dealloc' meam_cleanup.F:(.text+0x8b): undefined reference to pgf90_dealloc’
meam_cleanup.F:(.text+0xb2): undefined reference to pgf90_dealloc' ../../lib/meam/libmeam.a(meam_cleanup.o):meam_cleanup.F:(.text+0xd9): more undefined references to pgf90_dealloc’ follow
…/…/lib/meam/libmeam.a(meam_cleanup.o):(.data+0x0): undefined reference to pgf90_compiled' ../../lib/meam/libmeam.a(meam_data.o):(.data+0x0): undefined reference to pgf90_compiled’
collect2: ld returned 1 exit status
make[1]: *** […/lmp_nano] error 1
make[1]: Leaving directory `/net/jj/ph/u1/hsc081000/lammps-9Sep08/src/Obj_nano’
make: *** [nano] error 2

What are those errors? Do I have to fix some files in meam library?
Thank you.

HeeSung

Dear Axel,

Thank you for reply.
I corrected the path and compiled it again. But there are lots of error
messages as followed.

make[1]: Entering directory
`/net/jj/ph/u1/hsc081000/lammps-9Sep08/src/Obj_nano'
mpiCC -g -O -L/usr/mpi/pgi/mvapich-1.0.0/lib -L../../lib/meam
-L/opt/pgi/linux86/7.1-2/lib atom.o atom_vec.o atom_vec_atomic.o
atom_vec_charge.o atom_vec_hybrid.o change_box.o comm.o compute.o
compute_centro_atom.o compute_coord_atom.o compute_displace_atom.o

[...]

region_sphere.o region_union.o replicate.o respa.o run.o set.o shell.o
special.o temper.o thermo.o timer.o universe.o update.o variable.o
velocity.o verlet.o write_restart.o -lfftw -lmpich -lmeam -lgfortran
-lpthread -o ../lmp_nano
../../lib/meam/libmeam.a(meam_setup_done.o): In function `alloyparams_':
meam_setup_done.F:(.text+0x3e7): undefined reference to `ftn_str_copy'
../../lib/meam/libmeam.a(meam_setup_done.o): In function
`compute_pair_meam_':
meam_setup_done.F:(.text+0x7a9): undefined reference to `pgf90_alloc'
meam_setup_done.F:(.text+0x88b): undefined reference to `pgf90_alloc'
meam_setup_done.F:(.text+0x96d): undefined reference to `pgf90_alloc'
meam_setup_done.F:(.text+0xa4f): undefined reference to `pgf90_alloc'
meam_setup_done.F:(.text+0xb31): undefined reference to `pgf90_alloc'

your libmeam.a has obviously been compiled with pgf90, but
you have changed your makefile to link with -lgfortran (why?).

../../lib/meam/libmeam.a(meam_cleanup.o):(.data+0x0): undefined reference to
`pgf90_compiled'
../../lib/meam/libmeam.a(meam_data.o):(.data+0x0): undefined reference to
`pgf90_compiled'
collect2: ld returned 1 exit status
make[1]: *** [../lmp_nano] error 1
make[1]: Leaving directory
`/net/jj/ph/u1/hsc081000/lammps-9Sep08/src/Obj_nano'
make: *** [nano] error 2

What are those errors? Do I have to fix some files in meam library?

no, you have to put the proper statements to link with the matching
runtime of your fortran compiler into your makefile.

the GIGO principle (=garbage in, garbage out) applies everywhere.

this is all very compiler specific and has very little to do
with LAMMPS.

cheers,
   axel.

You are having link troubles with C++ and Fortran on your box.
You need to read the docs for your compilers about how to
do this, what libs to include, etc. Or find someone who is a local
expert on linking 2 languages to help. These are not really LAMMPS
issues.

Steve