import numpy as np
import hoomd
import gsd.hoomd
L = 200
box_size = [L, L, L, 0, 0, 0]
xpos = np.zeros(2)
ypos = np.zeros(2)
zpos = np.zeros(2)
xpos[0] = 1
xpos[1] = 10
vx = np.zeros(2)
vy = np.zeros(2)
vz = np.zeros(2)
vx[0] = 0.1
vx[1] = -0.1
frame = gsd.hoomd.Frame()
frame.configuration.box = box_size
frame.particles.N = 2
frame.particles.position = list(zip(xpos, ypos, zpos))
frame.particles.velocity = list(zip(vx, vy, vz))
frame.particles.types = ['A']
frame.particles.typeid = [0]*2
particle1 = hoomd.filter.Tags([0])
stationary = hoomd.filter.Tags([1])
# class ExampleAction(hoomd.custom.Action):
# def act(self, timestep):
# self._state.snapshot.particles.position[1] = self._state.snapshot.particles.position[1] + 1
with gsd.hoomd.open(name='lattice.gsd', mode='w') as f:
f.append(frame)
nl = hoomd.md.nlist.Cell(buffer = 1)
nlist = hoomd.md.nlist.Tree(buffer=0.4, exclusions=('bond',), rebuild_check_delay=10, check_dist=True, mesh=None, default_r_cut=3)
fslj = hoomd.md.pair.ForceShiftedLJ(nlist=nlist, default_r_cut=3)
fslj.params[('A', 'A')] = dict(epsilon=1.0, sigma=0.8)
dt = 0.001
MTTK = hoomd.md.methods.thermostats.Berendsen(kT=1.0, tau=dt*100)
nvt = hoomd.md.methods.ConstantVolume(filter=particle1,
thermostat=MTTK)
integrator = hoomd.md.Integrator(dt = 0.001, methods=[nvt], forces = [fslj])
gsd_writer = hoomd.write.GSD(filename='molecular_trajectory_1.gsd',
trigger=hoomd.trigger.Periodic(10),
mode='wb')
class moveAction(hoomd.custom.Action):
def act(self, timestep):
pass
action_custom = moveAction()
# move_action = hoomd.update.CustomUpdater(trigger = 1000, action = action_custom)
filter_update = hoomd.update.FilterUpdater(trigger = 1, filters = [stationary])