示例#1
0
 def __init__(self, length=1, terminal_group=None):
     super(Pegsilane, self).__init__()
     
     module = __import__('atools.lib.moieties.one_port.'+terminal_group)
     class_ = getattr(module.lib.moieties.one_port, terminal_group.title())
     t_group = class_()
     
     self.add(t_group, 'terminal_group')
     
     chain = mb.recipes.Polymer(monomers=[CH2(), O()], sequence='AAB',
                             n=math.floor(length/3), port_labels=('up', 'down'))
     
     mb.force_overlap(self['terminal_group'],
                     self['terminal_group']['down'],
                     to_positions=chain['up'])
     
     self.add(chain)
     
     silane = Silane()
     self.add(silane)
     mb.force_overlap(move_this=silane,
                     from_positions=silane.all_ports()[1],
                     to_positions=chain['down'])
     
     self.add(silane['down'], 'down', containment=False)
示例#2
0
    def __init__(self, chain_length, terminal_group):
        super(Alkylsilane, self).__init__()
        terminal_group_dict = \
            {'acetyl':Acetyl, 'amino':Amino, 'biphenyl':Biphenyl,
             'carboxyl':Carboxyl, 'cyano':Cyano, 'cyclopropyl':Cyclopropyl,
             'ethylene':Ethylene, 'fluorophenyl':Fluorophenyl,
             'formyl':Formyl, 'hydroxyl':Hydroxyl, 'isopropyl':Isopropyl,
             'methoxy':Methoxy, 'methyl':Methyl, 'nitro':Nitro,
             'nitrophenyl':Nitrophenyl, 'pentafluorophenyl':
             Pentafluorophenyl, 'perfluoromethyl':Perfluoromethyl,
             'phenyl':Phenyl, 'pyrrole':Pyrrole, 'triazole':Triazole,
             'difluoromethyl':Difluoromethyl, 'phenol':Phenol,
             'toluene':Toluene, 'benzoicacid':Benzoicacid,
             'isopropylbenzene':Isopropylbenzene, 'amide':Amide,
             'cyclohexyl':Cyclohexyl, 'sulfhydryl':Sulfhydryl,
             'nitroso':Nitroso}
        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)
示例#3
0
    def __init__(self, chain_length):
        super(AlkylSilane, self).__init__()

        self.add(mb.Particle(name='H'))
        self.add(mb.Port(anchor=self[0]), 'oH')
        self['oH'].spin(np.pi, [0, 0, 1])
        self['oH'].translate(np.array([0, 0.097 / 2, 0]))

        self.add(mb.Particle(name='O'))
        self.add(mb.Port(anchor=self[1]), label='Oh')
        self['Oh'].spin(np.pi, [0, 0, 1])
        self['Oh'].translate(np.array([0, 0.097 / 2, 0]))
        mb.force_overlap(self[0], self['oH'], self['Oh'])
        self.add(mb.Port(anchor=self[1]), label='alcohol')
        self['alcohol'].spin(np.pi, [0, 0, 1])
        self['alcohol'].translate(np.array([0, -0.097 / 2, 0]))

        CH2 = mb.lib.moieties.CH2()
        alkane = Polymer(CH2, chain_length, port_labels=['up', 'down'])
        silane = Silane()
        mb.force_overlap(silane, silane['down'], self['alcohol'])
        self.add(silane, 'silane')
        mb.force_overlap(alkane, alkane['down'], silane['up'])
        self.add(alkane, 'alkane')

        # Hoist silane port to AlkylSilane level.
        #self.add(silane['down'], 'down', containment=False)

        #remove a hydrogen to add a port for the second functionalgroup
        self.remove(self['alkane'][3 * chain_length - 1])
        self.add(self.all_ports()[0], 'secondary', containment=False)
        self.add(self.all_ports()[1], 'primary', containment=False)
示例#4
0
    def __init__(self, chain_length):
        super(AlkylSilane, self).__init__()

        alkane = mb.recipes.Alkane(chain_length, cap_end=False)
        self.add(alkane, 'alkane')
        silane = Silane()
        self.add(silane, 'silane')
        mb.force_overlap(self['alkane'], self['alkane']['down'],
                         self['silane']['up'])

        # Hoist silane port to AlkylSilane level.
        self.add(silane['down'], 'down', containment=False)
    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)
示例#6
0
    def __init__(self, n, ch2_cap=False):
        super(PEGSilane, self).__init__()

        tgroup = CH3()

        peg = PEG(n, cap_front=False, cap_end=False)
        self.add(peg, 'peg')
        self.add(tgroup, 'terminal_group')
        mb.force_overlap(self['peg'], self['peg']['up'],
                         self['terminal_group']['down'])
        silane = Silane()
        self.add(silane, 'silane')
        mb.force_overlap(self['silane'], self['silane']['up'],
                         self['peg']['down'])

        self.add(silane['down'], 'down', containment=False)
示例#7
0
    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)
示例#8
0
    def __init__(self, chain_length):
        super(nC_APD, self).__init__()

        alkane = Alkane(chain_length, cap_end=False)
        self.add(alkane, 'alkane')
        apd = APD()
        self.add(apd, 'apd')
        mb.force_overlap(self['alkane'], self['alkane']['down'], 
                         self['apd']['up'])

        silane = Silane()
        self.add(silane, 'silane')
        mb.force_overlap(self['silane'], self['silane']['up'], 
                         self['apd']['down'])

        # Hoist silane port to AlkylSilane level.
        self.add(silane['down'], 'down', containment=False)
        self.spin(np.pi/2, [1, 0, 0])
示例#9
0
文件: brush.py 项目: whitehml/mbuild
    def __init__(self, chain_length=4, alpha=pi / 4):
        super(Brush, self).__init__()

        # Add parts
        self.add(Silane(), label='silane')
        self.add(Initiator(), label='initiator')
        self.add(mb.Polymer(MPC(alpha=alpha),
                            n=chain_length,
                            port_labels=('up', 'down')),
                 label='pmpc')
        self.add(CH3(), label='methyl')

        mb.force_overlap(self['initiator'], self['initiator']['down'],
                         self['silane']['up'])
        mb.force_overlap(self['pmpc'], self['pmpc']['down'],
                         self['initiator']['up'])
        mb.force_overlap(self['methyl'], self['methyl']['up'],
                         self['pmpc']['up'])

        # Make self.port point to silane.bottom_port
        self.add(self['silane']['down'], label='down', containment=False)
示例#10
0
    def __init__(self, chain_length, internal_group, locations):
        super(Alkylsilane, self).__init__()

        hmodule = __import__('atools.lib.moieties.multiple_ports.' +
                             internal_group)
        hclass_ = getattr(hmodule.lib.moieties.multiple_ports,
                          internal_group.title())
        hgroup = hclass_()

        # Determine alkane segments
        if isinstance(locations, int):
            locations = [locations]
        locations.sort()

        silane = Silane()
        self.add(silane, 'silane')
        self.add(silane['down'], 'down', containment=False)

        if 0 in locations:
            '''
            self.add(hgroup, 'hgroup')
            mb.force_overlap(self['silane'], self['silane']['up'], 
                             self['hgroup']['down'])
            '''
            current_segment = silane
        else:
            first_length = locations[0]
            first_segment = Alkane(first_length,
                                   cap_front=False,
                                   cap_end=False)
            self.add(first_segment, 'bottom_chain')
            mb.force_overlap(self['silane'], self['silane']['up'],
                             self['bottom_chain']['down'])
            current_segment = first_segment

        c_remove = 0
        if internal_group in ['amide', 'hemiacetal']:
            c_remove += 1

        for i, loc in enumerate(locations[1:]):
            hgroup_clone = mb.clone(hgroup)
            self.add(hgroup_clone, 'hgroup{}'.format(i + 1))
            mb.force_overlap(self['hgroup{}'.format(i + 1)],
                             self['hgroup{}'.format(i + 1)]['down'],
                             current_segment['up'])
            current_segment = hgroup_clone
            length = loc - locations[i] - 1 - c_remove
            if length > 0:
                segment = Alkane(length, cap_front=False, cap_end=False)
                self.add(segment, 'internal_chain{}'.format(i + 1))
                current_segment = segment
                mb.force_overlap(
                    self['internal_chain{}'.format(i + 1)],
                    self['internal_chain{}'.format(i + 1)]['down'],
                    self['hgroup{}'.format(i + 1)]['up'])

        self.add(hgroup, 'hgroup')
        mb.force_overlap(self['hgroup'], self['hgroup']['down'],
                         current_segment['up'])

        last_length = chain_length - locations[-1] - 1 - c_remove
        if last_length:
            last_segment = Alkane(last_length, cap_front=True, cap_end=False)
            self.add(last_segment, 'top_chain')
            mb.force_overlap(self['top_chain'], self['top_chain']['down'],
                             self['hgroup']['up'])
        else:
            hydrogen = H()
            self.add(hydrogen, 'H-cap')
            mb.force_overlap(self['H-cap'], self['H-cap']['up'],
                             self['hgroup']['up'])
示例#11
0
 def silane(self):
     from mbuild.lib.moieties import Silane
     return Silane()