Exemplo n.º 1
0
 def makeconnect(self):
     distmat = moltools.distmat(self)
     self._connect = numpy.zeros((len(self), len(self)),
                                bool)
     for i in range(len(self)):
         for j in range(i):
             if self.atoms[i].no == 1 or self.atoms[j].no == 1:
                 self.connect[i][j] = self.connect[j][i] = distmat[i][j] < self.__maxbondlen_h
             else:
                 self.connect[i][j] = self.connect[j][i] = distmat[i][j] < self.__maxbondlen
Exemplo n.º 2
0
 def findneighbor(self, mol, r6):
     coords = mol.coords
     # FIXME: we need not calculate the full distance matrix
     # FIXME: we need not calculate distmat for each r6
     dismat = moltools.distmat(mol)
     for molidx, molresult in enumerate(getr6result(coords, r6, dismat, self.shakedata)):
         newmol = mol.copy()
         for idx, coord in molresult.items():
             newmol.change_coord(idx, coord)
         rmol, rene = self._minimizemol(newmol)
         if rmol is None:
             continue
         self.mutex.acquire()  # r/w _step_count
         self._step_count += 1
         self.mutex.release()
         logstr = "  Step %5i   Comb %02i-%02i %42.4f " % (self._step_count, self.r6s[r6], molidx, rene)
         yield rmol, rene, logstr
         if self.maxsteps > 0 and self._step_count >= self.maxsteps:
             return