1 hoomd_script::init::create_random_polymers hoomd_script::dump::xml hoomd_script::dump::dcd hoomd_script::pair::lj hoomd_script::bond::harmonic hoomd_script::integrate::mode_standard hoomd_script::integrate::nvt
2 # Due to deficiencies in doxygen, the commands used in this example are listed explicitly here
3 # run this script with "python -x filename" to skip the first line, or remove this header
5 # ---- create_random_polymers.py ----
6 from hoomd_script import *
13 polymer1 = dict(bond_len=1.2, type=['A']*6 + ['B']*7 + ['A']*6,
14 bond="linear", count=n_poly)
16 # perform some simple math to find the length of the box
17 N = len(polymer1['type']) * polymer1['count']
19 # generate the polymer system
20 init.create_random_polymers(box=data.boxdim(volume=math.pi * N / (6.0 * phi_P)), polymers=[polymer1],
21 separation=dict(A=0.35, B=0.35), seed=12)
24 harmonic = bond.harmonic()
25 harmonic.bond_coeff.set('polymer', k=330.0, r0=0.84)
26 lj = pair.lj(r_cut=3.0)
27 lj.pair_coeff.set('A', 'A', epsilon=1.0, sigma=1.0, alpha=0.0)
28 lj.pair_coeff.set('A', 'B', epsilon=1.0, sigma=1.0, alpha=0.0)
29 lj.pair_coeff.set('B', 'B', epsilon=1.0, sigma=1.0, alpha=1.0)
31 # dump every 100,000 steps
32 dump.xml(filename="create_random_polymers.xml", vis=True)
33 dump.dcd(filename="create_random_polymers.dcd", period=100000)
35 # integrate NVT for a bunch of time steps
37 integrate.mode_standard(dt=0.005)
38 integrate.nvt(group=all, T=1.2, tau=0.5)
41 # uncomment the next run() command if you have a few hours to spare
42 # running this on a GPU the resulting dump files should show the
43 # polymers self-assembling into the hex phase