Beispiel #1
0
def valid_redundant_set(list_xcc, list_gcc, list_Fcc, list_ccfrqs, symbols,
                        masses, torsions):
    for trial in range(2):
        for idx1 in range(len(list_xcc)):
            xcc1 = list_xcc[idx1]
            gcc1 = list_gcc[idx1]
            Fcc1 = list_Fcc[idx1]
            ccfrqs1 = list_ccfrqs[idx1]
            ics = intl.ics_from_geom(xcc1, symbols)
            if trial == 0: ics = intl.ics_depure(ics)
            # add target torsions and depure the rest
            ics = clean_torsions_from_ics(ics, list(torsions))
            # check it is valid
            valid = True
            for idx2 in range(len(list_xcc)):
                if idx1 == idx2: continue
                xcc2 = list_xcc[idx2]
                gcc2 = list_gcc[idx2]
                Fcc2 = list_Fcc[idx2]
                ccfrqs2 = list_ccfrqs[idx2]
                # calc ic-freqs
                icfrqs2 = intl.calc_icfreqs(Fcc2, masses, xcc2, gcc2, ics)[0]
                # compare
                valid = fncs.same_freqs(ccfrqs2, icfrqs2)
                if not valid: break
            if valid: break
        if valid: break
    if valid: return ics
    else: return None
Beispiel #2
0
 def icfreqs(self,ics,bool_pg=False):
     #----------------#
     # Molecular case #
     #----------------#
     if self._natoms != 1:
        ituple = (self._Fcc,self._masses,self._xcc,self._gcc,ics,bool_pg)
        self._icfreqs, self._icFevals, self._icFevecs = intl.calc_icfreqs(*ituple)
     #-------------#
     # Atomic case #
     #-------------#
     else:
        self._icfreqs  = []
        self._icFevals = []
        self._icFevecs = []
     # scale frequencies
     self._icfreqs = [freq*self._fscal for freq in self._icfreqs]
Beispiel #3
0
def valid_nonredundant_set(ics, list_xcc, list_gcc, list_Fcc, list_ccfrqs,
                           symbols, masses, torsions):
    if ics is None: return None
    ics_torsions = [("pt", tuple(torsion)) for torsion in torsions]
    valid = False
    for idx1 in range(len(list_xcc)):
        xcc1 = list_xcc[idx1]
        gcc1 = list_gcc[idx1]
        Fcc1 = list_Fcc[idx1]
        ccfrqs1 = list_ccfrqs[idx1]
        # generate non-redundant from ics
        nrics, same = intl.nonredundant(xcc1,
                                        masses,
                                        gcc1,
                                        Fcc1,
                                        ics,
                                        ccfrqs1,
                                        unremov=list(ics_torsions))
        if not same: continue
        # clean torsions
        nrics = clean_torsions_from_ics(ics, torsions)
        # check it is valid
        valid = True
        for idx2 in range(len(list_xcc)):
            if idx1 == idx2: continue
            xcc2 = list_xcc[idx2]
            gcc2 = list_gcc[idx2]
            Fcc2 = list_Fcc[idx2]
            ccfrqs2 = list_ccfrqs[idx2]
            # calc ic-freqs
            icfrqs2 = intl.calc_icfreqs(Fcc2, masses, xcc2, gcc2, nrics)[0]
            # compare
            valid = fncs.same_freqs(ccfrqs2, icfrqs2)
            if not valid: break
        if valid: break
    if valid: return nrics
    else: return None