This show how to create an initial configuration and all the set-up to create all the files required by lammps to create a block copolymer system
from cpolymer.lsimu import LSimu
from cpolymer.constrain import Box
#here I specify the cmd I will use (Lammps and mpi must be installed independently)
Simu = LSimu(cmd="mpirun -np 8 lammps")
#Create 30 polymer with a hundred monomers each. Each polymer is constituted of four blocks
Simu.create_polymers(NP=30,N=100,type_bead=[1]*25 + [2]*25 + [1]*25 + [2]*25,
box=Box([0,0,0],[15,15,15]),
liaison={"1-1":[1.0,1],"1-2":[1.0,2],"2-2":[1.0,3]})
#Define the type of bond between each monomer type
Simu.add_bond(typeb="harmonic",idbond=1,K=80,R0=1)
Simu.add_bond(typeb="harmonic",idbond=2,K=80,R0=1)
Simu.add_bond(typeb="harmonic",idbond=3,K=80,R0=1)
#Define the interaction between each monomer type
# Attractive between same bead types
Simu.add_pair(typep="lj/cut",idpair1=1,idpair2=1,epsilon=1,sigma=1,cutoff1=1.3)
Simu.add_pair(typep="lj/cut",idpair1=2,idpair2=2,epsilon=1,sigma=1,cutoff1=1.3)
#Purely repulsive for different types
Simu.add_pair(typep="lj/cut",idpair1=1,idpair2=2,epsilon=1,sigma=1,cutoff1=1.12)
rep = "./"
Simu.generate_xyz("mix.xyz",Mass="one")
Simu.generate_interactions(rep + "interaction")
Simu.generate_pdb("mix.pdb")
Simu.generate_script("basic.txt",run_length=100000,samplingrate=1000,initconf="mix.xyz",
outtraj="out.dcd",outfile="out.xyz",interactions="interaction",particle="1 2")
Simu.run(script="basic.txt")
Reading template /home/jarbona/cpolymer/cpolymer/template/basic.txt mpirun -np 8 lammps < basic.txt
'LAMMPS (23 May 2014)\nWARNING: OMP_NUM_THREADS environment is not set. (../comm_brick.cpp:82)\n using 1 OpenMP thread(s) per MPI task\nLattice spacing in x,y,z = 1 1 1\nReading data file ...\n orthogonal box = (0 0 0) to (15 15 15)\n 2 by 2 by 2 MPI processor grid\n reading atoms ...\n 3000 atoms\n scanning bonds ...\n 1 = max bonds/atom\n reading bonds ...\n 2970 bonds\nFinding 1-2 1-3 1-4 neighbors ...\n 2 = max # of 1-2 neighbors\n 2 = max # of 1-3 neighbors\n 4 = max # of 1-4 neighbors\n 6 = max # of special neighbors\n3000 atoms in group particle\nSetting up run ...\nMemory usage per processor = 5.31465 Mbytes\nStep Temp \n 0 1 \n 10000 1.0088299 \n 20000 1.0061253 \n 30000 0.97899649 \n 40000 0.97790557 \n 50000 0.99002535 \n 60000 0.99196739 \n 70000 1.0026741 \n 80000 0.99108423 \n 90000 1.0012676 \n 100000 1.0024358 \nLoop time of 27.8689 on 8 procs (8 MPI x 1 OpenMP) for 100000 steps with 3000 atoms\n\nPair time (%) = 11.56 (41.4799)\nBond time (%) = 0.86037 (3.08721)\nNeigh time (%) = 2.13988 (7.67839)\nComm time (%) = 9.80661 (35.1884)\nOutpt time (%) = 0.0324043 (0.116274)\nOther time (%) = 3.46962 (12.4498)\n\nNlocal: 375 ave 391 max 363 min\nHistogram: 1 1 2 0 1 1 0 1 0 1\nNghost: 2109.88 ave 2128 max 2098 min\nHistogram: 3 2 0 0 0 0 0 0 1 2\nNeighs: 22366.8 ave 23881 max 20369 min\nHistogram: 1 0 0 3 0 0 0 1 1 2\n\nTotal # of neighbors = 178934\nAve neighs/atom = 59.6447\nAve special neighs/atom = 5.88\nNeighbor list builds = 1659\nDangerous builds = 0\nSystem init for write_data ...\n\nPlease see the log.cite file for references relevant to this simulation\n\n'
Here is the initial configuration
And the one after the run
from cpolymer.lsimu import LSimu
from cpolymer.constrain import Box
#here I specify the cmd I will use (Lammps and mpi must be installed independently)
Simu = LSimu(cmd="mpirun -np 8 lammps")
#Create 30 polymer with a hundred monomers each. Each polymer is constituted of four blocks
Simu.create_polymers(NP=300,N=1000,type_bead=[1]*250 + [2]*250 + [1]*250 + [2]*250,
box=Box([0,0,0],[100,100,100]),
liaison={"1-1":[1.0,1],"1-2":[1.0,2],"2-2":[1.0,3]})
#Define the type of bond between each monomer type
Simu.add_bond(typeb="harmonic",idbond=1,K=80,R0=1)
Simu.add_bond(typeb="harmonic",idbond=2,K=80,R0=1)
Simu.add_bond(typeb="harmonic",idbond=3,K=80,R0=1)
#Define the interaction between each monomer type
# Attractive between same bead types
Simu.add_pair(typep="lj/cut",idpair1=1,idpair2=1,epsilon=1,sigma=1,cutoff1=1.3)
Simu.add_pair(typep="lj/cut",idpair1=2,idpair2=2,epsilon=1,sigma=1,cutoff1=1.3)
#Purely repulsive for different types
Simu.add_pair(typep="lj/cut",idpair1=1,idpair2=2,epsilon=1,sigma=1,cutoff1=1.12)
rep = "./"
Simu.generate_xyz("mix.xyz",Mass="one")
Simu.generate_interactions(rep + "interaction")
Simu.generate_pdb("mix.pdb")
Simu.generate_script("basic.txt",run_length=30000,samplingrate=100,initconf="mix.xyz",
outtraj="out.dcd",outfile="out.xyz",interactions="interaction",particle="1 2")
Simu.run(script="basic.txt")
Reading template /home/jarbona/cpolymer/cpolymer/template/basic.txt mpirun -np 8 lammps < basic.txt
'LAMMPS (23 May 2014)\nWARNING: OMP_NUM_THREADS environment is not set. (../comm_brick.cpp:82)\n using 1 OpenMP thread(s) per MPI task\nLattice spacing in x,y,z = 1 1 1\nReading data file ...\n orthogonal box = (0 0 0) to (100 100 100)\n 2 by 2 by 2 MPI processor grid\n reading atoms ...\n 300000 atoms\n scanning bonds ...\n 1 = max bonds/atom\n reading bonds ...\n 299700 bonds\nFinding 1-2 1-3 1-4 neighbors ...\n 2 = max # of 1-2 neighbors\n 2 = max # of 1-3 neighbors\n 4 = max # of 1-4 neighbors\n 6 = max # of special neighbors\n300000 atoms in group particle\nSetting up run ...\nMemory usage per processor = 31.1217 Mbytes\nStep Temp \n 0 1 \n 10000 1.0005205 \n 20000 1.0001302 \n 30000 0.99895991 \nLoop time of 409.5 on 8 procs (8 MPI x 1 OpenMP) for 30000 steps with 300000 atoms\n\nPair time (%) = 162.098 (39.5844)\nBond time (%) = 34.9726 (8.54031)\nNeigh time (%) = 60.5976 (14.7979)\nComm time (%) = 59.3459 (14.4923)\nOutpt time (%) = 1.5895 (0.388157)\nOther time (%) = 90.8964 (22.1969)\n\nNlocal: 37500 ave 39327 max 34817 min\nHistogram: 1 1 0 0 1 0 1 1 2 1\nNghost: 16657.2 ave 17097 max 16200 min\nHistogram: 2 1 0 1 0 0 0 2 0 2\nNeighs: 726701 ave 790842 max 629244 min\nHistogram: 1 1 0 0 0 2 0 1 0 3\n\nTotal # of neighbors = 5813605\nAve neighs/atom = 19.3787\nAve special neighs/atom = 5.988\nNeighbor list builds = 713\nDangerous builds = 0\nSystem init for write_data ...\n\nPlease see the log.cite file for references relevant to this simulation\n\n'
Simu.assign_from_lammps(name="mix.xyz")
Simu.coarse(run_length=20000,template_name="./template/cg.txt",nlevel=6,lastcmd="mpirun -np 8 lammps")
Simu.generate_xyz(rep + "mix1.xyz",Mass="one")
Simu.generate_pdb(rep + "mix1.pdb")
Simu.generate_script(rep+"basic1.txt",run_length=30000,samplingrate=100,initconf="mix1.xyz",
outtraj="out1.dcd",outfile="out1.xyz",interactions="interaction",particle="1 2"
)
Simu.run(script="basic1.txt")
At level 1, 150000 segments At level 2, 75600 segments At level 3, 38400 segments At level 4, 19200 segments At level 5, 9600 segments At level 6, 4800 segments Reading template /home/jarbona/cpolymer/cpolymer/template/cg.txt mpirun -np 8 lammps < ./cg_6/cg.txt Reading template /home/jarbona/cpolymer/cpolymer/template/cg.txt mpirun -np 8 lammps < ./cg_5/cg.txt Reading template /home/jarbona/cpolymer/cpolymer/template/cg.txt mpirun -np 8 lammps < ./cg_4/cg.txt Reading template /home/jarbona/cpolymer/cpolymer/template/cg.txt mpirun -np 8 lammps < ./cg_3/cg.txt Reading template /home/jarbona/cpolymer/cpolymer/template/cg.txt mpirun -np 8 lammps < ./cg_2/cg.txt Reading template /home/jarbona/cpolymer/cpolymer/template/cg.txt mpirun -np 8 lammps < ./cg_1/cg.txt Reading template /home/jarbona/cpolymer/cpolymer/template/basic.txt mpirun -np 8 lammps < basic1.txt
'LAMMPS (23 May 2014)\nWARNING: OMP_NUM_THREADS environment is not set. (../comm_brick.cpp:82)\n using 1 OpenMP thread(s) per MPI task\nLattice spacing in x,y,z = 1 1 1\nReading data file ...\n orthogonal box = (0 0 0) to (100 100 100)\n 2 by 2 by 2 MPI processor grid\n reading atoms ...\n 300000 atoms\n scanning bonds ...\n 1 = max bonds/atom\n reading bonds ...\n 299700 bonds\nFinding 1-2 1-3 1-4 neighbors ...\n 2 = max # of 1-2 neighbors\n 2 = max # of 1-3 neighbors\n 4 = max # of 1-4 neighbors\n 6 = max # of special neighbors\n300000 atoms in group particle\nSetting up run ...\nMemory usage per processor = 30.7355 Mbytes\nStep Temp \n 0 1 \n 10000 1.0010301 \n 20000 1.0007761 \n 30000 0.99935971 \nLoop time of 379.11 on 8 procs (8 MPI x 1 OpenMP) for 30000 steps with 300000 atoms\n\nPair time (%) = 154.878 (40.8531)\nBond time (%) = 35.9384 (9.4797)\nNeigh time (%) = 53.5335 (14.1208)\nComm time (%) = 42.4635 (11.2008)\nOutpt time (%) = 1.52474 (0.402189)\nOther time (%) = 90.7714 (23.9433)\n\nNlocal: 37500 ave 37684 max 37286 min\nHistogram: 2 0 1 0 1 0 0 1 1 2\nNghost: 16855.4 ave 17135 max 16675 min\nHistogram: 1 0 3 2 0 0 0 1 0 1\nNeighs: 718154 ave 726557 max 707723 min\nHistogram: 1 1 0 0 0 2 2 0 1 1\n\nTotal # of neighbors = 5745233\nAve neighs/atom = 19.1508\nAve special neighs/atom = 5.988\nNeighbor list builds = 710\nDangerous builds = 0\nSystem init for write_data ...\n\nPlease see the log.cite file for references relevant to this simulation\n\n'
And the 6 different coarse grain