[lammps-users] lammps compilation

Dear all,

I still seem to struggle with my LAMMPS compilation and I apologise if this is too obvious a question, but I have tried everything and read all I found in the documentation and on the Internet, and I still get the following message:

make[1]: Entering directory `.../lammps-18Dec10/src/Obj_openmpi'
g++ -O2 -funroll-loops -fstrict-aliasing -Wall -W -Wno-uninitialized -DLAMMPS_GZIP -I/usr/mpi/gcc/openmpi-1.4-qlc/include -DFFT_FFTW -c fft3d.cpp
In file included from fft3d.cpp:22:
fft3d.h:164:18: error: fftw.h: No such file or directory
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:646: warning: unused parameter �oldcomm�
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:646: warning: unused parameter �comm_keyval�
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:646: warning: unused parameter �extra_state�
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:646: warning: unused parameter �attribute_val_in�
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:646: warning: unused parameter �attribute_val_out�
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:672: warning: unused parameter �comm�
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:672: warning: unused parameter �comm_keyval�
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:672: warning: unused parameter �attribute_val�
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:672: warning: unused parameter �extra_state�
fft3d.h:165: error: �FFTW_COMPLEX� does not name a type
fft3d.h:186: error: ISO C++ forbids declaration of �FFT_DATA� with no type
fft3d.h:186: error: expected �;� before �*� token
fft3d.h:187: error: ISO C++ forbids declaration of �FFT_DATA� with no type
fft3d.h:187: error: expected �;� before �*� token
fft3d.h:224: error: �fftw_plan� does not name a type
fft3d.h:225: error: �fftw_plan� does not name a type
fft3d.h:226: error: �fftw_plan� does not name a type
fft3d.h:227: error: �fftw_plan� does not name a type
fft3d.h:228: error: �fftw_plan� does not name a type
fft3d.h:229: error: �fftw_plan� does not name a type
fft3d.h:235: error: variable or field �fft_3d� declared void
fft3d.h:235: error: �FFT_DATA� was not declared in this scope
fft3d.h:235: error: expected primary-expression before �,� token
fft3d.h:235: error: �FFT_DATA� was not declared in this scope
fft3d.h:235: error: expected primary-expression before �,� token
fft3d.h:235: error: expected primary-expression before �int�
fft3d.h:235: error: expected primary-expression before �struct�
fft3d.h:235: error: initializer expression list treated as compound expression
fft3d.h:242: error: variable or field �fft_1d_only� declared void
fft3d.h:242: error: �FFT_DATA� was not declared in this scope
fft3d.h:242: error: expected primary-expression before �,� token
fft3d.h:242: error: expected primary-expression before �int�
fft3d.h:242: error: expected primary-expression before �struct�
fft3d.h:242: error: initializer expression list treated as compound expression
fft3d.cpp:58: error: variable or field �fft_3d� declared void
fft3d.cpp:58: error: redefinition of �int fft_3d�
fft3d.h:235: error: �int fft_3d� previously defined here
fft3d.cpp:58: error: �FFT_DATA� was not declared in this scope
fft3d.cpp:58: error: �in� was not declared in this scope
fft3d.cpp:58: error: �FFT_DATA� was not declared in this scope
fft3d.cpp:58: error: �out� was not declared in this scope
fft3d.cpp:58: error: expected primary-expression before �int�
fft3d.cpp:58: error: expected primary-expression before �struct�
make[1]: *** [fft3d.o] Error 1
make[1]: Leaving directory `.../lammps-18Dec10/src/Obj_openmpi'
make: *** [openmpi] Error 2

it seems that this is the problem:
fft3d.h:164:18: error: fftw.h: No such file or directory
However, I have created a library in my directory as follows:

I made dir localfft
and from fftw-2.1.5/ typed
.configure --prefix=*path*/localfft

I changed my makefile to point to the new library:

FFT_INC = -DFFT_FFTW
FFT_PATH = -L/*path*/localfft
FFT_LIB = -lfftw

Could somebody possibly point out the mistakes I am doing?

Thank you in advance.
Anna

Dear all,

[...]

it seems that this is the problem:
fft3d.h:164:18: error: fftw.h: No such file or directory
However, I have created a library in my directory as follows:

I made dir localfft
and from fftw-2.1.5/ typed
.configure --prefix=*path*/localfft

I changed my makefile to point to the new library:

FFT_INC = -DFFT_FFTW
FFT_PATH = -L/*path*/localfft
FFT_LIB = -lfftw

Could somebody possibly point out the mistakes I am doing?

you need:

FFT_INC= -DFFT_FFTW -I/*path*/localfft/include
FFT_PATH = -L/*path*/localfft/lib

axel.

Dear Dr Axel,

Thank you very much for your help! I still seem to get Errors:

make[1]: Entering directory `/.../lammps-18Dec10/src/Obj_openmpi'
g++ -O2 -funroll-loops -fstrict-aliasing -Wall -W -Wno-uninitialized -DLAMMPS_GZIP -I/usr/mpi/gcc/openmpi-1.4-qlc/include -DFFT_FFTW -I/.../localfft/include -c fft3d.cpp
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:646: warning: unused parameter �oldcomm�
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:646: warning: unused parameter �comm_keyval�
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:646: warning: unused parameter �extra_state�
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:646: warning: unused parameter �attribute_val_in�
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:646: warning: unused parameter �attribute_val_out�
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:672: warning: unused parameter �comm�
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:672: warning: unused parameter �comm_keyval�
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:672: warning: unused parameter �attribute_val�
/usr/mpi/gcc/openmpi-1.4-qlc/include/openmpi/ompi/mpi/cxx/comm_inln.h:672: warning: unused parameter �extra_state�
fft3d.cpp: In function �void fft_3d(FFT_DATA*, FFT_DATA*, int, fft_plan_3d*)�:
fft3d.cpp:60: warning: unused variable �offset�
fft3d.cpp: In function �fft_plan_3d* fft_3d_create_plan(ompi_communicator_t*, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int*)�:
fft3d.cpp:285: warning: unused variable �i�
fft3d.cpp:285: warning: unused variable �num�
fft3d.cpp:285: warning: unused variable �fftflag�
fft3d.cpp:291: warning: unused variable �list�
fft3d.cpp: In function �void fft_1d_only(FFT_DATA*, int, int, fft_plan_3d*)�:
fft3d.cpp:868: warning: unused variable �total�
fft3d.cpp:868: warning: unused variable �length�
fft3d.cpp:868: warning: unused variable �offset�
g++ -O -L/usr/mpi/gcc/openmpi-1.4-qlc/lib64 -L/.../localfft/lib angle_charmm.o angle_cosine.o angle_cosine_delta.o angle_cosine_periodic.o angle_cosine_squared.o angle.o angle_harmonic.o angle_hybrid.o angle_table.o atom.o atom_vec_angle.o atom_vec_atomic.o atom_vec_bond.o atom_vec_charge.o atom_vec.o atom_vec_full.o atom_vec_hybrid.o atom_vec_molecular.o bond.o bond_fene.o bond_fene_expand.o bond_harmonic.o bond_hybrid.o bond_morse.o bond_nonlinear.o bond_quartic.o bond_table.o change_box.o comm.o compute_angle_local.o compute_atom_molecule.o compute_bond_local.o compute_centro_atom.o compute_cna_atom.o compute_com.o compute_com_molecule.o compute_coord_atom.o compute.o compute_dihedral_local.o compute_displace_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_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_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_charmm.o dihedral.o dihedral_harmonic.o dihedral_helix.o dihedral_hybrid.o dihedral_multi_harmonic.o dihedral_opls.o displace_atoms.o displace_box.o domain.o dump_atom.o dump_cfg.o dump.o dump_custom.o dump_dcd.o dump_local.o dump_xyz.o error.o ewald.o fft3d.o fft3d_wrap.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_bond_break.o fix_bond_create.o fix_bond_swap.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_press_berendsen.o fix_print.o fix_qeq_comb.o fix_read_restart.o fix_recenter.o fix_respa.o fix_rigid.o fix_rigid_nve.o fix_rigid_nvt.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 improper.o improper_cvff.o improper_harmonic.o improper_hybrid.o improper_umbrella.o input.o integrate.o irregular.o kspace.o lammps.o lattice.o library.o main.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 pack.o pair_airebo.o pair_born_coul_long.o pair_born.o pair_buck_coul_cut.o pair_buck_coul_long.o pair_buck.o pair_comb.o pair_coul_cut.o pair_coul_debye.o pair_coul_long.o pair.o pair_dpd.o pair_dpd_tstat.o pair_eam_alloy.o pair_eam.o pair_eam_fs.o pair_eim.o pair_gauss.o pair_hbond_dreiding_lj.o pair_hbond_dreiding_morse.o pair_hybrid.o pair_hybrid_overlay.o pair_lj96_cut.o pair_lj_charmm_coul_charmm.o pair_lj_charmm_coul_charmm_implicit.o pair_lj_charmm_coul_long.o pair_lj_cut_coul_cut.o pair_lj_cut_coul_debye.o pair_lj_cut_coul_long.o pair_lj_cut_coul_long_tip4p.o pair_lj_cut.o pair_lj_expand.o pair_lj_gromacs_coul_gromacs.o pair_lj_gromacs.o pair_lj_smooth.o pair_morse.o pair_soft.o pair_sw.o pair_table.o pair_tersoff.o pair_tersoff_zbl.o pair_yukawa.o pppm.o pppm_tip4p.o random_mars.o random_park.o read_data.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 remap.o remap_wrap.o replicate.o respa.o run.o set.o shell.o special.o thermo.o timer.o universe.o update.o variable.o velocity.o verlet.o write_restart.o -lmpi -lfftw -lstdc++ -o ../lmp_openmpi
angle_charmm.o: In function `MPI::Op::Init(void (*)(void const*, void*, int, MPI::Datatype const&), bool)':
angle_charmm.cpp:(.text._ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb[MPI::Op::Init(void (*)(void const*, void*, int, MPI::Datatype const&), bool)]+0x19): undefined reference to `ompi_mpi_cxx_op_intercept'
angle_charmm.o: In function `MPI::Graphcomm::Clone() const':
angle_charmm.cpp:(.text._ZNK3MPI9Graphcomm5CloneEv[MPI::Graphcomm::Clone() const]+0x25): undefined reference to `MPI::Comm::Comm()'
angle_charmm.o: In function `MPI::Intracomm::Create(MPI::Group const&) const':
angle_charmm.cpp:(.text._ZNK3MPI9Intracomm6CreateERKNS_5GroupE[MPI::Intracomm::Create(MPI::Group const&) const]+0x2a): undefined reference to `MPI::Comm::Comm()'
angle_charmm.o: In function `MPI::Intracomm::Create_cart(int, int const*, bool const*, bool) const':
angle_charmm.cpp:(.text._ZNK3MPI9Intracomm11Create_cartEiPKiPKbb[MPI::Intracomm::Create_cart(int, int const*, bool const*, bool) const]+0x18b): undefined reference to `MPI::Comm::Comm()'
angle_charmm.o: In function `MPI::Intracomm::Create_graph(int, int const*, int const*, bool) const':
angle_charmm.cpp:(.text._ZNK3MPI9Intracomm12Create_graphEiPKiS2_b[MPI::Intracomm::Create_graph(int, int const*, int const*, bool) const]+0x2b): undefined reference to `MPI::Comm::Comm()'
angle_charmm.o: In function `MPI::Cartcomm::Clone() const':
angle_charmm.cpp:(.text._ZNK3MPI8Cartcomm5CloneEv[MPI::Cartcomm::Clone() const]+0x25): undefined reference to `MPI::Comm::Comm()'
angle_charmm.o:angle_charmm.cpp:(.text._ZN3MPI8Cartcomm3SubEPKb[MPI::Cartcomm::Sub(bool const*)]+0x76): more undefined references to `MPI::Comm::Comm()' follow
angle_charmm.o:(.rodata._ZTVN3MPI3WinE[vtable for MPI::Win]+0x48): undefined reference to `MPI::Win::Free()'
angle_charmm.o:(.rodata._ZTVN3MPI8DatatypeE[vtable for MPI::Datatype]+0x78): undefined reference to `MPI::Datatype::Free()'
collect2: ld returned 1 exit status
make[1]: *** [../lmp_openmpi] Error 1
make[1]: Leaving directory `/.../lammps-18Dec10/src/Obj_openmpi'
make: *** [openmpi] Error 2

Dear Dr Axel,

Thank you very much for your help! I still seem to get Errors:

make[1]: Entering directory `/.../lammps-18Dec10/src/Obj_openmpi'
g++ -O2 -funroll-loops -fstrict-aliasing -Wall -W -Wno-uninitialized
-DLAMMPS_GZIP -I/usr/mpi/gcc/openmpi-1.4-qlc/include -DFFT_FFTW

MPI::Datatype const&), bool)':
angle_charmm.cpp:(.text._ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb[MPI::Op::Init(void
(*)(void const*, void*, int, MPI::Datatype const&), bool)]+0x19): undefined
reference to `ompi_mpi_cxx_op_intercept'
angle_charmm.o: In function `MPI::Graphcomm::Clone() const':
angle_charmm.cpp:(.text._ZNK3MPI9Graphcomm5CloneEv[MPI::Graphcomm::Clone()
const]+0x25): undefined reference to `MPI::Comm::Comm()'
angle_charmm.o: In function `MPI::Intracomm::Create(MPI::Group const&)
const':
angle_charmm.cpp:(.text._ZNK3MPI9Intracomm6CreateERKNS_5GroupE[MPI::Intracomm::Create(MPI::Group
const&) const]+0x2a): undefined reference to `MPI::Comm::Comm()'
angle_charmm.o: In function `MPI::Intracomm::Create_cart(int, int const*,
bool const*, bool) const':
angle_charmm.cpp:(.text._ZNK3MPI9Intracomm11Create_cartEiPKiPKbb[MPI::Intracomm::Create_cart(int,
int const*, bool const*, bool) const]+0x18b): undefined reference to
`MPI::Comm::Comm()'
angle_charmm.o: In function `MPI::Intracomm::Create_graph(int, int const*,
int const*, bool) const':
angle_charmm.cpp:(.text._ZNK3MPI9Intracomm12Create_graphEiPKiS2_b[MPI::Intracomm::Create_graph(int,
int const*, int const*, bool) const]+0x2b): undefined reference to
`MPI::Comm::Comm()'
angle_charmm.o: In function `MPI::Cartcomm::Clone() const':
angle_charmm.cpp:(.text._ZNK3MPI8Cartcomm5CloneEv[MPI::Cartcomm::Clone()
const]+0x25): undefined reference to `MPI::Comm::Comm()'
angle_charmm.o:angle_charmm.cpp:(.text._ZN3MPI8Cartcomm3SubEPKb[MPI::Cartcomm::Sub(bool
const*)]+0x76): more undefined references to `MPI::Comm::Comm()' follow
angle_charmm.o:(.rodata._ZTVN3MPI3WinE[vtable for MPI::Win]+0x48): undefined
reference to `MPI::Win::Free()'
angle_charmm.o:(.rodata._ZTVN3MPI8DatatypeE[vtable for MPI::Datatype]+0x78):
undefined reference to `MPI::Datatype::Free()'
collect2: ld returned 1 exit status
make[1]: *** [../lmp_openmpi] Error 1
make[1]: Leaving directory `/.../lammps-18Dec10/src/Obj_openmpi'
make: *** [openmpi] Error 2

these are all errors related to MPI. you are linking with g++ which doen't
know anything about MPI. so you either have to specify the libraries
explicitly or you can try the c++ compiler wrappers that come with any
proper MPI installation, e.g. mpiCC , mpicxx or mpic++ instead of g++.

axel.

Dear Dr Axel,

Thank you for your help! Unfortunatelly, there are no mpic++/mpicxx/mpicc compilers in our University system, I will see whether I am allowed to install them. If I understand correctly, it is mpich2 that I need?

Thank you!
Sincerely yours
Anna

Dear Dr Axel,

Thank you for your help! Unfortunatelly, there are no mpic++/mpicxx/mpicc
compilers in our University system, I will see whether I am allowed to

of course there are. they are part of every MPI installation.
they are not compilers, but "wrappers", i.e. scripts or programs
that transparently add the (magic) mpi flags and libraries
to the command line when you compile MPI based programs.

install them. If I understand correctly, it is mpich2 that I need?

no. MPICH is evil. :wink:

check out this directory: /usr/mpi/gcc/openmpi-1.4-qlc/bin

axel.

Dear Dr Axel!

Thank You so very much for your explanation! My openmpi lammps compiled! Thank you! I hope that I will be able to run parallel lammps with my openmpi!

Thank You so very much!
Sincerely yours,
Anna

Dear Dr Axel!

Thank You so very much for your explanation! My openmpi lammps compiled!

there you go. it was easy to come up with the explanation, i am currently
spending most of my awake setting up and configuring a cluster and as it
so happened i compiled and installed OpenMPI and LAMMPS (but my own
branch, of course) today as a first serious of the viability of the machine with
its many different nodes. :wink:

Thank you! I hope that I will be able to run parallel lammps with my
openmpi!

OpenMPI rulez!!

cheers,
   axel.

Dear Dr Axel,

Congratulations! OpenMPI rules indeed!!!

With best Wishes,
Anna