Skip to content

Instantly share code, notes, and snippets.

@Shirui816
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shirui816/62c67574b9b1b638d716 to your computer and use it in GitHub Desktop.
Save Shirui816/62c67574b9b1b638d716 to your computer and use it in GitHub Desktop.
testdpd0.92-refine.hoomd
from hoomd_script import *
# create 100 random particles of name A
#init.read_xml(filename="particles.xml", time_step=0)
# init.create_random(N=40000, phi_p=1.57, min_dist=0.1)
polymer1 = dict(bond_len=0.7, type=['A']*1+['B']*2+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['B']*1+['C']*2+['D']*3+['E']*1+
['B']*1+['C']*2+['D']*3+['E']*1+['F']*1,
bond=[(0,1),(1,2),( 2, 3),( 3, 4),( 4, 5),( 5, 6),( 5, 7),( 6, 7),( 7, 8),( 2, 9),
( 9, 10),( 10, 11),( 11, 12),( 12, 13),( 12, 14),( 13, 14),( 14, 15),( 9, 16),
( 16, 17),( 17, 18),( 18, 19),( 19, 20),( 19, 21),( 20, 21),( 21, 22),( 16, 23),
( 23, 24),( 24, 25),( 25, 26),( 26, 27),( 26, 28),( 27, 28),( 28, 29),( 23, 30),
( 30, 31),( 31, 32),( 32, 33),( 33, 34),( 33, 35),( 34, 35),( 35, 36),( 30, 37),
( 37, 38),( 38, 39),( 39, 40),( 40, 41),( 40, 42),( 41, 42),( 42, 43),( 37, 44),
( 44, 45),( 45, 46),( 46, 47),( 47, 48),( 47, 49),( 48, 49),( 49, 50),( 44, 51),
( 51, 52),( 52, 53),( 53, 54),( 54, 55),( 54, 56),( 55, 56),( 56, 57),( 51, 58),
( 58, 59),( 59, 60),( 60, 61),( 61, 62),( 61, 63),( 62, 63),( 63, 64),( 58, 65),
( 65, 66),( 66, 67),( 67, 68),( 68, 69),( 68, 70),( 69, 70),( 70, 71),( 65, 72),
( 72, 73),( 73, 74),( 74, 75),( 75, 76),( 75, 77),( 76, 77),( 77, 78),( 72, 79),
( 79, 80),( 80, 81),( 81, 82),( 82, 83),( 82, 84),( 83, 84),( 84, 85),( 79, 86),
( 86, 87),( 87, 88),( 88, 89),( 89, 90),( 89, 91),( 90, 91),( 91, 92),( 86, 93),
( 93, 94),( 94, 95),( 95, 96),( 96, 97),( 96, 98),( 97, 98),( 98, 99),( 93,100),
(100,101),(101,102),(102,103),(103,104),(103,105),(104,105),(105,106),(100,107),
(107,108),(108,109),(109,110),(110,111),(110,112),(111,112),(112,113),(107,114),
(114,115),(115,116),(116,117),(117,118),(117,119),(118,119),(119,120),(114,121),
(121,122),(122,123),(123,124),(124,125),(124,126),(125,126),(126,127),(121,128),
(128,129),(129,130),(130,131),(131,132),(131,133),(132,133),(133,134),(128,135),
(135,136),(136,137),(137,138),(138,139),(138,140),(139,140),(140,141),(135,142),
(142,143),(143,144),(144,145),(145,146),(145,147),(146,147),(147,148),(142,149),
(149,150),(150,151),(151,152),(152,153),(152,154),(153,154),(154,155),(149,156),
(156,157),(157,158),(158,159),(159,160),(159,161),(160,161),(161,162),(156,163),
(163,164),(164,165),(165,166),(166,167),(166,168),(167,168),(168,169),(163,170),
(170,171),(171,172),(172,173),(173,174),(173,175),(174,175),(175,176),(170,177),
(177,178),(178,179),(179,180),(180,181),(180,182),(181,182),(182,183),(177,184),
(184,185),(185,186),(186,187),(187,188),(187,189),(188,189),(189,190),(184,191),
(191,192),(192,193),(193,194),(194,195),(194,196),(195,196),(196,197),(191,198),
(198,199),(199,200),(200,201),(201,202),(201,203),(202,203),(203,204),(198,205),
(205,206),(206,207),(207,208),(208,209),(208,210),(209,210),(210,211),(205,212),
(212,213),(213,214),(214,215),(215,216),(215,217),(216,217),(217,218),(212,219),
(219,220),(220,221),(221,222),(222,223),(222,224),(223,224),(224,225),(219,226),
(226,227),(227,228),(228,229),(229,230),(229,231),(230,231),(231,232),(226,233),
(233,234),(234,235),(235,236),(236,237),(236,238),(237,238),(238,239),(233,240),
(240,241),(241,242),(242,243),(243,244),(243,245),(244,245),(245,246),(240,247),
(247,248),(248,249),(249,250),(250,251),(250,252),(251,252),(252,253),(247,254),
(254,255),(255,256),(256,257),(257,258),(257,259),(258,259),(259,260),(254,261),
(261,262),(262,263),(263,264),(264,265),(264,266),(265,266),(266,267),(261,268),
(268,269),(269,270),(270,271),(271,272),(271,273),(272,273),(273,274),(268,275),
(275,276),(276,277),(277,278),(278,279),(278,280),(279,280),(280,281),(275,282),
(282,283),(283,284),(284,285),(285,286),(285,287),(286,287),(287,288),(282,289),
(289,290),(290,291),(291,292),(292,293),(292,294),(293,294),(294,295),(289,296),
(296,297),(297,298),(298,299),(299,300),(299,301),(300,301),(301,302),(296,303),
(303,304),(304,305),(305,306),(306,307),(306,308),(307,308),(308,309),(303,310),
(310,311),(311,312),(312,313),(313,314),(313,315),(314,315),(315,316),(310,317),
(317,318),(318,319),(319,320),(320,321),(320,322),(321,322),(322,323),(317,324),
(324,325),(325,326),(326,327),(327,328),(327,329),(328,329),(329,330),(324,331),
(331,332),(332,333),(333,334),(334,335),(334,336),(335,336),(336,337),(331,338),
(338,339),(339,340),(340,341),(341,342),(341,343),(342,343),(343,344),(338,345),
(345,346),(346,347),(347,348),(348,349),(348,350),(349,350),(350,351),(345,352)],
count=53)
polymer2 = dict(bond_len=0.7, type=['W']*1,
bond="linear", count=356291)
#polymer3 = dict(bond_len=0.7, type=['C']*5+['B']*1+['D']*1+['B']*1+
# ['D']*1+['B']*1+['D']*1+['B']*1,
# bond=[(0,1),(1,2),(2,3),(3,4),(4,5),(5,6),(6,7),(6,8),(8,9),(8,10),(10,11)], count=200)
init.create_random_polymers(box=hoomd.BoxDim(50),
polymers=[polymer1,polymer2],
separation=dict(A=0.1, B=0.1, C=0.1, D=0.1,E=0.1,
F=0.1,W=0.1));
# specify Lennard-Jones interactions between particle pairs
dpd = pair.dpd(r_cut=1.0, T=1.0)
dpd.pair_coeff.set('A', 'A', A=25.0, gamma = 4.5)
dpd.pair_coeff.set('A', 'B', A=29.3876591946, gamma = 4.5)
dpd.pair_coeff.set('A', 'C', A=25.3935344821, gamma = 4.5)
dpd.pair_coeff.set('A', 'D', A=28.2799687557, gamma = 4.5)
dpd.pair_coeff.set('A', 'E', A=26.589646583, gamma = 4.5)
dpd.pair_coeff.set('A', 'F', A=25.0, gamma = 4.5)
dpd.pair_coeff.set('A', 'W', A=31.7933061748, gamma = 4.5)
dpd.pair_coeff.set('B', 'B', A=25.0, gamma = 4.5)
dpd.pair_coeff.set('B', 'C', A=27.1531181915, gamma = 4.5)
dpd.pair_coeff.set('B', 'D', A=25.0804321392, gamma = 4.5)
dpd.pair_coeff.set('B', 'E', A=36.2592854997, gamma = 4.5)
dpd.pair_coeff.set('B', 'F', A=29.3876591946, gamma = 4.5)
dpd.pair_coeff.set('B', 'W', A=47.1000701493, gamma = 4.5)
dpd.pair_coeff.set('C', 'C', A=25.0, gamma = 4.5)
dpd.pair_coeff.set('C', 'D', A=26.4012525424, gamma = 4.5)
dpd.pair_coeff.set('C', 'E', A=28.5650543153, gamma = 4.5)
dpd.pair_coeff.set('C', 'F', A=25.3935344821, gamma = 4.5)
dpd.pair_coeff.set('C', 'W', A=35.456947828, gamma = 4.5)
dpd.pair_coeff.set('D', 'D', A=25.0, gamma = 4.5)
dpd.pair_coeff.set('D', 'E', A=34.4364484318, gamma = 4.5)
dpd.pair_coeff.set('D', 'F', A=28.2799687557, gamma = 4.5)
dpd.pair_coeff.set('D', 'W', A=44.5140020213, gamma = 4.5)
dpd.pair_coeff.set('E', 'E', A=25.0, gamma = 4.5)
dpd.pair_coeff.set('E', 'F', A=26.589646583, gamma = 4.5)
dpd.pair_coeff.set('E', 'W', A=26.8105997703, gamma = 4.5)
dpd.pair_coeff.set('F', 'F', A=25.0, gamma = 4.5)
dpd.pair_coeff.set('F', 'W', A=31.7933061748, gamma = 4.5)
dpd.pair_coeff.set('W', 'W', A=25.0, gamma = 4.5)
dpd.set_params(T = 1.0)
nlist.reset_exclusions(exclusions = [])
integrate.mode_standard(dt=0.02)
integrate.nve(group=group.all())
harmonic = bond.harmonic()
harmonic.set_coeff('polymer', k=4.0, r0=0.0)
# integrate at constant temperature,momentum
# zeroer= update.zero_momentum(period=5000)
analyze.log(filename='dpdmomentum.log',quantities=['momentum'],period=100, header_prefix='#',overwrite=True)
analyze.log(filename='dpdtemperature.log',quantities=['temperature'],period=100, header_prefix='#',overwrite=True)
#pdb = dump.pdb(filename="particles", period=10000)
xml = dump.xml(filename="particles", period=30000)
xml.set_params(position=True, type=True, bond=True)
mol2 = dump.mol2()
mol2.write(filename="example2.mol2")
dump.dcd(filename="example3.dcd", period=30000)
# setup the IMD server
#analyze.imd(port=5432, period=200)
# run 10,000 time steps
run(3000001)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment