Rigid body

105 views
Skip to first unread message

Al ehmn

unread,
May 31, 2021, 9:37:47 AMMay 31
to hoomd-users
Hi , Dear HOMMD-blue users, I am trying to use   hoomd.group.rigid() to simulate my systems,


my script looks like this:

import hoomd
import hoomd.md
import hoomd.deprecated

hoomd.context.initialize()
hoomd.deprecated.init.read_xml(filename="b.xml")
nl = hoomd.md.nlist.cell();
slj =hoomd.md.pair.slj(r_cut=3.0, nlist=nl, d_max = 2.0)
slj.pair_coeff.set('A', 'A', epsilon=1.0, sigma=1.0,  r_cut=2.5)
slj.pair_coeff.set('A', 'B', epsilon=1.0, sigma=1.0,  r_cut=2**(1.0/6.0))
slj.pair_coeff.set('B', 'B', epsilon=1.0, sigma=1.0,  r_cut=2.5)
fene =hoomd.md.bond.fene()
fene.bond_coeff.set('A-A', k=30.0, r0=1.5, sigma=1.0, epsilon= 1.0)
fene.bond_coeff.set('A-B', k=30.0, r0=1.5, sigma=1.0, epsilon= 1.0)
fene.bond_coeff.set('B-B', k=30.0, r0=1.5, sigma=1.0, epsilon= 1.0)
all =hoomd.group.all()
rigid=hoomd.group.rigid()
nonrigid =hoomd.group.nonrigid()
hoomd.md.integrate.mode_standard(dt=0.005)
integrator_nonrigid =hoomd.md.integrate.brownian(group=nonrigid, kT=1.0, seed=5)
integrator_rigid =hoomd.md.integrate.brownian(group=rigid,       kT=1.0, seed=6)
integrator_nonrigid.set_gamma('B', gamma=5.0)
integrator_rigid.set_gamma('A', gamma=5.0)
hoomd.analyze.log(filename="log-output.log",
                  quantities=['potential_energy', 'temperature','pressure'],
                  period=50000,
                  overwrite=True);
xml=hoomd.deprecated.dump.xml(group=hoomd.group.all(), filename="particles", period=1e2)
xml.set_params(type=True, position=True, bond=True, image=True, mass=True, velocity=True)
xml=hoomd.deprecated.dump.xml(group=hoomd.group.all(), filename="particles", period=1e2)
xml.set_params(type=True, position=True, bond=True, image=True, mass=True, velocity=True)

# integrate NVT for a bunch of time steps
hoomd.run(3e3);

and I got the error:

a.py:010  |  nl = hoomd.md.nlist.cell();
a.py:015  |  slj =hoomd.md.pair.slj(r_cut=3.0, nlist=nl, d_max = 2.0)
a.py:016  |  slj.pair_coeff.set('A', 'A', epsilon=1.0, sigma=1.0,  r_cut=2.5)
a.py:017  |  slj.pair_coeff.set('A', 'B', epsilon=1.0, sigma=1.0,  r_cut=2**(1.0/6.0))
a.py:018  |  slj.pair_coeff.set('B', 'B', epsilon=1.0, sigma=1.0,  r_cut=2.5)
a.py:024  |  fene =hoomd.md.bond.fene()
a.py:025  |  fene.bond_coeff.set('A-A', k=30.0, r0=1.5, sigma=1.0, epsilon= 1.0)
a.py:026  |  fene.bond_coeff.set('A-B', k=30.0, r0=1.5, sigma=1.0, epsilon= 1.0)
a.py:027  |  fene.bond_coeff.set('B-B', k=30.0, r0=1.5, sigma=1.0, epsilon= 1.0)
a.py:033  |  all =hoomd.group.all()
a.py:035  |  rigid=hoomd.group.rigid()
notice(2): Group "rigid" created containing 2488 particles
a.py:036  |  nonrigid =hoomd.group.nonrigid()
notice(2): Group "nonrigid" created containing 5598 particles
a.py:037  |  hoomd.md.integrate.mode_standard(dt=0.005)
a.py:044  |  integrator_nonrigid =hoomd.md.integrate.brownian(group=nonrigid, kT=1.0, seed=5)
notice(2): integrate.langevin/bd is using specified gamma values
a.py:045  |  integrator_rigid =hoomd.md.integrate.brownian(group=rigid,       kT=1.0, seed=6)
notice(2): integrate.langevin/bd is using specified gamma values
**ERROR**: Particle 1 belongs to a rigid body, but is not its center particle.
This integration method does not operate on constituent particles.

Traceback (most recent call last):
  File "a.py", line 45, in <module>
    integrator_rigid =hoomd.md.integrate.brownian(group=rigid,       kT=1.0, seed=6)
  File "/home/sql/anaconda3/envs/deepmd/lib/python3.6/site-packages/hoomd/md/integrate.py", line 1196, in __init__
    self.cpp_method.validateGroup()
RuntimeError: Error initializing integration method


It seems the rigid body must have a center beads, can anyone help me on this ? Thanks in advance !


Joshua Anderson

unread,
Jun 3, 2021, 11:58:29 AMJun 3
to hoomd...@googlegroups.com
Al ehmn,

Use rigid=hoomd.group.rigid_center()

See the section "Integrating Bodies" in the documentation for more information: https://hoomd-blue.readthedocs.io/en/v2.9.6/module-md-constrain.html#hoomd.md.constrain.rigid
------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan
> --
> You received this message because you are subscribed to the Google Groups "hoomd-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/ae2a4978-0c23-4cd1-a4da-53726d61861dn%40googlegroups.com.

Al ehmn

unread,
Jul 8, 2021, 4:39:02 AMJul 8
to hoomd-users
Thank you very much for your kind help. 

Yulin Luo

unread,
Aug 17, 2021, 10:35:55 PMAug 17
to hoomd-users
Hi  Al ehmn:
    
I have a problem similar to yours, I create the initial configuration by "read_xml", and I am trying to use   hoomd.group.rigid() to simulate my systems,too.
After the "read_xml", how should I use the "rigid = hoomd.group.rigid_center()"? 
In other words, do I still need to specify the position of the rigid_center?

Could you please help me with this issue? Thanks in advance.

Best,

Yulin
Reply all
Reply to author
Forward
0 new messages