Skip to content

Instantly share code, notes, and snippets.

@tcmoore3
Last active April 6, 2017 20:24
Show Gist options
  • Save tcmoore3/ee990a748bbbfc2bc784025571772ccc to your computer and use it in GitHub Desktop.
Save tcmoore3/ee990a748bbbfc2bc784025571772ccc to your computer and use it in GitHub Desktop.
from numpy import pi
import mbuild as mb
cer2 = mb.load('cer2.pdb')
grid = mb.pattern.Grid2DPattern(50, 50)
leaflet, system = mb.Compound(), mb.Compound()
repeat_spacing = 6 # repeat spacing in nm
leaflet = grid.apply(cer2) # put lipids on gird points
leaflet = mb.Compound(leaflet)
for layer_num in range(4): # add 4 leaflets to the system
new_layer = mb.clone(leaflet)
if layer_num % 2 == 1: # rotate every other layer 180deg
new_layer.spin(pi, around=[1, 0, 0])
new_layer.translate([0, 0, layer_num * repeat_spacing / 2])
system.add(new_layer)
system.save('cer2.hoomdxml')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment