question on using molecule template with fixes

Hello! I’m trying to use fix langevin with a group that contains molecules. I used this exact same code but with atoms instead of molecules and it worked just fine. I’m reading a nanotube geometry from one file and then creating molecules with a molecule template. Am I using some commands that shouldn’t be used together? I’m rather lost at debugging. I get no error messages but the molecules disappear after the first frame. Please see the input file, nanotube structure file and molecule template attached.

Thank you,

Vera.

in.absorbing (2.66 KB)

nanotube.data (84.8 KB)

molecule.template (243 Bytes)

Hello! I'm trying to use fix langevin with a group that contains molecules.
I used this exact same code but with atoms instead of molecules and it
worked just fine. I'm reading a nanotube geometry from one file and then
creating molecules with a molecule template. Am I using some commands that
shouldn't be used together? I'm rather lost at debugging. I get no error
messages but the molecules disappear after the first frame. Please see the
input file, nanotube structure file and molecule template attached.

which version of LAMMPS are you using?

i do get an error, which hints at a bug in the create_box command.
i'll be looking into it tomorrow.
but you also need to make at least one change to your input. your
create_box command should be:

create_box 4 all bond/types 1 extra/bond/per/atom 1 extra/special/per/atom 2

and you can simplify your molecule template to (for atom style full,
the mass of atoms is defined per atom type via the mass command):

# template molecule

3 atoms
2 bonds

Coords

1 -11.0000 0.0000 0.0000
2 0.0000 0.0000 0.0000
3 11.0000 0.0000 0.0000

Types

1 2
2 3
3 4

Bonds

1 1 1 2
2 1 2 3

more later,
     axel.

vera,

i found a workaround already. please try the one-line change indicated
below and recompile your LAMMPS executable.
this is a bit of a ticklish part of the code, though, so i will have
to discuss with the other developers, whether this is the correct
solution.

there are a bunch of other issues with your input, though related to
your model, not a problem of LAMMPS as such.
for the kind of system you have, you should not use: thermo_modify lost ignore
if you cannot run without losing atoms, something is wrong. ignoring
bad things doesn't make them go away.
also, since you reset all masses to 1.0, a timestep of 200 is *far*
too large. something in the neighborhood of 0.2 is more likely. also
your neighbor list parameters seem to be chosen for a dense system
with reduced units.

axel.

diff --git a/src/create_box.cpp b/src/create_box.cpp
index 94a11c1..c7fd98b 100644
--- a/src/create_box.cpp
+++ b/src/create_box.cpp
@@ -158,7 +158,7 @@ void CreateBox::command(int narg, char **arg)
       iarg += 2;
     } else if (strcmp(arg[iarg],"extra/special/per/atom") == 0) {
       if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command");
- atom->maxspecial = force->inumeric(FLERR,arg[iarg+1]);
+ force->special_extra = force->inumeric(FLERR,arg[iarg+1]);
       iarg += 2;
     } else error->all(FLERR,"Illegal create_box command");
   }

Thank you for the comments. I am not sure what I should do with this piece of code that you send me. Where do I have to include it?
Also, I’m using thermo_modify lost ignore because I want to see the diffusion of particles through a pore into free space, so I want them to be absorbed and “lost” on the opposite side of the box.

Thank you for the comments. I am not sure what I should do with this piece
of code that you send me. Where do I have to include it?

as a reference, here is the "patch" again:

diff --git a/src/create_box.cpp b/src/create_box.cpp
index 94a11c1..c7fd98b 100644
--- a/src/create_box.cpp
+++ b/src/create_box.cpp
@@ -158,7 +158,7 @@ void CreateBox::command(int narg, char **arg)
       iarg += 2;
     } else if (strcmp(arg[iarg],"extra/special/per/atom") == 0) {
       if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command");
- atom->maxspecial = force->inumeric(FLERR,arg[iarg+1]);
+ force->special_extra = force->inumeric(FLERR,arg[iarg+1]);
       iarg += 2;
     } else error->all(FLERR,"Illegal create_box command");

the way to read this is as follows:
in your folder with the lammps source should be a folder "src" and in
there a file "create_box.cpp".
load this file into a text editor. go to somewhere near line 158 and
search for a line with:

atom->maxspecial = force->inumeric(FLERR,arg[iarg+1]);

and replace it with the line

force->special_extra = force->inumeric(FLERR,arg[iarg+1]);

then recompile LAMMPS and try with the new executabl.

Also, I'm using thermo_modify lost ignore because I want to see the
diffusion of particles through a pore into free space, so I want them to be
absorbed and "lost" on the opposite side of the box.

that is fine for your production simulation, but before you do that,
you can set select periodic boundaries, or add a reflective wall and
run without that. thermo_modify lost ignore will hide a *lot* of
problems. esstentially, you'll lose atoms for the wrong reason. ...and
that is very bad. you should first find settings so that the
simulation works without and then switch to the final configuration,
open the system and turn the ignoring on.

axel.

Hi! Thank you for the fix! I tried to follow your advice - excluded thermo_modify lost ignore and tried to run just the molecules with langevin fix. Without langevin fix, using just fix nve, the simulation runs just fine, but with the langevin fix it eventually becomes unstable and crashes. Would you know why? I’m attaching the input files. I’m using 14May16 release.

Thank you,

Vera.

in.absorbing_test (2.57 KB)

molecule_2.template (132 Bytes)

Hi! Thank you for the fix! I tried to follow your advice - excluded
thermo_modify lost ignore and tried to run just the molecules with langevin
fix. Without langevin fix, using just fix nve, the simulation runs just
fine, but with the langevin fix it eventually becomes unstable and crashes.
Would you know why? I'm attaching the input files. I'm using 14May16
release.

crashes with what error message? how long is "eventually"?

your input crashes for me already at the beginning of the input during
minimization, since fix wall reflect cannot work with minimization and
atoms are lost.

axel.

Hi! I took away “fix wall reflect” and made all the boundaries periodic, but it still crashes after some steps. These are the last ones:
2131000 299.79494 -28.22065 0 122.20737 -353.1665
2132000 1806.5467 -28.222606 0 878.24776 6038.0749
2133000 inf -28.168772 0 inf inf
ERROR on proc 0: Non-numeric positions - simulation unstable (…/neighbor.cpp:2079)
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0

I’m attaching the input files.

Vera.

in.absorbing_test (2.51 KB)

molecule_2.template (132 Bytes)

over 2 million steps is quite a bit. this looks like some bad
interaction is happening somewhere.
that is usually the consequence of a bad force field parameters or too
large a time step.
you can visualize your simulation trajectory (you need to record often
enough, though) and see what is happening. i would expect some atoms
suddenly moving very fast.

axel.