Hi All:
I tried to set up a 2D patchy particle MD simulation using the rigid body paradigm in hoomd-blue.
Interestingly, my particles do not rotate whatsoever. When I extend almost the exact same code to 3D, I see the rotation working fine. Can someone please look at this code snippet and tell me what is wrong? I would really appreciate any feedback. Thank you so much!
###############################################################
# Initialize snapshot
snapshot = gsd.hoomd.Snapshot()
snapshot.particles.N = num_particles
snapshot.particles.position = position[0:num_particles]
snapshot.particles.moment_inertia = [[1,1,0]]*num_particles
snapshot.particles.types = ['B', 'A']
snapshot.configuration.box = [L, L, 0, 0, 0, 0]
snapshot.particles.diameter = [diameter]*num_particles
with gsd.hoomd.open(name='IP.gsd', mode='xb') as f:
f.append(snapshot)
rigid = hoomd.md.constrain.Rigid()
rigid.body['B'] = {
"constituent_types": ['A'] * 3,
"positions": [(diameter/2*np.cos(2*np.pi/3), diameter/2*np.sin(2*np.pi/3), 0),
(diameter/2*np.cos(np.pi/3), diameter/2*np.sin(np.pi/3), 0),
(diameter/2*np.cos(3*np.pi/2), diameter/2*np.sin(3*np.pi/2), 0)],
"orientations": [(1.0, 0.0, 0.0, 0.0)]*3,
"charges": [0.0]*3,
"diameters": [diameter_patch]*3
}
##############################################################
###############################################################
# Initialize integrator
integrator = hoomd.md.Integrator(dt=0.005, integrate_rotational_dof=True)
integrator.rigid = rigid
cell = hoomd.md.nlist.Cell(buffer=0.4)
lj = hoomd.md.pair.LJ(nlist=cell)
lj.params[('A', 'A')] = dict(epsilon=1, sigma=1)
lj.r_cut[('A', 'A')] = 2.5
lj.params[('B', ('A', 'B'))] = dict(epsilon=0, sigma=0)
lj.r_cut[('B', ('A', 'B'))] = 0
integrator.forces.append(lj)
nvt = hoomd.md.methods.Langevin(kT=1.5, filter=hoomd.filter.Rigid(("center", "free")))
integrator.methods.append(nvt)
###############################################################
###############################################################
# Initialize simulation
gpu = hoomd.device.GPU()
sim = hoomd.Simulation(device=gpu, seed=1)
sim.operations.integrator = integrator
sim.create_state_from_gsd(filename='IP.gsd')
rigid.create_bodies(sim.state)
sim.run(500)
Thanks a lot!
Jared