[lammps-users] Select molecules in region

Hi everyone,

Has somebody some ideas how can I select all molecules in a region (which have center of mass in a region)? Command “group region” works only for atoms and “group molecule” woks with ID-molecules.

Best regards, Konstantin

Hi everyone,
Has somebody some ideas how can I select all molecules in a region (which
have center of mass in a region)? Command "group region" works only for
atoms and "group molecule" woks with ID-molecules.

i guess you'll have to get your hands dirty and extend the group
class to support this kind of setup. it is going to be a bit tricky,
because depending on the size of the molecule its atoms may
be distributed over domains and thus computing their center
of masses could be complicated.

have you looked into following just a single atom close
to the center of mass of the molecules?

cheers,
   axel.

If group molecule gets you too many atoms, and group region gets
you too many atoms, then group intersect of the 2 groups will get
the atoms common to both.

Steve

Steve, it’s not suitable for me, because I don’t have group with molecules (I would like to create it).

Axel,

i guess you’ll have to get your hands dirty and extend the group
class to support this kind of setup

Done

if ((narg > 3) && (strcmp(arg[2],“region”)) == 0)

{

int iregion = domain->find_region(arg[3]);

if (iregion == -1) error->all(“Group region ID does not exist”);

for(i=0; i < modify->ncompute; i++)

{

if(strcmp(modify->compute[i]->style, “com/molecule”) == 0)

{

modify->compute[i]->compute_array();

x = modify->compute[i]->array;

for (int j = 0; j < modify->compute[i]->size_array_rows; j++)

{

if (domain->regions[iregion]->match(x[j][0],x[j][1],x[j][2]))

for (int k = 0; k < nlocal; k++)

{

if (attribute[k] == j) mask[k] |= bit;

}

}

}

}

}

else

{

for (int ilist = 0; ilist < length; ilist++)

for (i = 0; i < nlocal; i++)

if (attribute[i] == list[ilist]) mask[i] |= bit;

}

I paste this code after 236 line in group.cpp
May be it will be useful.
Command syntax:
compute ID-compute ID-group com/molecule
group ID-group molecule region ID-region

P.S. I found some bug in “compute com/molecule”. I load my configuration via read_data and then made some atoms with
create_atoms. After that I had HEAP CORRUPTION in ComputeCOMMolecule::init() after molecules_in_group function call.

Best regards, Konstantin

2010/3/30 Steve Plimpton <[email protected]>

You can create a group of atoms in certain molecules via the group
molecule command. So I guess I'm not clear on what you're trying to do.
Can you explain it with a simple concrete example?

Re: compute com/molecule bug, can you post a simple input
script that illustrates the crash?

Thanks,
Steve