Ejemplo n.º 1
0
def run(pluginManager):
    """
    Entry point for the plugin manager
    :param configx: plugin manager instance
    :return: None
    """
    printer = pluginManager.setup()
    molecule = quickLoad(pluginManager, pluginManager.arg('load'))
    printer('Filtering Atoms:')
    for atom in iter_atoms(molecule):
        if filter_atom(pluginManager, atom, 'atomfilter'):
            printer(atom)
    printer.spacer()
    printer('\nFiltering Atom Pairs:')
    for atom1, atom2 in iter_atom_pairs(molecule, bound=False, unique=False):
        if filter_atom_pair(pluginManager, atom1, atom2, 'atomfilter', 'secondfilter'):
            printer('{} {}'.format(atom1.get_name(), atom2.get_name()))

    printer.spacer()
    printer('\nUsing Custom Filter Function:')
    filter.register_custom_fuction('firstOf', firstOfElement)
    for atom in iter_atoms(molecule):
        if filter_atom(pluginManager, atom, 'customfilter'):
            printer(atom)
Ejemplo n.º 2
0
def run(pluginManager):
    """
    Entry point for the plugin manager
    :param pluginManager: plugin manager instance
    :return: None
    """
    printer = pluginManager.setup()
    molecule = quickLoad(pluginManager, pluginManager.arg("load"))
    printer("Filtering Atoms:")
    for atom in iter_atoms(molecule):
        if filter_atom(pluginManager, atom, "atomfilter"):
            printer(atom)
    printer.spacer()
    printer("\nFiltering Atom Pairs:")
    for atom1, atom2 in iter_atom_pairs(molecule, bound=False, unique=False):
        if filter_atom_pair(pluginManager, atom1, atom2, "atomfilter", "secondfilter"):
            printer("{} {}".format(atom1.get_name(), atom2.get_name()))

    printer.spacer()
    printer("\nUsing Custom Filter Function:")
    filter.register_custom_fuction("firstOf", firstOfElement)
    for atom in iter_atoms(molecule):
        if filter_atom(pluginManager, atom, "customfilter"):
            printer(atom)
Ejemplo n.º 3
0
 def expand(self, pluginManager):
     printer = pluginManager.get_active_printer()
     loader = pluginManager.get_variable('loader')
     active_id = loader.get_active_id()
     if not active_id.startswith('shelx'):
         printer.highlight('Error: Wrong input file ID: {}.'.format(active_id))
         printer('Molecule expansion currently only works with \'Shelxl\' type files.')
         printer('Note: CIFs written by \'Shelxl\' will be supported soon.')
         return
     symmetry_elements = loader.get_symmetry()
     lattice = float(loader.get_lattice())
     if lattice > 0:
         centric = True
     else:
         centric = False
     symms = []
     for symm in symmetry_elements:
         symm = SymmetryElement(symm, centric=False)
         symms.append(symm)
     if centric:
         symms.append(SymmetryElement(['-X', '-Y', '-Z']))
         for symm in symmetry_elements:
             symm = SymmetryElement(symm, centric=True)
             symms.append(symm)
     newatoms = []
     asymunits = {str(symm): [] for symm in symms}
     for atom in iter_atoms(self):
         atom.normalize()
         for symm in symms:
             newatom = symm + atom
             newatom.normalize()
             if not atom - newatom < 0.1:
                 newatoms.append(newatom)
             else:
                 atom.set_special(True)
             asymunits[str(symm)].append(newatom)
     for atom in newatoms:
         self += atom