Beispiel #1
0
def build_monolayer(chain_length, n_molecules, **kwargs):
    from mbuild.examples import AlkaneMonolayer
    pattern = mb.Random2DPattern(n_molecules)
    monolayer = AlkaneMonolayer(pattern, tile_x=1, tile_y=1, chain_length=chain_length)
    monolayer.name = 'alkane_n-{}_l-{}'.format(n_molecules, chain_length)
    mb.translate(monolayer, [0, 0, 2])
    return monolayer
Beispiel #2
0
def build_monolayer(chain_length, n_molecules, **kwargs):
    from mbuild.examples import AlkaneMonolayer
    pattern = mb.Random2DPattern(n_molecules)
    monolayer = AlkaneMonolayer(pattern, tile_x=1, tile_y=1, chain_length=chain_length)
    monolayer.name = 'alkane_n-{}_l-{}'.format(n_molecules, chain_length)
    mb.translate(monolayer, [0, 0, 2])
    box = monolayer.boundingbox
    monolayer.periodicity += np.array([0, 0, 5 * box.lengths[2]])

    return monolayer
Beispiel #3
0
def build_monolayer(chain_length, n_molecules, **kwargs):
    from mbuild.examples import AlkaneMonolayer
    pattern = mb.Random2DPattern(n_molecules)
    monolayer = AlkaneMonolayer(pattern,
                                tile_x=1,
                                tile_y=1,
                                chain_length=chain_length)
    monolayer.name = 'alkane_n-{}_l-{}'.format(n_molecules, chain_length)
    mb.translate(monolayer, [0, 0, 2])
    box = monolayer.boundingbox
    monolayer.periodicity += np.array([0, 0, 5 * box.lengths[2]])

    return monolayer
Beispiel #4
0
def build_monolayer(chain_length, n_molecules, pattern_class, **kwargs):
    from mbuild.examples import AlkaneMonolayer
    if pattern_class is mb.Random2DPattern:
        if n_molecules in used_random_patterns:
            pattern = used_random_patterns[n_molecules]
        else:
            pattern = pattern_class(n_molecules)
        pattern_name = 'rand'
    if pattern_class is mb.Grid2DPattern:
        pattern = pattern_class(int(np.sqrt(n_molecules)),
                                int(np.sqrt(n_molecules)))
        pattern_name = 'grid'

    bot = AlkaneMonolayer(pattern,
                          tile_x=1,
                          tile_y=1,
                          chain_length=chain_length)
    mb.translate(bot, [0, 0, 2])

    bot_box = bot.boundingbox
    bot_of_bot = bot_box.mins[2]

    bot_rigid = [
        i + 1 for i, a in enumerate(bot.particles())
        if (a.pos[2] < bot_of_bot + 0.05) and a.name == 'Si'
    ]
    n_particles = bot.n_particles
    top_rigid = [i + n_particles for i in bot_rigid]

    top = mb.clone(bot)
    mb.spin_y(top, np.pi)
    top_of_bot = bot_box.maxs[2]
    bot_of_top = top.boundingbox.mins[2]
    mb.translate(top, [0, 0, top_of_bot - bot_of_top + 0.5])

    monolayer = mb.Compound([bot, top])
    monolayer.name = 'alkane_n-{}_l-{}-{}'.format(n_molecules, chain_length,
                                                  pattern_name)
    rigid_groups = {'bot': bot_rigid, 'top': top_rigid}
    return monolayer, rigid_groups
Beispiel #5
0
 def alkane_monolayer(self):
     from mbuild.examples import AlkaneMonolayer
     pattern = mb.Random2DPattern(50, seed=1)
     monolayer = AlkaneMonolayer(pattern=pattern)
     return monolayer