示例#1
0
    def __init__(self, scf, df_basis_name=''):
        self.df_basis_name = df_basis_name
        self.nocc, self.ntot, self.e, self.gao, self.E_scf, self.molecule = scf.nocc, scf.ntot, scf.e, scf.g, scf.E_scf, scf.molecule

        if self.df_basis_name:
            df_basis = BasisSet.build(self.molecule, 'DF_BASIS_MP2', df_basis_name, puream=0)
            self.gmo = transform_integrals_df(scf.C, scf.basis, df_basis, bool(scf.spin))
        else:
            if scf.spin != 0 and len(scf.H) == len(self.gao):
                self.gao = block_tei(self.gao)
            self.gmo = transform_integrals(scf.C, self.gao)
示例#2
0
def modeVectorsQCDB(mol, hessian, modesToReturn=None, print_lvl=1, pr=print):
    Natom = mol.natom()
    geom = mol.geometry().to_array()
    masses = np.asarray([mol.mass(at) for at in range(Natom)])
    atom_symbols = [mol.symbol(at) for at in range(Natom)] 

    pr("\n\tCalculating normal modes; Input coordinates (bohr)\n")
    for i in range(Natom):
        pr("\t{:5s}{:10.5f}{:15.10f}{:15.10f}{:15.10f}\n".format(
           atom_symbols[i],masses[i],geom[i,0],geom[i,1],geom[i,2]))

    basis = BasisSet.build(mol) # dummy bs to lookup symmetry info
    irrep_lbls = mol.irrep_labels() # labels of IRREPs if molecule has symmetry
    dipder = None  # unneeded dipole-moment derivatives unless we add intensities

    vibinfo, vibtext = qcdb.vib.harmonic_analysis(hessian, geom, masses, basis,
                        irrep_lbls, dipder, project_trans=True, project_rot=True)

    # pr(vibtext)
    freqs = vibinfo['omega'].data.real
    # modes from vibinfo are unmass-weighted, not normalized, returned as cols
    # in amu^-1/2 ; convert here to au^-1/2
    modes = sqrt(pc_au2amu) * vibinfo['w'].data.T

    # Resort from high to low freqs
    modes[:] = np.flip(modes, axis=0)
    freqs[:] = np.flip(freqs)

    pr("\n\t----------------------\n")
    pr("\t Mode #   Harmonic      \n")
    pr("\t          Freq. (cm-1)  \n")
    pr("\t------------------------\n")
    for i in range(0,3*Natom):
        if freqs[i] < 0.0:
            pr("\t  %3d   %10.2fi\n" % (i, abs(freqs[i])))
        else:
            pr("\t  %3d   %10.2f \n" % (i, freqs[i]))

    selected_modes = np.zeros( (len(modesToReturn),3*Natom))
    selected_freqs = np.zeros( len(modesToReturn) )

    for i, mode in enumerate(modesToReturn):
        selected_modes[i,:] = modes[mode,:]
        selected_freqs[i] = freqs[mode]

    pr("\nFrequencies (with modes) returned from modeVectorsPsi4.\n")
    pr(str(selected_freqs)+'\n')

    if print_lvl > 1:
        pr("\nVectors returned from modeVectorsPsi4 are rows.\n")
        pr(str(selected_modes)+'\n')

    return (selected_modes, selected_freqs)
示例#3
0
    def __init__(self, scf, df_basis_name=''):
        self.df_basis_name = df_basis_name
        self.nocc, self.ntot, self.e, self.gao, self.E_scf, self.molecule = scf.nocc, scf.ntot, scf.e, scf.g, scf.E_scf, scf.molecule

        if self.df_basis_name:
            df_basis = BasisSet.build(self.molecule,
                                      'DF_BASIS_MP2',
                                      df_basis_name,
                                      puream=0)
            self.gmo = transform_integrals_df(scf.C, scf.basis, df_basis,
                                              bool(scf.spin))
        else:
            if scf.spin != 0 and len(scf.H) == len(self.gao):
                self.gao = block_tei(self.gao)
            self.gmo = transform_integrals(scf.C, self.gao)