Full pair list + hybrid DPD/SRP model neighbor bug?

Dear List,

I'm working on generalizing the fix_bond_swap to work for the mSRP polymer model. This is horribly tricky, and my code keeps crashing. Hence I started to valgrind to check for memory problems. I get some errors that persist even if I remove most of my code, keeping only the skeleton code to request and build a full neighbor list.

Using the in.srp example and LAMMPS dated 31/3 running on a single core compiled with gcc -O0 -ggdb, valgrind does not report any memory issues except a few leaks. To the source code, I have added the dummy testtest fix (source below). The dummy fix requests a full pair list, and and does nothing except call neighbor->build_one(fulllist,1) in postintegrate.

When I add "fix test all testtest 50" to the in.srp script instantiate the dummy fix. I get the valgrind warnings below, ending with a segmentation fault.

Now if I instead do a "run 0" before instantiating the dummy fix, then it runs without any errors.

This suggests to me that there is some subtle bug at play somewhere in the neighbor code that is triggered by this combination of force field and neighbor list requests.

==22394== Memcheck, a memory error detector
==22394== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==22394== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==22394== Command: lmp_master_gdb -in in.srp
==22394==
LAMMPS (31 Mar 2017)
Reading data file ...
   orthogonal box = (0 0 0) to (10 10 10)
   1 by 1 by 1 MPI processor grid
   reading atoms ...
   3000 atoms
   reading velocities ...
   3000 velocities
   scanning bonds ...
   1 = max bonds/atom
   reading bonds ...
   2700 bonds
Finding 1-2 1-3 1-4 neighbors ...
   special bond factors lj: 1 1 1
   special bond factors coul: 1 1 1
   2 = max # of 1-2 neighbors
   2 = max # of special neighbors
Using type 2 for bond particles
Thermo normalization turned off by pair srp (../pair_srp.cpp:498)
!!!!!!!!!!!!!!!! INIT_LIST WAS CALLED!!!!!!!!!!!!!!!!!!!!!!Neighbor list info ...
   update every 10 steps, delay 10 steps, check yes
   max neighbors/atom: 2000, page size: 100000
   master list distance cutoff = 3
   ghost atom cutoff = 3.6
   binsize = 1.5, bins = 7 7 7
   4 neighbor lists, perpetual/occasional/extra = 3 1 0
   (1) pair dpd, perpetual, skip from (4)
       attributes: half, newton on
       pair build: skip
       stencil: none
       bin: none
   (2) pair srp, perpetual, skip from (4)
       attributes: half, newton on
       pair build: skip
       stencil: none
       bin: none
   (3) fix testtest, occasional
       attributes: full, newton on
       pair build: full/bin
       stencil: full/bin/3d
       bin: standard
   (4) neighbor class addition, perpetual
       attributes: half, newton on
       pair build: half/bin/newton
       stencil: half/bin/3d/newton
       bin: standard
Setting up Verlet run ...
   Unit style : lj
   Current step : 0
   Time step : 0.01
Removed/inserted 0/2700 bond particles. (../fix_srp.cpp:249)
Per MPI rank memory allocation (min/avg/max) = 22.76 | 22.76 | 22.76 Mbytes
Step Temp PotEng v_nPotEng Press Atoms v_natoms Lx Ly Lz
        0 0.98262092 31772.336 10.590779 60.690437 5700 3000 10 10 10
==22394== Invalid write of size 4
==22394== at 0x70C236: LAMMPS_NS::NPairFullBin::build(LAMMPS_NS::NeighList*) (npair_full_bin.cpp:115)
==22394== by 0x74A03E: LAMMPS_NS::Neighbor::build_one(LAMMPS_NS::NeighList*, int) (neighbor.cpp:2194)
==22394== by 0x85CBCB: LAMMPS_NS::FixTest::post_integrate() (fix_test.cpp:103)
==22394== by 0xAEA14F: LAMMPS_NS::Modify::post_integrate() (modify.cpp:378)
==22394== by 0xBBAC4F: LAMMPS_NS::Verlet::run(int) (verlet.cpp:248)
==22394== by 0x5FC958: LAMMPS_NS::Run::command(int, char**) (run.cpp:183)
==22394== by 0xB05444: void LAMMPS_NS::Input::command_creator<LAMMPS_NS::Run>(LAMMPS_NS::LAMMPS*, int, char**) (input.cpp:861)
==22394== by 0xAFF504: LAMMPS_NS::Input::execute_command() (input.cpp:844)
==22394== by 0xAFCB7D: LAMMPS_NS::Input::file() (input.cpp:244)
==22394== by 0xA3E1DF: main (main.cpp:44)
==22394== Address 0xea55ff0 is 0 bytes after a block of size 12,000 alloc'd
==22394== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22394== by 0x62B4A8: LAMMPS_NS::Memory::smalloc(long, char const*) (memory.cpp:58)
==22394== by 0x52B9D1: int* LAMMPS_NS::Memory::create<int>(int*&, int, char const*) (memory.h:61)
==22394== by 0x760092: LAMMPS_NS::NeighList::grow(int, int) (neigh_list.cpp:216)
==22394== by 0x744FB8: LAMMPS_NS::Neighbor::init_pair() (neighbor.cpp:832)
==22394== by 0x7412D9: LAMMPS_NS::Neighbor::init() (neighbor.cpp:483)
==22394== by 0xB42B34: LAMMPS_NS::LAMMPS::init() (lammps.cpp:718)
==22394== by 0x5FC895: LAMMPS_NS::Run::command(int, char**) (run.cpp:177)
==22394== by 0xB05444: void LAMMPS_NS::Input::command_creator<LAMMPS_NS::Run>(LAMMPS_NS::LAMMPS*, int, char**) (input.cpp:861)
==22394== by 0xAFF504: LAMMPS_NS::Input::execute_command() (input.cpp:844)
==22394== by 0xAFCB7D: LAMMPS_NS::Input::file() (input.cpp:244)
==22394== by 0xA3E1DF: main (main.cpp:44)
==22394==
==22394== Invalid write of size 8
==22394== at 0x70C253: LAMMPS_NS::NPairFullBin::build(LAMMPS_NS::NeighList*) (npair_full_bin.cpp:116)
==22394== by 0x74A03E: LAMMPS_NS::Neighbor::build_one(LAMMPS_NS::NeighList*, int) (neighbor.cpp:2194)
==22394== by 0x85CBCB: LAMMPS_NS::FixTest::post_integrate() (fix_test.cpp:103)
==22394== by 0xAEA14F: LAMMPS_NS::Modify::post_integrate() (modify.cpp:378)
==22394== by 0xBBAC4F: LAMMPS_NS::Verlet::run(int) (verlet.cpp:248)
==22394== by 0x5FC958: LAMMPS_NS::Run::command(int, char**) (run.cpp:183)
==22394== by 0xB05444: void LAMMPS_NS::Input::command_creator<LAMMPS_NS::Run>(LAMMPS_NS::LAMMPS*, int, char**) (input.cpp:861)
==22394== by 0xAFF504: LAMMPS_NS::Input::execute_command() (input.cpp:844)
==22394== by 0xAFCB7D: LAMMPS_NS::Input::file() (input.cpp:244)
==22394== by 0xA3E1DF: main (main.cpp:44)
==22394== Address 0xf3bbda0 is 0 bytes after a block of size 24,000 alloc'd
==22394== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22394== by 0x62B4A8: LAMMPS_NS::Memory::smalloc(long, char const*) (memory.cpp:58)
==22394== by 0x7600ED: LAMMPS_NS::NeighList::grow(int, int) (neigh_list.cpp:218)
==22394== by 0x744FB8: LAMMPS_NS::Neighbor::init_pair() (neighbor.cpp:832)
==22394== by 0x7412D9: LAMMPS_NS::Neighbor::init() (neighbor.cpp:483)
==22394== by 0xB42B34: LAMMPS_NS::LAMMPS::init() (lammps.cpp:718)
==22394== by 0x5FC895: LAMMPS_NS::Run::command(int, char**) (run.cpp:177)
==22394== by 0xB05444: void LAMMPS_NS::Input::command_creator<LAMMPS_NS::Run>(LAMMPS_NS::LAMMPS*, int, char**) (input.cpp:861)
==22394== by 0xAFF504: LAMMPS_NS::Input::execute_command() (input.cpp:844)
==22394== by 0xAFCB7D: LAMMPS_NS::Input::file() (input.cpp:244)
==22394== by 0xA3E1DF: main (main.cpp:44)
==22394==
:

in fact valgrind dies with a segmentation fault at the end of the output.

my fix is:

#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "fix_test.h"
#include "atom.h"
#include "force.h"
#include "pair.h"
#include "bond.h"
#include "angle.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "group.h"
#include "comm.h"
#include "domain.h"
#include "modify.h"
#include "compute.h"
#include "random_mars.h"
#include "citeme.h"
#include "memory.h"
#include "error.h"
#include "pair_hybrid.h"

#include "update.h"

using namespace LAMMPS_NS;
using namespace FixConst;

/* ---------------------------------------------------------------------- */

FixTest::FixTest(LAMMPS *lmp, int narg, char **arg) :
   Fix(lmp, narg, arg), listfull(NULL)
{
   if (narg <4) error->all(FLERR,"Illegal fix test command");

   nevery = force->inumeric(FLERR,arg[3]);
   if (nevery <= 0) error->all(FLERR,"Illegal fix bond/swap command");

   force_reneighbor = 1;
   next_reneighbor = -1;
   global_freq = 1;
   extvector = 0;

}

/* ---------------------------------------------------------------------- */

FixTest::~FixTest()
{
}

/* ---------------------------------------------------------------------- */

int FixTest::setmask()
{
   int mask = 0;
   mask |= POST_INTEGRATE;
   return mask;
}

/* ---------------------------------------------------------------------- */

void FixTest::init()
{
         // Need both full neighbor list.
         int irequest_full = neighbor->request(this,instance_me);
         neighbor->requests[irequest_full]->pair = 0;
         neighbor->requests[irequest_full]->fix = 1;
         neighbor->requests[irequest_full]->half = 0;
         neighbor->requests[irequest_full]->full = 1;
         neighbor->requests[irequest_full]->occasional= 1;
}

/* ---------------------------------------------------------------------- */

void FixTest::init_list(int id, NeighList *ptr)
{
   printf("!!!!!!!!!!!!!!!! INIT_LIST WAS CALLED!!!!!!!!!!!!!!!!!!!!!!");
   listfull=ptr;
}

void FixTest::post_integrate()
{
   if (update->ntimestep % nevery) return;

   if (!listfull) error->all(FLERR,"listfull null");
   neighbor->build_one(listfull,1);

// now do something here

}

/* ---------------------------------------------------------------------- */

int FixTest::modify_param(int narg, char **arg)
{
   return 0;
}

Hi Carsten - if I understand:

a) if you run 31Mar LAMMPS as-is with the in.srp

example there are no valgrind issues.

b) if you add your dummy fix you get the errors,

all it does is ask for an occasional full list

and build it

c) fix bond/create or swap also ask for an occasional

half list - if you add a command for those (intead of (b)

and do a run 0 - do you get any errors?

d) if you modify fix bond/create or swap to ask

for a full occasional list and do the © test

do you get any errors - in that case I think

the output of the “Neighbor list info” section

to the screen should be identical to your test (b)

e) there are computes that ask for an occasional full

list, like compute coord/atom - if you add one

of those to your (a) script and insure it gets

invoked on step 0, e.g. by outputtuing something

about it with thermo output or to a dump file,

can you reproduce the errors in (b) - again

the Neighbor list info section should be identical

Steve

Dear Steve, CC list,

Thanks for looking into this!

I can reproduce the memory issues with both occasional/half and full lists with fixes as well as computes for DPD/SRP. I tried my dummy fix together with plain DPD pair style, and it worked as expected.

If you are interested, then I can provide full lammps and valgrind output for the cases below as a tar.gz.

a) if you run 31Mar LAMMPS as-is with the in.srp
example there are no valgrind issues.

There are no issues.

b) if you add your dummy fix you get the errors,
    all it does is ask for an occasional full list
    and build it

yes.

b') If I do run 0 and then define my dummy fix afterwards and do a run, then valgrind does not report errors.

b'') If I do b, but run plain DPD pair-style together with my dummy fix, then no warnings are generated.

c) fix bond/create or swap also ask for an occasional
    half list - if you add a command for those (intead of (b)
    and do a run 0 - do you get any errors?

I added bond/create with very small distance criterion such that no bonds are created.

As in b', no errors.

c') run 200 instead. Then valgrind does reports errors:

==7523== Invalid write of size 4
==7523== at 0xB24F6D: LAMMPS_NS::NPairHalfBinNewton::build(LAMMPS_NS::NeighList*) (npair_half_bin_newton.cpp:152)
==7523== by 0x74A03E: LAMMPS_NS::Neighbor::build_one(LAMMPS_NS::NeighList*, int) (neighbor.cpp:2194)
==7523== by 0x5D453A: LAMMPS_NS::FixBondCreate::post_integrate() (fix_bond_create.cpp:379)
==7523== by 0xAEA14F: LAMMPS_NS::Modify::post_integrate() (modify.cpp:378)
==7523== by 0xBBAC4F: LAMMPS_NS::Verlet::run(int) (verlet.cpp:248)
==7523== by 0x5FC958: LAMMPS_NS::Run::command(int, char**) (run.cpp:183)
==7523== by 0xB05444: void LAMMPS_NS::Input::command_creator<LAMMPS_NS::Run>(LAMMPS_NS::LAMMPS*, int, char**) (input.cpp:861)
==7523== by 0xAFF504: LAMMPS_NS::Input::execute_command() (input.cpp:844)
==7523== by 0xAFCB7D: LAMMPS_NS::Input::file() (input.cpp:244)
==7523== by 0xA3E1DF: main (main.cpp:44)
==7523== Address 0xea5c4c0 is 0 bytes after a block of size 12,000 alloc'd
==7523== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7523== by 0x62B4A8: LAMMPS_NS::Memory::smalloc(long, char const*) (memory.cpp:58)
==7523== by 0x52B9D1: int* LAMMPS_NS::Memory::create<int>(int*&, int, char const*) (memory.h:61)
==7523== by 0x760092: LAMMPS_NS::NeighList::grow(int, int) (neigh_list.cpp:216)
==7523== by 0x744FB8: LAMMPS_NS::Neighbor::init_pair() (neighbor.cpp:832)
==7523== by 0x7412D9: LAMMPS_NS::Neighbor::init() (neighbor.cpp:483)
==7523== by 0xB42B34: LAMMPS_NS::LAMMPS::init() (lammps.cpp:718)
==7523== by 0x5FC895: LAMMPS_NS::Run::command(int, char**) (run.cpp:177)
==7523== by 0xB05444: void LAMMPS_NS::Input::command_creator<LAMMPS_NS::Run>(LAMMPS_NS::LAMMPS*, int, char**) (input.cpp:861)
==7523== by 0xAFF504: LAMMPS_NS::Input::execute_command() (input.cpp:844)
==7523== by 0xAFCB7D: LAMMPS_NS::Input::file() (input.cpp:244)
==7523== by 0xA3E1DF: main (main.cpp:44)
:

The neighbor info is:
   (1) pair dpd, perpetual, skip from (4)
       attributes: half, newton on
       pair build: skip
       stencil: none
       bin: none
   (2) pair srp, perpetual, skip from (4)
       attributes: half, newton on
       pair build: skip
       stencil: none
       bin: none
   (3) fix bond/create, occasional
       attributes: full, newton on
       pair build: full/bin
       stencil: full/bin/3d
       bin: standard
   (4) neighbor class addition, perpetual
       attributes: half, newton on
       pair build: half/bin/newton
       stencil: half/bin/3d/newton
       bin: standard

d) if you modify fix bond/create or swap to ask
    for a full occasional list and do the (c) test
    do you get any errors - in that case I think
    the output of the "Neighbor list info" section
    to the screen should be identical to your test (b)

Yes. The neighbor list info is identical to b.

No errors with run 0.

d') run 200 instead. Then valgrind does reports errors:

==8113== Invalid write of size 4
==8113== at 0x70C2A4: LAMMPS_NS::NPairFullBin::build(LAMMPS_NS::NeighList*) (npair_full_bin.cpp:115)
==8113== by 0x74A0AC: LAMMPS_NS::Neighbor::build_one(LAMMPS_NS::NeighList*, int) (neighbor.cpp:2194)
==8113== by 0x5D4592: LAMMPS_NS::FixBondCreate::post_integrate() (fix_bond_create.cpp:382)
==8113== by 0xAEA1A7: LAMMPS_NS::Modify::post_integrate() (modify.cpp:378)
==8113== by 0xBBACA7: LAMMPS_NS::Verlet::run(int) (verlet.cpp:248)
==8113== by 0x5FCD5E: LAMMPS_NS::Run::command(int, char**) (run.cpp:183)
==8113== by 0xB0549C: void LAMMPS_NS::Input::command_creator<LAMMPS_NS::Run>(LAMMPS_NS::LAMMPS*, int, char**) (input.cpp:861)
==8113== by 0xAFF55C: LAMMPS_NS::Input::execute_command() (input.cpp:844)
==8113== by 0xAFCBD5: LAMMPS_NS::Input::file() (input.cpp:244)
==8113== by 0xA3E5E5: main (main.cpp:44)
==8113== Address 0xea525f0 is 0 bytes after a block of size 12,000 alloc'd
==8113== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8113== by 0x82F088: LAMMPS_NS::Memory::smalloc(long, char const*) (memory.cpp:58)
==8113== by 0x52B9D1: int* LAMMPS_NS::Memory::create<int>(int*&, int, char const*) (memory.h:61)
==8113== by 0x760100: LAMMPS_NS::NeighList::grow(int, int) (neigh_list.cpp:216)
==8113== by 0x745026: LAMMPS_NS::Neighbor::init_pair() (neighbor.cpp:832)
==8113== by 0x741347: LAMMPS_NS::Neighbor::init() (neighbor.cpp:483)
==8113== by 0xB42B8C: LAMMPS_NS::LAMMPS::init() (lammps.cpp:718)
==8113== by 0x5FCC9B: LAMMPS_NS::Run::command(int, char**) (run.cpp:177)
==8113== by 0xB0549C: void LAMMPS_NS::Input::command_creator<LAMMPS_NS::Run>(LAMMPS_NS::LAMMPS*, int, char**) (input.cpp:861)
==8113== by 0xAFF55C: LAMMPS_NS::Input::execute_command() (input.cpp:844)
==8113== by 0xAFCBD5: LAMMPS_NS::Input::file() (input.cpp:244)
==8113== by 0xA3E5E5: main (main.cpp:44)

Neighbor info:
   (1) pair dpd, perpetual, skip from (4)
       attributes: half, newton on
       pair build: skip
       stencil: none
       bin: none
   (2) pair srp, perpetual, skip from (4)
       attributes: half, newton on
       pair build: skip
       stencil: none
       bin: none
   (3) fix bond/create, occasional
       attributes: full, newton on
       pair build: full/bin
       stencil: full/bin/3d
       bin: standard
   (4) neighbor class addition, perpetual
       attributes: half, newton on
       pair build: half/bin/newton
       stencil: half/bin/3d/newton
       bin: standard

e) there are computes that ask for an occasional full
    list, like compute coord/atom - if you add one
    of those to your (a) script and insure it gets
    invoked on step 0, e.g. by outputtuing something
    about it with thermo output or to a dump file,
    can you reproduce the errors in (b) - again
    the Neighbor list info section should be identical

I do compute .coord/atom 0.01 1 and reduce this to a global scalar, which I print out with thermo output.

With run 0 LAMMPS crashes, and the valgrind report:

==8700== Invalid write of size 4
==8700== at 0x70C2A4: LAMMPS_NS::NPairFullBin::build(LAMMPS_NS::NeighList*) (npair_full_bin.cpp:115)
==8700== by 0x74A0AC: LAMMPS_NS::Neighbor::build_one(LAMMPS_NS::NeighList*, int) (neighbor.cpp:2194)
==8700== by 0xA871FC: LAMMPS_NS::ComputeCoordAtom::compute_peratom() (compute_coord_atom.cpp:200)
==8700== by 0x71BF72: LAMMPS_NS::ComputeReduce::compute_one(int, int) (compute_reduce.cpp:505)
==8700== by 0x71AFCA: LAMMPS_NS::ComputeReduce::compute_scalar() (compute_reduce.cpp:365)
==8700== by 0x6BC003: LAMMPS_NS::Thermo::compute(int) (thermo.cpp:351)
==8700== by 0x8863D5: LAMMPS_NS::Output::setup(int) (output.cpp:272)
==8700== by 0xBBA44F: LAMMPS_NS::Verlet::setup() (verlet.cpp:151)
==8700== by 0x5FCCD4: LAMMPS_NS::Run::command(int, char**) (run.cpp:178)
==8700== by 0xB0549C: void LAMMPS_NS::Input::command_creator<LAMMPS_NS::Run>(LAMMPS_NS::LAMMPS*, int, char**) (input.cpp:861)
==8700== by 0xAFF55C: LAMMPS_NS::Input::execute_command() (input.cpp:844)
==8700== by 0xAFCBD5: LAMMPS_NS::Input::file() (input.cpp:244)
==8700== Address 0xea55dc0 is 0 bytes after a block of size 12,000 alloc'd
==8700== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8700== by 0x82F088: LAMMPS_NS::Memory::smalloc(long, char const*) (memory.cpp:58)
==8700== by 0x52B9D1: int* LAMMPS_NS::Memory::create<int>(int*&, int, char const*) (memory.h:61)
==8700== by 0x760100: LAMMPS_NS::NeighList::grow(int, int) (neigh_list.cpp:216)
==8700== by 0x745026: LAMMPS_NS::Neighbor::init_pair() (neighbor.cpp:832)
==8700== by 0x741347: LAMMPS_NS::Neighbor::init() (neighbor.cpp:483)
==8700== by 0xB42B8C: LAMMPS_NS::LAMMPS::init() (lammps.cpp:718)
==8700== by 0x5FCC9B: LAMMPS_NS::Run::command(int, char**) (run.cpp:177)
==8700== by 0xB0549C: void LAMMPS_NS::Input::command_creator<LAMMPS_NS::Run>(LAMMPS_NS::LAMMPS*, int, char**) (input.cpp:861)
==8700== by 0xAFF55C: LAMMPS_NS::Input::execute_command() (input.cpp:844)
==8700== by 0xAFCBD5: LAMMPS_NS::Input::file() (input.cpp:244)
==8700== by 0xA3E5E5: main (main.cpp:44)
==8700==
==8700== Invalid write of size 8

Neighbor lists:
   (1) pair dpd, perpetual, skip from (4)
       attributes: half, newton on
       pair build: skip
       stencil: none
       bin: none
   (2) pair srp, perpetual, skip from (4)
       attributes: half, newton on
       pair build: skip
       stencil: none
       bin: none
   (3) compute coord/atom, occasional
       attributes: full, newton on
       pair build: full/bin
       stencil: full/bin/3d
       bin: standard
   (4) neighbor class addition, perpetual
       attributes: half, newton on
       pair build: half/bin/newton
       stencil: half/bin/3d/newton
       bin: standard

And as before, if I do run 0, and then define the compute and do a short run it works and valgrind does not report any errors.

For completeness, compute rdf creates a occational/half list, hence I tried that too, using ave/time to output the result:

==9134== at 0xB24FC5: LAMMPS_NS::NPairHalfBinNewton::build(LAMMPS_NS::NeighList*) (npair_half_bin_newton.cpp:152)
==9134== by 0x74A0AC: LAMMPS_NS::Neighbor::build_one(LAMMPS_NS::NeighList*, int) (neighbor.cpp:2194)
==9134== by 0x592AB4: LAMMPS_NS::ComputeRDF::compute_array() (compute_rdf.cpp:260)
==9134== by 0xA9F195: LAMMPS_NS::FixAveTime::invoke_vector(long) (fix_ave_time.cpp:783)
==9134== by 0xA9DF44: LAMMPS_NS::FixAveTime::end_of_step() (fix_ave_time.cpp:551)
==9134== by 0xA9DE7D: LAMMPS_NS::FixAveTime::setup(int) (fix_ave_time.cpp:534)
==9134== by 0xAE9A13: LAMMPS_NS::Modify::setup(int) (modify.cpp:296)
==9134== by 0xBBA437: LAMMPS_NS::Verlet::setup() (verlet.cpp:150)
==9134== by 0x5FCCD4: LAMMPS_NS::Run::command(int, char**) (run.cpp:178)
==9134== by 0xB0549C: void LAMMPS_NS::Input::command_creator<LAMMPS_NS::Run>(LAMMPS_NS::LAMMPS*, int, char**) (input.cpp:861)
==9134== by 0xAFF55C: LAMMPS_NS::Input::execute_command() (input.cpp:844)
==9134== by 0xAFCBD5: LAMMPS_NS::Input::file() (input.cpp:244)
==9134== Address 0xea55fa0 is 0 bytes after a block of size 12,000 alloc'd
==9134== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9134== by 0x82F088: LAMMPS_NS::Memory::smalloc(long, char const*) (memory.cpp:58)
==9134== by 0x52B9D1: int* LAMMPS_NS::Memory::create<int>(int*&, int, char const*) (memory.h:61)
==9134== by 0x760100: LAMMPS_NS::NeighList::grow(int, int) (neigh_list.cpp:216)
==9134== by 0x745026: LAMMPS_NS::Neighbor::init_pair() (neighbor.cpp:832)
==9134== by 0x741347: LAMMPS_NS::Neighbor::init() (neighbor.cpp:483)
==9134== by 0xB42B8C: LAMMPS_NS::LAMMPS::init() (lammps.cpp:718)
==9134== by 0x5FCC9B: LAMMPS_NS::Run::command(int, char**) (run.cpp:177)
==9134== by 0xB0549C: void LAMMPS_NS::Input::command_creator<LAMMPS_NS::Run>(LAMMPS_NS::LAMMPS*, int, char**) (input.cpp:861)
==9134== by 0xAFF55C: LAMMPS_NS::Input::execute_command() (input.cpp:844)
==9134== by 0xAFCBD5: LAMMPS_NS::Input::file() (input.cpp:244)
==9134== by 0xA3E5E5: main (main.cpp:44)

Neighborlists:
   (1) pair dpd, perpetual, skip from (4)
       attributes: half, newton on
       pair build: skip
       stencil: none
       bin: none
   (2) pair srp, perpetual, skip from (4)
       attributes: half, newton on
       pair build: skip
       stencil: none
       bin: none
   (3) compute rdf, occasional
       attributes: half, newton on
       pair build: half/bin/newton
       stencil: half/bin/3d/newton
       bin: standard
   (4) neighbor class addition, perpetual
       attributes: half, newton on
       pair build: half/bin/newton
       stencil: half/bin/3d/newton
       bin: standard

Addendum.

The neighbor build error seems specific to simulations that adds particles during a simulation.

To check if this was DPD/SRP specific, I used in.srp as a model and added 1000 randomly distributed type 2 particles to approximate the DPD/SRP systems, but replacing pair interactions with

pair_style hybrid dpd 1.0 1.0 373692 zero 0.8
pair_coeff 1 1 dpd 60.0 4.5 1.0
pair_coeff 1 2 none
pair_coeff 2 2 zero
neigh_modify exclude type 1 2

and added fixes and computes to check all neighbor lists combinations. This runs fine without valgrind reporting any memory issues.

Now using the same pair style as above, but inserting the particles during the simulation with

fix dep all deposit 10 2 10 235245 region box

Again all computes and fixes did invalid writes. Heres the first one:

==10850== Invalid write of size 4
==10850== at 0x70C24C: LAMMPS_NS::NPairFullBin::build(LAMMPS_NS::NeighList*) (npair_full_bin.cpp:115)
==10850== by 0x74A054: LAMMPS_NS::Neighbor::build_one(LAMMPS_NS::NeighList*, int) (neighbor.cpp:2194)
==10850== by 0xA871A4: LAMMPS_NS::ComputeCoordAtom::compute_peratom() (compute_coord_atom.cpp:200)
==10850== by 0x71BF1A: LAMMPS_NS::ComputeReduce::compute_one(int, int) (compute_reduce.cpp:505)
==10850== by 0x71AF72: LAMMPS_NS::ComputeReduce::compute_scalar() (compute_reduce.cpp:365)
==10850== by 0x6BBFAB: LAMMPS_NS::Thermo::compute(int) (thermo.cpp:351)
==10850== by 0x886C61: LAMMPS_NS::Output::write(long) (output.cpp:383)
==10850== by 0xBBB45D: LAMMPS_NS::Verlet::run(int) (verlet.cpp:341)
==10850== by 0x5FCD06: LAMMPS_NS::Run::command(int, char**) (run.cpp:183)
==10850== by 0xB05444: void LAMMPS_NS::Input::command_creator<LAMMPS_NS::Run>(LAMMPS_NS::LAMMPS*, int, char**) (input.cpp:861)
==10850== by 0xAFF504: LAMMPS_NS::Input::execute_command() (input.cpp:844)
==10850== by 0xAFCB7D: LAMMPS_NS::Input::file() (input.cpp:244)
==10850== Address 0xea533b0 is 0 bytes after a block of size 12,000 alloc'd
==10850== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==10850== by 0x82F030: LAMMPS_NS::Memory::smalloc(long, char const*) (memory.cpp:58)
==10850== by 0x52B9D1: int* LAMMPS_NS::Memory::create<int>(int*&, int, char const*) (memory.h:61)
==10850== by 0x7600A8: LAMMPS_NS::NeighList::grow(int, int) (neigh_list.cpp:216)
==10850== by 0x744FCE: LAMMPS_NS::Neighbor::init_pair() (neighbor.cpp:832)
==10850== by 0x7412EF: LAMMPS_NS::Neighbor::init() (neighbor.cpp:483)
==10850== by 0xB42B34: LAMMPS_NS::LAMMPS::init() (lammps.cpp:718)
==10850== by 0x5FCC43: LAMMPS_NS::Run::command(int, char**) (run.cpp:177)
==10850== by 0xB05444: void LAMMPS_NS::Input::command_creator<LAMMPS_NS::Run>(LAMMPS_NS::LAMMPS*, int, char**) (input.cpp:861)
==10850== by 0xAFF504: LAMMPS_NS::Input::execute_command() (input.cpp:844)
==10850== by 0xAFCB7D: LAMMPS_NS::Input::file() (input.cpp:244)
==10850== by 0xA3E58D: main (main.cpp:44)

Neighbor info:

   (1) pair dpd, perpetual, skip from (7)
       attributes: half, newton on
       pair build: skip
       stencil: none
       bin: none
   (2) pair zero, perpetual, skip from (7)
       attributes: half, newton on
       pair build: skip
       stencil: none
       bin: none
   (3) fix testtest, occasional
       attributes: full, newton on
       pair build: full/bin
       stencil: full/bin/3d
       bin: standard
   (4) fix bond/create, occasional
       attributes: half, newton on
       pair build: half/bin/newton
       stencil: half/bin/3d/newton
       bin: standard
   (5) compute coord/atom, occasional
       attributes: full, newton on
       pair build: full/bin
       stencil: full/bin/3d
       bin: standard
   (6) compute rdf, occasional
       attributes: half, newton on
       pair build: half/bin/newton
       stencil: half/bin/3d/newton
       bin: standard
   (7) neighbor class addition, perpetual
       attributes: half, newton on
       pair build: half/bin/newton
       stencil: half/bin/3d/newton
       bin: standard

yes, please send me a tarball with a simple-as-possible

(1 core?) example of a model that gives valgrind

and neighbor list issues. I.e. standard LAMMPS, none

of your custom code, small system, short as run as possible,

etc.

You can just send it to me directly and to Axel if

he wants to take a look.

Thanks,

Steve