ATC library compilation failed (errors in LammpsInterface.cpp)

Kernel: Linux 2.6.26-2-amd64 #1 SMP Tue Jan 25 05:59:43 UTC 2011 x86_64 GNU/Linux
OS: Debian Lenny
Revelant software version:
  LAMMPS: lammps-4Apr11 (but also today's git repository.
  g++ (Debian 4.3.2-1.1) 4.3.2
  gfortran GNU Fortran (Debian 4.3.2-1.1) 4.3.2

Hi all,

One of the user of our cluster wanted to use LAMMPS and got problems to compile it so I tried on my own, following this [nice tutorial](http://www.cbp.ens-lyon.fr/emmanuel.quemener/dokuwiki/doku.php?id=lammps4debian).

To summarize:

export LAMMPSROOT=/path/to/lammps

# Prepare MPI
cd $LAMMPSROOT/src/STUBS
make clean
make
# Compile MEAM library
cd $LAMMPSROOT/lib/meam
make -f Makefile.gfortran clean
make -f Makefile.gfortran
# Compile POEMS library
cd $LAMMPSROOT/lib/poems
make -f Makefile.g++ clean
make -f Makefile.g++
# Compile REAX library
cd $LAMMPSROOT/lib/reax
make -f Makefile.gfortran clean
make -f Makefile.gfortran
# Compile ATC library (serial version)
cd $LAMMPSROOT/lib/atc
make -f Makefile.serial clean
make -f Makefile.serial

At the level of the ATC library compilation, the following errors are raised:

[...]
[DEBUG] [execute] make -f Makefile.serial
make: Warning: File `Makefile.serial' has modification time 1.9e+02 s in the future
g++ -O -g -I../../src -I../../src/STUBS -c ATC_HardyKernel.cpp
g++ -O -g -I../../src -I../../src/STUBS -c ATC_Transfer.cpp
g++ -O -g -I../../src -I../../src/STUBS -c ATC_TransferHardy.cpp
g++ -O -g -I../../src -I../../src/STUBS -c ATC_TransferThermal.cpp
g++ -O -g -I../../src -I../../src/STUBS -c ATC_TransferUtility.cpp
g++ -O -g -I../../src -I../../src/STUBS -c AtomicRegulator.cpp
g++ -O -g -I../../src -I../../src/STUBS -c ElasticTimeIntegrator.cpp
g++ -O -g -I../../src -I../../src/STUBS -c ElectronFlux.cpp
g++ -O -g -I../../src -I../../src/STUBS -c ElectronHeatCapacity.cpp
g++ -O -g -I../../src -I../../src/STUBS -c ElectronHeatFlux.cpp
g++ -O -g -I../../src -I../../src/STUBS -c ElectronPhononExchange.cpp
g++ -O -g -I../../src -I../../src/STUBS -c ExtrinsicModel.cpp
g++ -O -g -I../../src -I../../src/STUBS -c ExtrinsicModelTwoTemperature.cpp
g++ -O -g -I../../src -I../../src/STUBS -c FE_Element.cpp
g++ -O -g -I../../src -I../../src/STUBS -c FE_Engine.cpp
g++ -O -g -I../../src -I../../src/STUBS -c FE_Mesh.cpp
g++ -O -g -I../../src -I../../src/STUBS -c FieldEulerIntegrator.cpp
g++ -O -g -I../../src -I../../src/STUBS -c ImplicitSolveOperator.cpp
g++ -O -g -I../../src -I../../src/STUBS -c Kinetostat.cpp
g++ -O -g -I../../src -I../../src/STUBS -c LammpsInterface.cpp
LammpsInterface.cpp: In member function 'double* ATC::LammpsInterface::create_1d_double_array(int, int, const char*)':
LammpsInterface.cpp:401: error: 'class LAMMPS_NS::Memory' has no member named 'create_1d_double_array'
LammpsInterface.cpp: In member function 'void ATC::LammpsInterface::destroy_1d_double_array(double*, int)':
LammpsInterface.cpp:405: error: 'class LAMMPS_NS::Memory' has no member named 'destroy_1d_double_array'
LammpsInterface.cpp: In member function 'double** ATC::LammpsInterface::create_2d_double_array(int, int, const char*)':
LammpsInterface.cpp:409: error: 'class LAMMPS_NS::Memory' has no member named 'create_2d_double_array'
LammpsInterface.cpp: In member function 'void ATC::LammpsInterface::destroy_2d_double_array(double**)':
LammpsInterface.cpp:413: error: 'class LAMMPS_NS::Memory' has no member named 'destroy_2d_double_array'
LammpsInterface.cpp: In member function 'double** ATC::LammpsInterface::grow_2d_double_array(double**, int, int, const char*)':
LammpsInterface.cpp:421: error: 'class LAMMPS_NS::Memory' has no member named 'grow_2d_double_array'
LammpsInterface.cpp: In member function 'int** ATC::LammpsInterface::create_2d_int_array(int, int, const char*)':
LammpsInterface.cpp:425: error: 'class LAMMPS_NS::Memory' has no member named 'create_2d_int_array'
LammpsInterface.cpp: In member function 'void ATC::LammpsInterface::destroy_2d_int_array(int**)':
LammpsInterface.cpp:429: error: 'class LAMMPS_NS::Memory' has no member named 'destroy_2d_int_array'
LammpsInterface.cpp: In member function 'int** ATC::LammpsInterface::grow_2d_int_array(int**, int, int, const char*)':
LammpsInterface.cpp:433: error: 'class LAMMPS_NS::Memory' has no member named 'grow_2d_int_array'
LammpsInterface.cpp: In member function 'int ATC::LammpsInterface::atomPE_create()':
LammpsInterface.cpp:587: warning: deprecated conversion from string constant to 'char*'
LammpsInterface.cpp:587: warning: deprecated conversion from string constant to 'char*'
LammpsInterface.cpp:587: warning: deprecated conversion from string constant to 'char*'
LammpsInterface.cpp:587: warning: deprecated conversion from string constant to 'char*'
make: *** [LammpsInterface.o] Error 1

Actually, even if I'm not familiar with LAMMPS at all, this error is quite normal as when I check $LAMMPSROOT/src/memory.h, there is no trace of the functions create_1d_double_array etc. (in fact, the interface to create 1D or 2D array are templated and the method names are slightly different) so I don't know from which version the authors of the ATC library were inspired.

Anyway, by applying the attached patch file, compilation went fine (after again, I tried to guess the expected behaviour, I made no specific test to ensure my modification are indeed valid.

List of changed files:
  
  4Apr11 version files changed by my5Apr11 patch:

  lib/atc/LammpsInterface.cpp

Best regards,

patch_lib_atc.5Apr11 (2.65 KB)

The interface to the memory allocators changed and the ATC library
is not yet uptodate. Stay tuned.

Steve

Sebastian, as a temporary fix grab on older version of lammps. We're working on an upgraded package to work with the new code.
Jeremy

Jeremy - in the 5Apr11 patch (earlier today) I included
some minor changes to lib/atc/LammpsInterface.cpp that
make it compatible with the new memory interface in main
LAMMPS. So the version in LAMMPS builds fine now.

Steve

Thanks Steve. The change caught us right in the middle of preparing for a release, so there will be an updated version arriving soon as well.
Jeremy

That's great, thanks all for this [very] quick reaction :wink: