Pouring multiple molecules

Hello all,

I am simulating granular molecules being first poured into a periodic box, and then compressed. I have been having a lot of trouble with differences between the Windows, Linux and Mac versions of LAMMPS, but I have found one in particular that I cannot seem to find a workaround for.

I want to pour first spheres, and then a granular molecule “m1” and then a second granular molecule “m2.” In the Mac version of LAMMPS, I can accomplish this with the following commands:

molecule m1 molecule1.shape
group mol1_group type molecule m1
fix rm1 mol1_group rigid/small molecule mol m1

molecule m2 molecule2.shape
group mol2_group type molecule m2
fix rm2 mol2_group rigid/small molecule mol m2

I can then pour these molecules later. Initially, each group has 0 members, and only acquires them as I pour them into the box. For my second molecule, I do the same thing, first making a group with 0 members and then fixing this group “rigid/small” and then pouring later.

This procedure only works on the Mac version, and not the Windows or Linux versions. I cannot seem to use create_atoms and then fix this rigid as a molecule either.

How can I pour multiple granular molecules, defined by multiple molecule files and fix rigid/small, into the same box? I cannot figure this out. Any help would be greatly appreciated.

Thank you very much,

Leah Roth

Hello all,

I am simulating granular molecules being first poured into a periodic box,
and then compressed. I have been having a lot of trouble with differences
between the Windows, Linux and Mac versions of LAMMPS, but I have found one
in particular that I cannot seem to find a workaround for.

I want to pour first spheres, and then a granular molecule "m1" and then a
second granular molecule "m2." In the Mac version of LAMMPS, I can
accomplish this with the following commands:

molecule m1 molecule1.shape
group mol1_group type molecule m1
fix rm1 mol1_group rigid/small molecule mol m1

molecule m2 molecule2.shape
group mol2_group type molecule m2
fix rm2 mol2_group rigid/small molecule mol m2

I can then pour these molecules later. Initially, each group has 0 members,
and only acquires them as I pour them into the box. For my second molecule,
I do the same thing, first making a group with 0 members and then fixing
this group "rigid/small" and then pouring later.

This procedure only works on the Mac version, and not the Windows or Linux
versions. I cannot seem to use create_atoms and then fix this rigid as a
molecule either.

How can I pour multiple granular molecules, defined by multiple molecule
files and fix rigid/small, into the same box? I cannot figure this out. Any
help would be greatly appreciated.

first of all, more important whether you run on Mac, Linux, or Windows
is to know the exact version of LAMMPS you are using (should be a
date). all versions for the different platforms are built from the
exact same source code and thus should result in the exact same
behavior. if this is not the case, then this is likely a bug or a
porting issues, and then please produce a *minimal* input example that
can be used to reproduce the discrepancy.

second, your description is far too vague and thus it is impossible to
help you. rather than writing "i cannot make it work", you should
provide the exact (and complete!) lammps input that you are using,
explain what you expect to happen from the documentation and show what
you get instead (error message, image or other indication that things
did not work as expected).

third, as a point of reference, the group commands in your input is
incorrect. it should produce an error message like this.

ERROR: Expected integer parameter in input script or data file

so if this works, it works by chance and because the LAMMPS version
you have on the mac being old (i.e. before we updated the code in the
group command to more carefully checknot by construction). this also
hints at the fact, that you haven't studied the documentation
carefully enough. what the group command on the mac actually does
execute is the same as: group mol1_group type 0

axel.

Hi Axel,

Thank you for your input. My question was: How can I “fix pour” multiple molecules, with different molecule files, into the same box?

More specifically: How can I group molecules, that do not exist yet, to apply the fix rigid/small command properly? I cannot “fix pour” molecules until I have fixed them rigid. I cannot fix them rigid until I have a group of molecules. How should I be grouping different molecules?

It very well may be that it is a coincidence that this line worked with my older version, I am indeed getting the error you quoted, and I have looked at the documentation. I still do not know how to pour multiple granular molecules, as I have seen nothing in the documentation that pertains to this.

Thank you again,

Leah Roth

As far as the LAMMPS input script, the relevant section was included in the first email. Here it is more fully:

molecule s2 molecule2.shape
group mol2 type molecule s2
fix rs2 mol2 rigid/small molecule mol s2

fix ins2 all pour 100 0 ${rand1} region slab1 mol s2 rigid rs2

And then later in the script:

molecule imp impact.shape
group imp_grp type molecule imp
fix imp_rs imp_grp rigid/small molecule mol imp

fix imp_dump all pour 1 0 27 region impact_reg mol imp rigid imp_rs

Hi Axel,

Thank you for your input. My question was: How can I "fix pour" multiple
molecules, with different molecule files, into the same box?

More specifically: How can I group molecules, that do not exist yet, to
apply the fix rigid/small command properly? I cannot "fix pour" molecules
until I have fixed them rigid. I cannot fix them rigid until I have a group
of molecules. How should I be grouping different molecules?

It very well may be that it is a coincidence that this line worked with my
older version, I am indeed getting the error you quoted, and I have looked
at the documentation. I still do not know how to pour multiple granular
molecules, as I have seen nothing in the documentation that pertains to
this.

everything you need to know *is* in the documentation. the problem is
that your thinking is backwards.

fix pour will add atoms to its fix group; the fix pour documentation
clearly states that.
so just create a group, even if it is an empty group, which is what
your incorrect group command is doing by accident on the mac.

fix rigid (or fix rigid/small) may also be applied to an empty group,
but in that case, it is required that you create those objects via a
molecule template. this is also clearly explained in the fix rigid
documentation and you seem to be doing that.

so, where exactly is the problem? if you get error messages, you will
normally get them because your input is wrong, then you have to
understand those errors and resolve them. if the error is in conflict
with the documentation, then you should demonstrate this and explain
exactly where the documentation is not respected.

it is not the job of the mailing list people to write and debug your
inputs for you.

axel.

As far as the LAMMPS input script, the relevant section was included in the
first email. Here it is more fully:

molecule s2 molecule2.shape
group mol2 type molecule s2
fix rs2 mol2 rigid/small molecule mol s2
fix ins2 all pour 100 0 ${rand1} region slab1 mol s2 rigid rs2

And then later in the script:

molecule imp impact.shape
group imp_grp type molecule imp
fix imp_rs imp_grp rigid/small molecule mol imp
fix imp_dump all pour 1 0 27 region impact_reg mol imp rigid
imp_rs

as i already mentioned. your group command is incorrect. you have to
correct it. RTFM!

axel.

Hi Axel,

I am not asking this mailing list to correct my input script. I simply do not understand how my group command is wrong. I would appreciate it if you could tell me what is wrong with it.

In the documentation for the group command, it says

“The include style with its arg molecule adds atoms to a group that have the same molecule ID as atoms already in the group. The molecule ID = 0 is ignored in this operation, since it is assumed to flag isolated atoms that are not part of molecules”

How is my command wrong? I define a molecule with a molecule ID, “s2” or “imp,” and then I define a group with molecule id “s2.” I do not understand what the issue is.

Thank you,

Leah

Hi Axel,

I am not asking this mailing list to correct my input script. I simply do
not understand how my group command is wrong. I would appreciate it if you
could tell me what is wrong with it.

In the documentation for the group command, it says

"The include style with its arg molecule adds atoms to a group that have the
same molecule ID as atoms already in the group. The molecule ID = 0 is
ignored in this operation, since it is assumed to flag isolated atoms that
are not part of molecules"

but you are *not* using this option (there is no "include" and it
doesn't apply here anyway).

How is my command wrong? I define a molecule with a molecule ID, "s2" or
"imp," and then I define a group with molecule id "s2." I do not understand
what the issue is.

your s2 is *not* a molecule id. a molecule id is a number that is a
per-atom property.
your s2 is a "label" for an entity defined with the molecule command.

in any case, as i already explained, all you need to do, is to define
an *empty* group.
...and i also *already* explained to you, that what your incorrect
group command does, is the same as "group mol2 type 0", which will
define an empty group, since you won't have any atoms of type 0,
right?

so rather than complaining that you don't understand and that LAMMPS
doesn't do what you want it to do.
why don't take a deep breath. put aside all your confusion and anger,
and resolve this by starting from scratch and do so step by step
without making any guesses or assumptions, but very carefully going
over what the documentation says. and it says, that the third argument
has to be the "style" which can be only one of delete or region or
type or id or molecule or variable or include or subtract or union or
intersect or dynamic or static.

your proposed group command has two of those, type and molecule. that
*cannot* be correct. that is it.

as i said before, you have to *understand* errors, and not just say
they make no sense to you. LAMMPS is a computer program and doesn't
have common sense, it doesn't assign a meaning to things, it blindly
follows what it is programmed to do, i.e. processes the input text
line by line, chunk by chunk as it is written.

axel.

Hi Axel,

It is clear that these emails are becoming tiresome to you.

In the documentation, a “sphere” molecule template can contain the following properties:

atom-ID atom-type diameter density x y z

It does not have a molecule-ID attribute, unlike some of the other molecules in other atom styles. Can I define this property for a sphere molecule? Otherwise, I could define this group based on atom ID, but that is not ideal.

Thank you,

Leah

Leah - you appear to be getting confused over what LAMMPS calls
“IDs”. Atoms are assigned IDs. They are integer numbers.
Ditto for molecule IDs for individual molecules. Hence the group
command for its “molecule” options takes one or more molecule
IDs, which have to be numbers.

The “molecule” command reads
in and defines a “molecule template”, which is not an individual
molecule. It is a template which allow for creation of
many molecules, e.g. via the fix pour command. The template
has an ID, which (like the IDs for fix or compute commands) can
be any string. It could be a number or a word like “foo”.
So the fix pour command takes that template ID as an argument.

The template file defines the atoms within the molecule template.
Each of those atoms has an ID (the atom-ID in your last email),
which is a number from 1 to N for the atoms in the template. When
a molecule is created those IDs will be converted into atom IDs
that do not overlap with atoms already in the LAMMPS simulation.
There is no molecule ID (a number) for the template itself. When
a new molecule is created (e.g. via fix pour), using the template,
that molecule will be assigned a numeric ID, which again
will not overlap with molecules already in the LAMMPS simulation.

Steve

Hi Steve,

Thank you very much for answering my question. I had been confusing the “molecule template ID” with the molecule ID.

Again, I appreciate you taking the time to respond.

Many thanks,

Leah