New potential with kspace: compiling error at the very beginning

Dear mailing list,

I am implementing a new potential that will use the KSPACE integration, but I am experiencing a compilation error
that I cannot understand and whose solution I cannot find on the manual.

I did the following:

  1. created a directory CTIP in src/

  2. copied there the files src/KSPACE/pair_coul_long.*

  3. renamed them as pair_ctip.(h and cpp)

  4. changed in them the names
    PairCoulLong -> PairCTIP

coul/long -> ctip

in *.cpp put #include “pair_ctip.h”

and nothing else (I just want to see whether it is compiled and included)

  1. added the name ctip in the Makefile, section PACKAGE

When compiling I do:

make yes-kspace

make yes-ctip
make openmpi (I work on ubuntu)

The compilation gives:
"make[1]: Entering directory /home/daniele/CODES-vari/LAMMPS-Versions-pavilion/lammps-1Feb14.DS-99.working/src/Obj_openmpi' mpic++ -O2 -funroll-loops -fstrict-aliasing -Wall -W -Wno-uninitialized -DLAMMPS_GZIP -DFFT_FFTW -M ../remap_wrap.cpp > remap_wrap.d [...] mpic++ -O2 -funroll-loops -fstrict-aliasing -Wall -W -Wno-uninitialized -DLAMMPS_GZIP -DFFT_FFTW -c ../force.cpp In file included from ../style_pair.h:17:0, from ../force.cpp:84: ../pair_ctip.h: In constructor ‘LAMMPS_NS::Force::Force(LAMMPS_NS::LAMMPS*)’: ../pair_ctip.h:16:1: error: ‘PairCTIP’ was not declared in this scope ../pair_ctip.h:16:1: error: no matches converting function ‘pair_creator’ to type ‘std::map<std::basic_string<char>, LAMMPS_NS::Pair* (*)(LAMMPS_NS::LAMMPS*)>::mapped_type {aka class LAMMPS_NS::Pair* (*)(class LAMMPS_NS::LAMMPS*)}’ ../force.h:110:38: error: candidate is: template<class T> static LAMMPS_NS::Pair* LAMMPS_NS::Force::pair_creator(LAMMPS_NS::LAMMPS*) make[1]: *** [force.o] Error 1 make[1]: Leaving directory /home/daniele/CODES-vari/LAMMPS-Versions-pavilion/lammps-1Feb14.DS-99.working/src/Obj_openmpi’
make: *** [openmpi] Error 2
"

I cannot understand this error.
I inserted just two files *.h and *.cpp as suggested in the manual (Extending and Modifying Lammps).

I already implemented a potential without KSPACE (Reference Free MEAM) and I didn’t get this error.

Any idea of the reason and any suggestion on how to proceed ?

Many thanks

Bests,

Daniele Scopece

Dear mailing list,

I am implementing a new potential that will use the KSPACE integration, but
I am experiencing a compilation error
that I cannot understand and whose solution I cannot find on the manual.

I did the following:
1) created a directory CTIP in src/
2) copied there the files src/KSPACE/pair_coul_long.*
3) renamed them as pair_ctip.(h and cpp)
4) changed in them the names
    PairCoulLong -> PairCTIP
    coul/long -> ctip
    in *.cpp put #include "pair_ctip.h"
    and nothing else (I just want to see whether it is compiled and
included)
5) added the name ctip in the Makefile, section PACKAGE

When compiling I do:
make yes-kspace
make yes-ctip
make openmpi (I work on ubuntu)

The compilation gives:
"make[1]: Entering directory
`/home/daniele/CODES-vari/LAMMPS-Versions-pavilion/lammps-1Feb14.DS-99.working/src/Obj_openmpi'
mpic++ -O2 -funroll-loops -fstrict-aliasing -Wall -W -Wno-uninitialized
-DLAMMPS_GZIP -DFFT_FFTW -M ../remap_wrap.cpp > remap_wrap.d
[...]
mpic++ -O2 -funroll-loops -fstrict-aliasing -Wall -W -Wno-uninitialized
-DLAMMPS_GZIP -DFFT_FFTW -c ../force.cpp
In file included from ../style_pair.h:17:0,
                 from ../force.cpp:84:
../pair_ctip.h: In constructor
'LAMMPS_NS::Force::Force(LAMMPS_NS::LAMMPS*)':
../pair_ctip.h:16:1: error: 'PairCTIP' was not declared in this scope
../pair_ctip.h:16:1: error: no matches converting function 'pair_creator' to
type 'std::map<std::basic_string<char>, LAMMPS_NS::Pair*
(*)(LAMMPS_NS::LAMMPS*)>::mapped_type {aka class LAMMPS_NS::Pair* (*)(class
LAMMPS_NS::LAMMPS*)}'
../force.h:110:38: error: candidate is: template<class T> static
LAMMPS_NS::Pair* LAMMPS_NS::Force::pair_creator(LAMMPS_NS::LAMMPS*)
make[1]: *** [force.o] Error 1
make[1]: Leaving directory
`/home/daniele/CODES-vari/LAMMPS-Versions-pavilion/lammps-1Feb14.DS-99.working/src/Obj_openmpi'
make: *** [openmpi] Error 2
"

I cannot understand this error.
I inserted just two files *.h and *.cpp as suggested in the manual
(Extending and Modifying Lammps).
I already implemented a potential without KSPACE (Reference Free MEAM) and I
didn't get this error.

Any idea of the reason and any suggestion on how to proceed ?

the error is likely in your pair_ctip.h file, which doesn't seem to be
adapted correctly.

axel.

Dear mailing list,

I am implementing a new potential that will use the KSPACE integration, but
I am experiencing a compilation error
that I cannot understand and whose solution I cannot find on the manual.

I did the following:
1) created a directory CTIP in src/
2) copied there the files src/KSPACE/pair_coul_long.*
3) renamed them as pair_ctip.(h and cpp)
4) changed in them the names
    PairCoulLong -> PairCTIP
    coul/long -> ctip
    in *.cpp put #include "pair_ctip.h"
    and nothing else (I just want to see whether it is compiled and
included)

so you didn't change the ifdef that prevents multiple inclusion?
biiig mistake.

axel.

Yes: that was the problem indeed !

I needed also to change the lines in *.h
#ifndef LMP_PAIR_COUL_LONG_H
#define LMP_PAIR_COUL_LONG_H
into
#ifndef LMP_PAIR_CTIP_H
#define LMP_PAIR_CTIP_H

and everything compiles fine.

So those consider the case where the user put two entries with two potentials, when no hybrid being considered.
Is that the case ?

Thank you

Daniele

Yes: that was the problem indeed !

     I needed also to change the lines in *.h
#ifndef LMP_PAIR_COUL_LONG_H
#define LMP_PAIR_COUL_LONG_H
      into
#ifndef LMP_PAIR_CTIP_H
#define LMP_PAIR_CTIP_H

and everything compiles fine.

So those consider the case where the user put two entries with two
potentials, when no hybrid being considered.
Is that the case ?

no. it does what i said it does.

it looks to me, like you need to pick up your book about C/C++
programming and re-read the chapter about the preprocessor.

axel.

Yes: that was the problem indeed !

     I needed also to change the lines in *.h
#ifndef LMP_PAIR_COUL_LONG_H
#define LMP_PAIR_COUL_LONG_H
      into
#ifndef LMP_PAIR_CTIP_H
#define LMP_PAIR_CTIP_H

and everything compiles fine.

So those consider the case where the user put two entries with two
potentials, when no hybrid being considered.

to be very clear on this subject, there can be only one(1) active pair
style at a time. the force class only hold one pointer to a pair
class.