def __init__(self, pattern, tile_x=1, tile_y=1, chain_length=10): """Create an alkylsilane monolayer on beta-cristobalite. Parameters ---------- pattern : np.ndarray, shape=(n, 3), optional, default=None An array of planar binding locations. If not provided, the entire surface will be filled with `chain`. tile_x : int, optional, default=1 Number of times to replicate substrate in x-direction. tile_y : int, optional, default=1 Number of times to replicate substrate in y-direction. chain_length : int, optional, default=10 Number of carbon atoms per chain. """ surface = Betacristobalite() alkylsilane = AlkylSilane(chain_length) hydrogen = H() super(AlkaneMonolayer, self).__init__(surface, alkylsilane, backfill=hydrogen, pattern=pattern, tile_x=tile_x, tile_y=tile_y) # -- ==alkane_monolayer== --
def test_monolayer(self, ch2): n = 8 m = 8 pattern = mb.Grid2DPattern(n, m) chain = mb.Polymer(ch2, n=10) monolayer = mb.Monolayer(surface=Betacristobalite(), chains=chain, backfill=H(), pattern=pattern) assert monolayer.n_particles == 1900 + n * m * (10 * 3) + (100 - n * m) assert monolayer.n_bonds == 2400 + n * m * (10 * 2 + 9 + 1) + (100 - n * m)
def __init__(self, pattern, tile_x=1, tile_y=1, chain_length=4, alpha=pi / 4): surface = Betacristobalite() brush = Brush(chain_length=chain_length, alpha=alpha) hydrogen = H() super(PMPCLayer, self).__init__(surface, brush, backfill=hydrogen, pattern=pattern, tile_x=tile_x, tile_y=tile_y)
def test_monolayer(self, ch2): n = 8 m = 8 pattern = mb.Grid2DPattern(n, m) chain = mb.recipes.Polymer(monomers=[ch2]) chain.build(n=10, add_hydrogens=False) monolayer = mb.recipes.Monolayer( surface=Betacristobalite(), chains=chain, backfill=H(), pattern=pattern, ) assert monolayer.n_particles == 2000 + n * m * 29 assert monolayer.n_bonds == 2500 + n * m * 29
def test_pattern_kwargs(self, ch2): n = 8 m = 8 pattern = mb.Grid2DPattern(n, m) chain = mb.Polymer(ch2, n=10) monolayer = mb.Monolayer(surface=Betacristobalite(), chains=H(), guest_port_name='up', backfill=chain, backfill_port_name='down', pattern=pattern) chains = 100 - (n * m) assert monolayer.n_particles == 1900 + chains * (10 * 3) + (100 - chains) assert monolayer.n_bonds == 2400 + chains * (10 * 2 + 9 + 1) + (100 - chains)
def test_mixed_monolayer(self, ch2): n = 8 m = 8 pattern = mb.Grid2DPattern(n, m) fractions = [0.75, 0.25] chain_a = mb.Polymer(ch2, n=5) chain_b = mb.Polymer(ch2, n=15) monolayer = mb.Monolayer(surface=Betacristobalite(), chains=[chain_a, chain_b], fractions=fractions, backfill=H(), pattern=pattern) n_a = round(n * m * 0.75) n_b = round(n * m * 0.25) assert monolayer.n_particles == 1900 + n_a * 5 * 3 + n_b * 15 * 3 + ( 100 - (n_a + n_b)) assert monolayer.n_bonds == 2400 + n_a * (5 * 2 + 4 + 1) + n_b * ( 15 * 2 + 14 + 1) + (100 - (n_a + n_b))
def test_pattern_kwargs(self, ch2): n = 8 m = 8 pattern = mb.Grid2DPattern(n, m) chain = mb.recipes.Polymer(monomers=[ch2]) chain.build(n=10, add_hydrogens=False) monolayer = mb.recipes.Monolayer( surface=Betacristobalite(), chains=H(), guest_port_name="up", backfill=chain, backfill_port_name="down", pattern=pattern, ) chains = 100 - (n * m) assert monolayer.n_particles == 2000 + chains * 29 assert monolayer.n_bonds == 2500 + chains * 29
def test_mixed_monolayer(self, ch2): n = 8 m = 8 pattern = mb.Grid2DPattern(n, m) fractions = [0.75, 0.25] chain_a = mb.recipes.Polymer(monomers=[ch2]) chain_a.build(n=5, add_hydrogens=False) chain_b = mb.recipes.Polymer(monomers=[ch2]) chain_b.build(n=15, add_hydrogens=False) monolayer = mb.recipes.Monolayer( surface=Betacristobalite(), chains=[chain_a, chain_b], fractions=fractions, backfill=H(), pattern=pattern, ) n_a = round(n * m * 0.75) n_b = round(n * m * 0.25) assert monolayer.n_particles == 2000 + n_a * 14 + n_b * 44 assert monolayer.n_bonds == 2500 + n_a * 14 + n_b * 44
def betacristobalite(self): from mbuild.lib.surfaces import Betacristobalite return Betacristobalite()