Building LAMMPS in serial using additional packages

Dear LAMMPS users,

I am trying to install the lammps14May_2016 version in serial using standard package like REAX and user packages like REAXC. Among the Standard packages, I have omitted all the other ones which requires compilation using extra libraries because I will not be needing them. The standard packages that require Makefile.machine settings like KOKKOS and OPT are also not installed before building LAMMPS. I built the REAX library in a way showed in the manual.

Then I went to the src directory and used “make serial” to build LAMMPS. But I was getting the following error.

…/dihedral_multi_harmonic.cpp:321:57: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
fread(&a2[1],sizeof(double),atom->ndihedraltypes,fp);
^
…/dihedral_multi_harmonic.cpp:322:57: warning: ignoring return value of ‘size_t fread(void
, size_t, size_t, FILE
)’, declared with attribute warn_unused_result [-Wunused-result]
fread(&a3[1],sizeof(double),atom->ndihedraltypes,fp);
^
…/dihedral_multi_harmonic.cpp:323:57: warning: ignoring return value of ‘size_t fread(void
, size_t, size_t, FILE
)’, declared with attribute warn_unused_result [-Wunused-result]
fread(&a4[1],sizeof(double),atom->ndihedraltypes,fp);
^
…/dihedral_multi_harmonic.cpp:324:57: warning: ignoring return value of ‘size_t fread(void
, size_t, size_t, FILE
)’, declared with attribute warn_unused_result [-Wunused-result]
fread(&a5[1],sizeof(double),atom->ndihedraltypes,fp);
^
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I…/…/lib/reax -DLMP_MPIIO -I…/STUBS -c …/dihedral_opls.cpp
…/dihedral_opls.cpp: In member function ‘virtual void LAMMPS_NS::DihedralOPLS::read__restart(FILE
)’:_
…/dihedral_opls.cpp:335:57: warning: ignoring return value of ‘size_t fread(void
, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
fread(&k1[1],sizeof(double),atom->ndihedraltypes,fp);
^
…/dihedral_opls.cpp:336:57: warning: ignoring return value of ‘size_t fread(void
, size_t, size_t, FILE
)’, declared with attribute warn_unused_result [-Wunused-result]
fread(&k2[1],sizeof(double),atom->ndihedraltypes,fp);
^
…/dihedral_opls.cpp:337:57: warning: ignoring return value of ‘size_t fread(void
, size_t, size_t, FILE
)’, declared with attribute warn_unused_result [-Wunused-result]
fread(&k3[1],sizeof(double),atom->ndihedraltypes,fp);
^
…/dihedral_opls.cpp:338:57: warning: ignoring return value of ‘size_t fread(void
, size_t, size_t, FILE
)’, declared with attribute warn_unused_result [-Wunused-result]
*fread(&k4[1],sizeof(double),*atom->ndihedraltypes,fp);
^
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I…/…/lib/reax -DLMP_MPIIO -I…/STUBS -c …/dihedral_zero.cpp
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I…/…/lib/reax -DLMP_MPIIO -I…/STUBS -c …/displace_atoms.cpp
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I…/…/lib/reax -DLMP_MPIIO -I…/STUBS -c …/domain.cpp
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I…/…/lib/reax -DLMP_MPIIO -I…/STUBS -c …/dump_atom.cpp
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I…/…/lib/reax -DLMP_MPIIO -I…/STUBS -c …/dump_atom_gz.cpp
In file included from …/dump_atom_gz.cpp:14:0:
…/dump_atom_gz.h:24:18: fatal error: zlib.h: No such file or directory
#include <zlib.h>
^
compilation terminated.
make[1]: *** [dump_atom_gz.o] Error 1
*make[1]: Leaving directory `/home/uray/URay/Softwares/*lammps-14May16/src/Obj_serial’
make: *** [serial] Error 2

CHecking the error I saw that zlib.h is in zlib1g-dev package. So I installed that too. Then when I tried to build LAMMPS, I got the following error:

make[1]: Entering directory /home/uray/URay/Softwares/lammps-14May16/src/Obj_serial'* *make[1]: Leaving directory /home/uray/URay/Softwares/lammps-14May16/src/Obj_serial’
make[1]: Entering directory `/home/uray/URay/Softwares/lammps-14May16/src/Obj_serial’
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I…/…/lib/reax -DLMP_MPIIO -I…/STUBS -c …/dump_atom_mpiio.cpp
In file included from …/dump_atom_mpiio.cpp:19:0:
…/dump_atom_mpiio.h:39:3: error: ‘MPI_File’ does not name a type
MPI_File mpifh;
^
…/dump_atom_mpiio.cpp: In destructor ‘virtual LAMMPS_NS::DumpAtomMPIIO::~DumpAtomMPIIO()’:
…/dump_atom_mpiio.cpp:46:42: error: ‘mpifh’ was not declared in this scope
if (multifile == 0) MPI_File_close(&mpifh);
^
…/dump_atom_mpiio.cpp:46:47: error: ‘MPI_File_close’ was not declared in this scope
if (multifile == 0) MPI_File_close(&mpifh);
^
…/dump_atom_mpiio.cpp: In member function ‘virtual void LAMMPS_NS::DumpAtomMPIIO::openfile()’:
…/dump_atom_mpiio.cpp:55:23: error: ‘mpifh’ was not declared in this scope
MPI_File_set_size(mpifh,mpifo+headerSize+sumFileSize);
^
…/dump_atom_mpiio.cpp:55:57: error: ‘MPI_File_set_size’ was not declared in this scope
MPI_File_set_size(mpifh,mpifo+headerSize+sumFileSize);
^
…/dump_atom_mpiio.cpp:83:50: error: ‘MPI_MODE_CREATE’ was not declared in this scope
int err = MPI_File_open( world, filecurrent, MPI_MODE_CREATE | MPI_MODE_APPEND | MPI_MODE_WRONLY , MPI_INFO_NULL, &mpifh);
^
…/dump_atom_mpiio.cpp:83:68: error: ‘MPI_MODE_APPEND’ was not declared in this scope
int err = MPI_File_open( world, filecurrent, MPI_MODE_CREATE | MPI_MODE_APPEND | MPI_MODE_WRONLY , MPI_INFO_NULL, &mpifh);
^
…/dump_atom_mpiio.cpp:83:86: error: ‘MPI_MODE_WRONLY’ was not declared in this scope
int err = MPI_File_open( world, filecurrent, MPI_MODE_CREATE | MPI_MODE_APPEND | MPI_MODE_WRONLY , MPI_INFO_NULL, &mpifh);
^
…/dump_atom_mpiio.cpp:83:105: error: ‘MPI_INFO_NULL’ was not declared in this scope
int err = MPI_File_open( world, filecurrent, MPI_MODE_CREATE | MPI_MODE_APPEND | MPI_MODE_WRONLY , MPI_INFO_NULL, &mpifh);
^
…/dump_atom_mpiio.cpp:83:121: error: ‘mpifh’ was not declared in this scope
int err = MPI_File_open( world, filecurrent, MPI_MODE_CREATE | MPI_MODE_APPEND | MPI_MODE_WRONLY , MPI_INFO_NULL, &mpifh);
^
…/dump_atom_mpiio.cpp:83:126: error: ‘MPI_File_open’ was not declared in this scope
int err = MPI_File_open( world, filecurrent, MPI_MODE_CREATE | MPI_MODE_APPEND | MPI_MODE_WRONLY , MPI_INFO_NULL, &mpifh);
^
…/dump_atom_mpiio.cpp:92:37: error: ‘MPI_File_get_size’ was not declared in this scope
MPI_File_get_size(mpifh,&mpifo);
^
…/dump_atom_mpiio.cpp:94:57: error: ‘MPI_File_set_size’ was not declared in this scope
MPI_File_set_size(mpifh,mpifo+headerSize+sumFileSize);
^
…/dump_atom_mpiio.cpp:100:50: error: ‘MPI_MODE_CREATE’ was not declared in this scope
int err = MPI_File_open( world, filecurrent, MPI_MODE_CREATE | MPI_MODE_WRONLY , MPI_INFO_NULL, &mpifh);
^
…/dump_atom_mpiio.cpp:100:68: error: ‘MPI_MODE_WRONLY’ was not declared in this scope
int err = MPI_File_open( world, filecurrent, MPI_MODE_CREATE | MPI_MODE_WRONLY , MPI_INFO_NULL, &mpifh);
^
…/dump_atom_mpiio.cpp:100:87: error: ‘MPI_INFO_NULL’ was not declared in this scope
int err = MPI_File_open( world, filecurrent, MPI_MODE_CREATE | MPI_MODE_WRONLY , MPI_INFO_NULL, &mpifh);
^
…/dump_atom_mpiio.cpp:100:103: error: ‘mpifh’ was not declared in this scope
int err = MPI_File_open( world, filecurrent, MPI_MODE_CREATE | MPI_MODE_WRONLY , MPI_INFO_NULL, &mpifh);
^
…/dump_atom_mpiio.cpp:100:108: error: ‘MPI_File_open’ was not declared in this scope
int err = MPI_File_open( world, filecurrent, MPI_MODE_CREATE | MPI_MODE_WRONLY , MPI_INFO_NULL, &mpifh);
^
…/dump_atom_mpiio.cpp:108:66: error: ‘MPI_File_set_size’ was not declared in this scope
MPI_File_set_size(mpifh,(MPI_Offset) (headerSize+sumFileSize));
^
…/dump_atom_mpiio.cpp: In member function ‘virtual void LAMMPS_NS::DumpAtomMPIIO::write()’:
…/dump_atom_mpiio.cpp:193:37: error: ‘mpifh’ was not declared in this scope
if (multifile) MPI_File_close(&mpifh);
^
…/dump_atom_mpiio.cpp:193:42: error: ‘MPI_File_close’ was not declared in this scope
if (multifile) MPI_File_close(&mpifh);
^
…/dump_atom_mpiio.cpp: In member function ‘void LAMMPS_NS::DumpAtomMPIIO::header_binary(LAMMPS_NS::bigint)’:
…/dump_atom_mpiio.cpp:321:25: error: ‘mpifh’ was not declared in this scope
MPI_File_write_at(mpifh,mpifo,headerBuffer,headerSize,MPI_BYTE,MPI_STATUS_IGNORE);
^
…/dump_atom_mpiio.cpp:321:87: error: ‘MPI_File_write_at’ was not declared in this scope
MPI_File_write_at(mpifh,mpifo,headerBuffer,headerSize,MPI_BYTE,MPI_STATUS_IGNORE);
^
…/dump_atom_mpiio.cpp: In member function ‘void LAMMPS_NS::DumpAtomMPIIO::header_binary_triclinic(LAMMPS_NS::bigint)’:
…/dump_atom_mpiio.cpp:385:25: error: ‘mpifh’ was not declared in this scope
MPI_File_write_at(mpifh,mpifo,headerBuffer,headerSize,MPI_BYTE,MPI_STATUS_IGNORE);
^
…/dump_atom_mpiio.cpp:385:87: error: ‘MPI_File_write_at’ was not declared in this scope
MPI_File_write_at(mpifh,mpifo,headerBuffer,headerSize,MPI_BYTE,MPI_STATUS_IGNORE);
^
…/dump_atom_mpiio.cpp: In member function ‘void LAMMPS_NS::DumpAtomMPIIO::header_item(LAMMPS_NS::bigint)’:
…/dump_atom_mpiio.cpp:413:25: error: ‘mpifh’ was not declared in this scope
MPI_File_write_at(mpifh,mpifo,headerBuffer,headerSize,MPI_CHAR,MPI_STATUS_IGNORE);
^
…/dump_atom_mpiio.cpp:413:87: error: ‘MPI_File_write_at’ was not declared in this scope
MPI_File_write_at(mpifh,mpifo,headerBuffer,headerSize,MPI_CHAR,MPI_STATUS_IGNORE);
^
…/dump_atom_mpiio.cpp: In member function ‘void LAMMPS_NS::DumpAtomMPIIO::header_item_triclinic(LAMMPS_NS::bigint)’:
…/dump_atom_mpiio.cpp:441:25: error: ‘mpifh’ was not declared in this scope
MPI_File_write_at(mpifh,mpifo,headerBuffer,headerSize,MPI_CHAR,MPI_STATUS_IGNORE);
^
…/dump_atom_mpiio.cpp:441:87: error: ‘MPI_File_write_at’ was not declared in this scope
MPI_File_write_at(mpifh,mpifo,headerBuffer,headerSize,MPI_CHAR,MPI_STATUS_IGNORE);
^
…/dump_atom_mpiio.cpp: In member function ‘void LAMMPS_NS::DumpAtomMPIIO::write_binary(int, double*)’:
…/dump_atom_mpiio.cpp:476:27: error: ‘mpifh’ was not declared in this scope
MPI_File_write_at_all(mpifh,mpifo+offsetFromHeader,bufWithSize,byteBufSize,MPI_BYTE,MPI_STATUS_IGNORE);
^
…/dump_atom_mpiio.cpp:476:106: error: ‘MPI_File_write_at_all’ was not declared in this scope
MPI_File_write_at_all(mpifh,mpifo+offsetFromHeader,bufWithSize,byteBufSize,MPI_BYTE,MPI_STATUS_IGNORE);
^
…/dump_atom_mpiio.cpp:480:26: error: ‘MPI_File_sync’ was not declared in this scope
MPI_File_sync(mpifh);
^
…/dump_atom_mpiio.cpp: In member function ‘void LAMMPS_NS::DumpAtomMPIIO::write_string(int, double*)’:
…/dump_atom_mpiio.cpp:507:27: error: ‘mpifh’ was not declared in this scope
MPI_File_write_at_all(mpifh,mpifo+offsetFromHeader,sbuf,nsme,MPI_CHAR,MPI_STATUS_IGNORE);
^
…/dump_atom_mpiio.cpp:507:92: error: ‘MPI_File_write_at_all’ was not declared in this scope
MPI_File_write_at_all(mpifh,mpifo+offsetFromHeader,sbuf,nsme,MPI_CHAR,MPI_STATUS_IGNORE);
^
…/dump_atom_mpiio.cpp:509:26: error: ‘MPI_File_sync’ was not declared in this scope
MPI_File_sync(mpifh);

Can anyone please help me with this? WHat should I include in the “/home/uray/URay/Softwares/lammps-14May16/src/Obj_serial” directory?

Thank you so much for all your help.

Regards,

Dear LAMMPS users,

I am trying to install the lammps14May_2016 version in serial using standard
package like REAX and user packages like REAXC. Among the Standard packages,
I have omitted all the other ones which requires compilation using extra
libraries because I will not be needing them. The standard packages that
require Makefile.machine settings like KOKKOS and OPT are also not installed
before building LAMMPS. I built the REAX library in a way showed in the
manual.

[...]

make[1]: Entering directory
`/home/uray/URay/Softwares/lammps-14May16/src/Obj_serial'
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I../../lib/reax -DLMP_MPIIO
-I../STUBS -c ../dump_atom_mpiio.cpp
In file included from ../dump_atom_mpiio.cpp:19:0:
../dump_atom_mpiio.h:39:3: error: ‘MPI_File’ does not name a type
   MPI_File mpifh;
   ^
../dump_atom_mpiio.cpp: In destructor ‘virtual
LAMMPS_NS::DumpAtomMPIIO::~DumpAtomMPIIO()’:
../dump_atom_mpiio.cpp:46:42: error: ‘mpifh’ was not declared in this scope
   if (multifile == 0) MPI_File_close(&mpifh);
                                          ^
../dump_atom_mpiio.cpp:46:47: error: ‘MPI_File_close’ was not declared in
this scope
   if (multifile == 0) MPI_File_close(&mpifh);
                                               ^

[...]

these errors are due to the MPIIO package, which requires a *full* MPI
installation, not the STUBS library.

Can anyone please help me with this? WHat should I include in the
"/home/uray/URay/Softwares/lammps-14May16/src/Obj_serial" directory?

the best approach is to only install the packages you need. i
recommend against REAX, as it is deprecated, not maintained and slower
than USER-REAXC.

so try:

make-clean-all
make no-all
make yes-user-reaxc
make serial

if at a later point, you notice that you need an additional package,
you can always go back and do:
make yes-<package>
make serial

to compile a new binary with the added feature(s). the make yes/no
scripts should take care of inter-package dependencies and update
packages that are already installed accordingly.

axel.

Thank you so much for your help. It worked.