Problem with list-> calls in implementing a new potential

Dear Mailing List,

I am implementing a new potential in LAMMPS (Reference Free MEAM),
but I am having trouble with the calls to list including the simple

list->inum

When the code reaches the line in compute()
inum = list->inum;
it gives segmentation fault:

“mpiexec noticed that process rank 0 with PID 15833 on node pavilion exited on signal 11 (Segmentation fault).”

I couldn’t find any help in the archive of the mailing list and

personally I cannot understand the origin of this error, since I am following the same structure used in Tersoff potential file:
(1) In pair_rfmeam.cpp:
#include “neighbor.h”
#include “neigh_list.h”
#include “neigh_request.h”

(2) in compute():

int inum;

inum = list-inum;

(3) in init_style()
int irequest_full = neighbor->request(this);
neighbor->requests[irequest_full]->half = 0;
neighbor->requests[irequest_full]->full = 1;

My input file is very simple:
units metal
boundary p p p
atom_style atomic
read_data Test-cube.data # with 8 atoms distant 1.0 units apart on a cube with edges of length 2.0
newton on
mass 1 26.98 # Al
mass 2 16.00 # O
pair_style rfmeam
pair_coeff * * library.rfmeam.AlO.LazicThijsse Al O
min_style cg
minimize 0.2 0.2 1 1

My questions are:

  1. Should I have inserted something else to let the program know to call the neighbour list or is it called automatically ?

  2. Should I insert any particular voice in the input file ?

  3. What else should I check to see if everything is correct ?

  4. Do I have to insert some call to list in any other parts ?

In addition:

  1. What is the difference between using listfull-> and listhalf-> (I have seen this in some files) ?

Thank you very much in advance for your help

Best regards,

Daniele Scopece

Dear Mailing List,

I am implementing a new potential in LAMMPS (Reference Free MEAM),
but I am having trouble with the calls to list including the simple
list->inum

When the code reaches the line in compute()
inum = list->inum;
it gives segmentation fault:
"mpiexec noticed that process rank 0 with PID 15833 on node pavilion exited
on signal 11 (Segmentation fault)."

I couldn't find any help in the archive of the mailing list and
personally I cannot understand the origin of this error, since I am
following the same structure used in Tersoff potential file:
(1) In pair_rfmeam.cpp:
     #include "neighbor.h"
     #include "neigh_list.h"
     #include "neigh_request.h"

(2) in compute():
     int inum;
     inum = list-inum;

is this "list-inum" or "list->inum"?

Dear Mailing List,

I am implementing a new potential in LAMMPS (Reference Free MEAM),
but I am having trouble with the calls to list including the simple
list->inum

When the code reaches the line in compute()
inum = list->inum;
it gives segmentation fault:
"mpiexec noticed that process rank 0 with PID 15833 on node pavilion exited
on signal 11 (Segmentation fault)."

I couldn't find any help in the archive of the mailing list and
personally I cannot understand the origin of this error, since I am
following the same structure used in Tersoff potential file:
(1) In pair_rfmeam.cpp:
     #include "neighbor.h"
     #include "neigh_list.h"
     #include "neigh_request.h"

(2) in compute():
     int inum;
     inum = list-inum;

(3) in init_style()
     int irequest_full = neighbor->request(this);
     neighbor->requests[irequest_full]->half = 0;
     neighbor->requests[irequest_full]->full = 1;

My input file is very simple:
units metal
boundary p p p
atom_style atomic
read_data Test-cube.data # with 8 atoms distant 1.0 units apart on a
cube with edges of length 2.0
newton on
mass 1 26.98 # Al
mass 2 16.00 # O
pair_style rfmeam
pair_coeff * * library.rfmeam.AlO.LazicThijsse Al O
min_style cg
minimize 0.2 0.2 1 1

My questions are:
1) Should I have inserted something else to let the program know to call the
neighbour list or is it called automatically ?
2) Should I insert any particular voice in the input file ?
3) What else should I check to see if everything is correct ?
4) Do I have to insert some call to list in any other parts ?

In addition:
5) What is the difference between using listfull-> and listhalf-> (I have
seen this in some files) ?

It is a difference between a full neighbor list and a half neighbor
list: LAMMPS Molecular Dynamics Simulator

Ray

Dear Axel

This is
list->inum

And the same problem occurs also with

list->ilist
list->numneigh
list->firstneigh

And I really cannot understand what I did wrong, since I followed the syntax of pair_tersoff.cpp

Thank you
Daniele

Dear Axel

This is
list->inum

And the same problem occurs also with
list->ilist
list->numneigh
list->firstneigh

And I really cannot understand what I did wrong, since I followed the syntax
of pair_tersoff.cpp

since i cannot read people's minds (or the minds of their computers),
it is difficult to give much additional advice.
have you checked that the list class is properly instantiated?
also, if you compile with full compiler optimization, the line where
the compiler states a segfault happens, may not be exactly the line
where the problem is.

your best best is to compile a serial executable with debug support
and process it with gdb and valgrind to narrow down the problem more
closely.

axel.

SOLVED !

I report the solution here so that it can be useful for those who implement a new potential and come to the same error.

The problem was that in the file I created (pair_rfmeam.cpp, that I originally copied from the MEAM files) there was a function
init_list()

that overwrote the “list->” variables defined originally by

init_list() in “pair.cpp”

Once erased that function from my file, everything works fine and as expected.

LESSON LEARNT:
when implementing a new potential, pay attention to the function init_list in your *cpp file:
it might create an unexpected mess :slight_smile:

Thank you, Axel, for your advice to look at the initialization of the variables:
thanks to it I could identify the error that I was otherwise looking for elsewhere

Bests

Daniele Scopece