def test_structure_reproducibility(self): from mbuild.lib.recipes import Alkane filename = 'decane-tmp.xyz' decane = Alkane(10) decane.save(filename) with open(get_fn('decane.xyz')) as file1: with open(filename) as file2: diff = difflib.ndiff(file1.readlines(), file2.readlines()) changes = [l for l in diff if l.startswith('+ ') or l.startswith('- ')] assert not changes
def __init__(self, chain_length, terminal_group): super(Alkylsilane, self).__init__() terminal_group_dict = {"methyl":Methyl} tgroup = terminal_group_dict[terminal_group]() alkane = Alkane(chain_length, cap_front=False, cap_end=False) self.add(alkane, 'alkane') self.add(tgroup, 'terminal_group') mb.force_overlap(self['alkane'], self['alkane']['up'], self['terminal_group']['down']) silane = Silane() self.add(silane, 'silane') mb.force_overlap(self['silane'], self['silane']['up'], self['alkane']['down']) self.add(silane['down'], 'down', containment=False)
def __init__(self, chain_length, terminal_group): super(Alkylsilane, self).__init__() module = __import__('atools.lib.moieties.one_port.'+terminal_group) class_ = getattr(module.lib.moieties.one_port, terminal_group.title()) tgroup = class_() alkane = Alkane(chain_length, cap_front=False, cap_end=False) self.add(alkane, 'alkane') self.add(tgroup, 'terminal_group') mb.force_overlap(self['alkane'], self['alkane']['up'], self['terminal_group']['down']) silane = Silane() self.add(silane, 'silane') mb.force_overlap(self['silane'], self['silane']['up'], self['alkane']['down']) self.add(silane['down'], 'down', containment=False)
def test_remove_port(self): from mbuild.lib.recipes import Alkane butane = Alkane(n=4) butane.remove(butane[-1]) box = mb.fill_box(butane, n_compounds=10, density=1)
def octane(self): from mbuild.lib.recipes import Alkane return Alkane(8, cap_front=True, cap_end=True)
def propyl(self): from mbuild.lib.recipes import Alkane return Alkane(3, cap_front=True, cap_end=False)