Examples for epoxpy molecule library

Particle A

Particles B and C are exactly the same as particle A


In [1]:
import epoxpy
from epoxpy.lib import A

a = A()
a.visualize(show_ports=True)


/Users/stephenthomas/miniconda3/envs/epoxy_sim/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-30 17:29:21.453055. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)

Particle C10

C10 is just a chain of 10 C's. It has two parameters to set the position and orientation of the first particle. The position and orientation of the other 9 particles depend on this first one.


In [2]:
from epoxpy.lib import C10

c10 = C10()
c10.visualize(show_ports=True)


/Users/stephenthomas/miniconda3/envs/epoxy_sim/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-30 17:29:24.586170. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)

Epoxy blend (10 A's, 20 B's and 2 C10's)

The blend can be given a box size. The default is [1,1,1].


In [5]:
from epoxpy.lib import Epoxy_A_10_B_20_C10_2_Blend
import mbuild as mb
import random
random.seed(1024)

blend = Epoxy_A_10_B_20_C10_2_Blend()
#blend.visualize()
mix_box = mb.packing.fill_box(blend,1,box=[3,3,3])
print(mix_box.n_bonds)
print(mix_box.n_particles)
mix_box.visualize(show_ports=False)


18
50
/Users/stephenthomas/miniconda3/envs/epoxy_sim/lib/python2.7/site-packages/mbuild/compound.py:889: UserWarning: Guessing that "<A pos=(-0.2029,-0.5165,-0.6106), 0 bonds, id: 4497130128>" is element: "EP"
  warn('Guessing that "{}" is element: "{}"'.format(atom, element))
/Users/stephenthomas/miniconda3/envs/epoxy_sim/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-30 17:44:22.524299. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)

In [4]:
from foyer import Forcefield
mix_box.save('blend.gsd', write_ff=False)
mix_box.save('blend.hoomdxml')


/Users/stephenthomas/miniconda3/envs/epoxy_sim/lib/python2.7/site-packages/mbuild/compound.py:889: UserWarning: Guessing that "<A pos=( 0.1216, 2.0407, 0.9267), 0 bonds, id: 4429313168>" is element: "EP"
  warn('Guessing that "{}" is element: "{}"'.format(atom, element))
/Users/stephenthomas/miniconda3/envs/epoxy_sim/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-30 17:29:25.196169. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)

In [5]:
%matplotlib inline
import matplotlib.pyplot as plt
import epoxpy.epoxy_simulation as es
import epoxpy.job as jb
import epoxpy.temperature_profile_builder as tpb

print('\n# Test1: Running the simulation in a single job')
# This simulation should run a total of 700 time steps because the default dt of the HOOMD engine is 1e-2
mix_time = 3e4
md_time = 4e4
mix_kt = 2.0
time_scale = 1e4
temp_scale = 1
type_A_md_temp_profile = tpb.LinearTemperatureProfileBuilder(initial_temperature=mix_kt, initial_time=mix_time)
type_A_md_temp_profile.add_state_point(60 * time_scale, 4.5 * temp_scale)
type_A_md_temp_profile.add_state_point(190 * time_scale, 4.5 * temp_scale)
type_A_md_temp_profile.add_state_point(240 * time_scale, 1.0 * temp_scale)

fig = type_A_md_temp_profile.get_figure()
plt.show()
fig.savefig("type_A_temp_profile.png")

myEpoxySim = es.EpoxySimulation('epoxy_test_mbuild', mix_time=mix_time, mix_kt=mix_kt,
                                temp_prof=type_A_md_temp_profile, n_mul=1.0, bond=True, bond_period=1*time_scale)

mySingleJobForEpoxy = jb.SingleJob(myEpoxySim)
mySingleJobForEpoxy.execute()


HOOMD-blue v2.1.3 DOUBLE HPMC_MIXED SSE SSE2 SSE3 SSE4_1 SSE4_2 AVX 
Compiled: 02/07/17
Copyright 2009-2016 The Regents of the University of Michigan.
-----
You are using HOOMD-blue. Please cite the following:
* J A Anderson, C D Lorenz, and A Travesset. "General purpose molecular dynamics
  simulations fully implemented on graphics processing units", Journal of
  Computational Physics 227 (2008) 5342--5359
* J Glaser, T D Nguyen, J A Anderson, P Liu, F Spiga, J A Millan, D C Morse, and
  S C Glotzer. "Strong scaling of general-purpose molecular dynamics simulations
  on GPUs", Computer Physics Communications 192 (2015) 97--107
-----

# Test1: Running the simulation in a single job
/Users/stephenthomas/miniconda3/envs/epoxy_sim/lib/python2.7/site-packages/matplotlib/figure.py:1744: UserWarning: This figure includes Axes that are not compatible with tight_layout, so its results might be incorrect.
  warnings.warn("This figure includes Axes that are not "
Initializing HOOMD in ipython
HOOMD-blue is running on the CPU
HOOMDEngine initialized.
<epoxpy.hoomd_engine.HOOMDEngine object at 0x109b27d50> created in SimulationEngineFactory
md time: 4900000.0
New single job created to run epoxy_test_mbuild
Executing epoxy_test_mbuild
Initializing epoxy_test_mbuild
/Users/stephenthomas/miniconda3/envs/epoxy_sim/lib/python2.7/site-packages/mbuild/compound.py:889: UserWarning: Guessing that "<A pos=(-0.8122,-0.2852,-0.9023), 0 bonds, id: 4432621904>" is element: "EP"
  warn('Guessing that "{}" is element: "{}"'.format(atom, element))
/Users/stephenthomas/miniconda3/envs/epoxy_sim/lib/python2.7/site-packages/mbuild/compound.py:889: UserWarning: Guessing that "<A pos=( 2.1534, 1.9147, 1.1821), 0 bonds, id: 4495859344>" is element: "EP"
  warn('Guessing that "{}" is element: "{}"'.format(atom, element))
notice(2): Group "all" created containing 50 particles
Initial box dimension: 3
[u'0']
notice(2): Group "a-particles" created containing 10 particles
notice(2): Group "b-particles" created containing 20 particles
notice(2): Group "c-particles" created containing 20 particles
-----
You are using DPD. Please cite the following:
* C L Phillips, J A Anderson, and S C Glotzer. "Pseudo-random number generation
  for Brownian Dynamics and Dissipative Particle Dynamics simulations on GPU
  devices", Journal of Computational Physics 230 (2011) 7191--7201
-----
Configuring outputs. output_dir: /Users/stephenthomas/projects/epoxy_sim/epoxpy/examples/epoxy_test_mbuild/
log_write: 100 dcd_write: 100
notice(2): -- Neighborlist exclusion statistics -- :
notice(2): Particles with 0 exclusions             : 28
notice(2): Particles with 1 exclusions             : 6
notice(2): Particles with 2 exclusions             : 16
notice(2): Neighbors included by diameter          : no
notice(2): Neighbors excluded when in the same body: no
** starting run **
Time 00:00:00 | Step 30000 / 30000 | TPS 41759.8 | ETA 00:00:00
Average TPS: 41574.6
---------
-- Neighborlist stats:
26541 normal updates / 301 forced updates / 0 dangerous updates
n_neigh_min: 0 / n_neigh_max: 6 / n_neigh_avg: 0.64
shortest rebuild period: 1
-- Cell list stats:
Dimension: 12, 12, 15
n_min    : 0 / n_max: 5 / n_avg: 0.0231481
** run complete **
Running epoxy_test_mbuild
temperature profile <hoomd.variant.linear_interp instance at 0x10c34a9e0>
** starting run **
*Warning*: Particle number change but group is static. Create group with update=True if it should be updated.
This warning is printed only once.
*Warning*: Particle number change but group is static. Create group with update=True if it
Found one, bonding B (26) to A (8)
Time 00:00:10 | Step 726395 / 4930000 | TPS 69639.5 | ETA 00:01:00
Time 00:00:20 | Step 1736161 / 4930000 | TPS 100976 | ETA 00:00:31
Time 00:00:30 | Step 2767633 / 4930000 | TPS 103147 | ETA 00:00:20
Found one, bonding B (14) to A (3)
Time 00:00:40 | Step 3910594 / 4930000 | TPS 114296 | ETA 00:00:08
Found one, bonding A (3) to B (24)
Time 00:00:49 | Step 4930000 / 4930000 | TPS 118107 | ETA 00:00:00
Average TPS: 100753
---------
-- Neighborlist stats:
1391006 normal updates / 49001 forced updates / 0 dangerous updates
n_neigh_min: 0 / n_neigh_max: 3 / n_neigh_avg: 0.48
shortest rebuild period: 1
-- Cell list stats:
Dimension: 12, 12, 15
n_min    : 0 / n_max: 2 / n_avg: 0.0231481
** run complete **
sim fin
 should be updated.
This warning is printed only once.
*Warning*: Particle number change but group is static. Create group with update=True if it should be updated.
This warning is printed only once.
/Users/stephenthomas/miniconda3/envs/epoxy_sim/lib/python2.7/json/encoder.py:207: DeprecationWarning: Interpreting naive datetime as local 2017-03-30 17:29:25.342574. Please add timezone info to timestamps.
  chunks = self.iterencode(o, _one_shot=True)

In [ ]: