Skip to content

11_Example_Input_Scripts

Ambuild-code edited this page Oct 27, 2020 · 10 revisions

11 Example Input Scripts

This section contains a variety of example Ambuild input scripts, each of which involves the growth of a polymer from methane building blocks. There is one example of each of the growBlocks, joinBlocks, and zipBlocks scripts, in which the polymer is built solely from methane fragments, with no solvent, catalyst, or influence from other reagents (Sections 11.1-11.3, Figures 7-9, respectively). Then, to demonstrate the adaptability of the Ambuild code in modelling amorphous, hyper-crosslinked polymer networks, another example is included, in which the methane polymer is firstly assembled using a growBlocks script (Figure 10), whilst solvated with toluene, before being desolvated (Figure 11) and worked-up (Section 11.4, Figure 12), which can be adapted to best mimic the experimental synthesis.

11.1 Example growBlocks Input Script

#!/usr/bin/env python3

#Our imports
from ambuild import ab_cell

#Cell Dimensions
boxDim=[30,30,30]

#Create the Cell
paramsDir='./params'
mycell = ab_cell.Cell(boxDim, atomMargin=0.1, bondMargin=0.5, bondAngleMargin=5,  paramsDir=paramsDir )

#Add Fragments to the Library
mycell.libraryAddFragment( filename='./blocks/ch4.car', fragmentType='Me' )

#Specify Bonding Rules
mycell.addBondType( 'Me:a-Me:a' )

#Seed the Cell with the Building Blocks in the Library
mycell.seed( 1, fragmentType='Me' )

for i in range(100):
    mycell.growBlocks(4, cellEndGroups='Me:a', libraryEndGroups='Me:a', maxTries=500)
    mycell.optimiseGeometry(quiet=True)
    mycell.dump()
    mycell.runMD(doDihedral=True, rCut=10, mdCycles=1000000, T=55.0)

11.2 Example joinBlocks Input Script

#!/usr/bin/env python3

#Our imports
from ambuild import ab_cell

#Cell Dimensions
boxDim=[30,30,30]

#Create the Cell
paramsDir='./params'
mycell = ab_cell.Cell(boxDim, atomMargin=0.1, bondMargin=0.5, bondAngleMargin=5,  paramsDir=paramsDir )

#Add Fragments to the Library
mycell.libraryAddFragment( filename='./blocks/ch4.car', fragmentType='Me' )

#Specify Bonding Rules
mycell.addBondType( 'Me:a-Me:a' )

#Seed the Cell with the Building Blocks in the Library
mycell.seed( 100, fragmentType='Me' )
mycell.optimiseGeometry(quiet=False)

for i in range(100):
    mycell.joinBlocks(1, cellEndGroups=None, maxTries=500)
    mycell.optimiseGeometry(quiet=False)
    mycell.dump()
    mycell.runMD(doDihedral=True, rCut=10, mdCycles=1000000, T=55.0)

11.3 Example zipBlocks Input Script

images/Figure_9.jpg

Clone this wiki locally