grouping every 10 atoms

Hi,

I have polymer chains with 1000 atoms in each. I have to freeze every Nth atom, say 10th atom during a run. How can I do that? How can I group every Nth atom to one group.

thanks
Pavithra

If you're clever, you can probably do it with an atom-style variable
that evaluates to 1 for every 10th atom and to 0 otherwise,
then use that variable with the group variable command. For the
atom-style formula, something like a sin() function of the atom ID,
together with a Boolean threshhold should work, i.e.

variable foo atom scale1*sin(scale2*id)>1.0
group mygroup variable foo

Just make sure the sin function has a period of 10.

Steve

For the record, here's a solution to this problem using moltemplate.
(Unpack the .tar.gz archive, and go to moltemplate.org if you want to
try it out.)
If this is all you need it for, then moltemplate might be overkill.
In that case use Steve's suggestion instead.

In any case, I tested this example and it and it runs.

--- outline ---
I created a long polymer by linking short polymers together of length
10. One of the atoms in each of these short polymers belongs to the
"immobile" group.

I attached a picture of the polymer. (If you want a simpler polymer
with 1-atom-per-monomer, edit the "monomer.lt" file and delte the
lines containing the "R1" and "R2" atoms.)

Here is an excerpt from the main input file which demonstrates what
I'm talking about:
# --- polymer.lt ---

import "monomer.lt"

Polymer10 {

  # Make a chain of monomers
  monomers = new Monomer [10].rot(180, 1,0,0).move(2.0, 0, 0)

  # Now, link the monomers together this way:
  write("Data Bonds") {
    $bond:bb1 @bond:Monomer/bb $atom:monomers[0]/CA $atom:monomers[1]/CA
    $bond:bb2 @bond:Monomer/bb $atom:monomers[1]/CA $atom:monomers[2]/CA
    $bond:bb3 @bond:Monomer/bb $atom:monomers[2]/CA $atom:monomers[3]/CA
    $bond:bb4 @bond:Monomer/bb $atom:monomers[3]/CA $atom:monomers[4]/CA
    $bond:bb5 @bond:Monomer/bb $atom:monomers[4]/CA $atom:monomers[5]/CA
    $bond:bb6 @bond:Monomer/bb $atom:monomers[5]/CA $atom:monomers[6]/CA
    $bond:bb7 @bond:Monomer/bb $atom:monomers[6]/CA $atom:monomers[7]/CA
    $bond:bb8 @bond:Monomer/bb $atom:monomers[7]/CA $atom:monomers[8]/CA
    $bond:bb9 @bond:Monomer/bb $atom:monomers[8]/CA $atom:monomers[9]/CA
  }

  # Now put the "CA" atom from the 5th monomer in the "freeze_group"
  write("system.in.groups") {
    group immobile id $atom:monomers[4]/CA
  }

} # Polymer10

Polymer1000 {

  subunits = new Polymer10 [100].move(20.0, 0, 0)
  :

}

group_every_nth_atom.tar.gz (33.9 KB)

long_polymer_partially_immobile.png