Esempio n. 1
0
    def _setupActiveFragmentsInformation(self):
        active_atoms = self._getActiveAtomsFromFragments()
        if self._active_atoms_distance > 0.0:
            active_atoms = self._getActiveAtomsFromDistance()

            #print "found %i atoms which should be active" % (len(active_atoms))
        self._active_atoms = active_atoms[:]
        atoms = self._active_atoms[:]
        frags = self._fragmentation.getFragments()
        fragment_layers = self._fragment_layers[:]
        if self._central_fragment == 0:
            self._active_frags = []
            return

        if len(self._active_atoms) > 0:
            #print "extending region A to include all atoms of close fragments"
            active_frags = []  #self._active_fragments[:]
            active_frags.append(self._central_fragment -
                                1)  # central must also be active
            for atom in atoms:
                ifrg = self._getFragmentFromAtom(atom)
                active_frags.extend([ifrg])
            active_frags = Uniqify(active_frags)
            active_frags = sorted(active_frags)
            self._active_fragments = active_frags[:]
            # promote active fragments to layer 2
            for active_fragment_id in active_frags:
                self._fragment_layers[active_fragment_id] = 2

            # add active fragment atoms to list of active atoms
            fragments = self._fragmentation.getFragments()
            for frag in active_frags:
                atoms.extend(fragments[frag])
            atoms = Uniqify(atoms)
            atoms = sorted(atoms)
            #print "active region is now %i atoms large (%i fragments)" % (len(atoms),len(active_frags))
        #print atoms
        if self._freeze_backbone:
            #print "attempting to find and freeze backbone atoms in the active region"
            for item in self._fragmentation.getBackboneAtoms():
                if item in atoms:
                    atoms.remove(item)
                    continue
            #print "active region is now %i atoms large (%i fragments)" % (len(atoms),len(active_frags))
        #print atoms
        atoms = Uniqify(atoms)
        atoms = sorted(atoms)
        self._active_atoms = atoms[:]
Esempio n. 2
0
 def _getBasisAtoms(self, ilayer):
     atom_numbers = Uniqify(
         [atom.GetAtomicNum() for atom in self._fragmentation.getAtoms()])
     atom_numbers.sort()
     atoms = [
         self._elements.GetSymbol(atom_number)
         for atom_number in atom_numbers
     ]
     return "".join(
         [self._formatSingleAtomBasis(ilayer, atom) for atom in atoms])
Esempio n. 3
0
 def _getActiveAtomsFromDistance(self):
     atoms = []
     central_atoms = self._fragmentation.getFragments()[
         self._central_fragment - 1]
     atoms.extend(central_atoms)
     all_atoms = range(1, len(self._fragmentation.getAtoms()) + 1)
     for atom_idx in central_atoms:
         for atom_jdx in all_atoms:
             if atom_jdx in central_atoms: continue
             if atom_jdx in atoms: continue
             R = self._getDistanceBetweenAtoms(atom_idx, atom_jdx)
             if R < self._active_atoms_distance:
                 atoms.append(atom_jdx)
                 continue
     atoms = Uniqify(atoms)
     return sorted(atoms)