def frequencies(molecule, config): print("Determining normal modes and running frequency analysis...") total_energy, wavefunc = psi4.frequency(config['config_generator']['method'] + '/' + config['config_generator']['basis'], molecule=molecule, return_wfn=True) vib_info_raw = wavefunc.frequency_analysis vib_info = psi4.qcdb.vib.filter_nonvib(vib_info_raw) frequencies = wavefunc.frequencies().to_array() red_masses = vib_info["mu"].data normal_modes_raw = vib_info['x'].data normal_modes = [] num_modes = len(frequencies) num_atoms = molecule.natom() for i in range(num_modes): geometry = np.zeros((num_atoms, 3)) for atom in range(num_atoms): geometry[atom][0] = float(normal_modes_raw[3 * atom + 0][i]) geometry[atom][1] = float(normal_modes_raw[3 * atom + 1][i]) geometry[atom][2] = float(normal_modes_raw[3 * atom + 2][i]) normal_modes.append(geometry) print("Normal mode/frequency analysis complete.") print("") return normal_modes, frequencies, red_masses
def calc_vib_freq(smiles): mol = Chem.MolFromSmiles(smiles) xyz, mol = mol_to_xyz(mol) psi4.set_memory('4 GB') psi4.set_num_threads(4) method_basis = args.method + '/' + args.basis geom = psi4.geometry(xyz) e, wfn = psi4.frequency(method_basis, molecule=geom, return_wfn=True) print("SMILES: " + smiles + ", Vibrational Frequency Energy: " + str(e)) return e
def main(): psi4.set_output_file("pbeh3c_mol.dat", True) #psi4.set_memory('500 MB') numpy_memory = 2 mol = psi4.geometry(""" 1 1 C 3.533276577335 0.297516950079 -0.033740208753 C 2.574760938246 1.278066479179 -0.069835787116 C 1.253218752224 0.849739147834 -0.039258570370 C 0.899019257306 -0.495860874701 0.032550031024 C 1.888860870465 -1.490197119704 0.067078565308 C 3.204596438039 -1.081456560919 0.033430560670 O 4.250570460820 -1.915645303151 0.060360861113 C -0.521891091036 -0.526599835195 0.052806016194 C -0.907216553266 0.796770182506 -0.010855959829 O 0.163856617883 1.625333309480 -0.070535693831 C -2.142468145732 1.509067711325 -0.077871153394 O -2.328114248487 2.665835310257 -0.269517118360 N -3.421527194392 0.695313957156 0.191159341639 C -3.581807216427 -0.692769910170 -0.352292538279 C -2.772392782598 -1.705499205563 0.431794190569 C -1.307831296645 -1.790976049117 0.040569332872 H 4.581064582865 0.566654620917 -0.057341951344 H 2.837749742920 2.324943817097 -0.122662938228 H 1.625749586779 -2.540289226583 0.117596634162 H 3.972628181395 -2.834781214964 0.105049915868 H -3.557445242160 0.671475310656 1.206814356133 H -4.167512313144 1.297833117167 -0.169560281990 H -4.646108631113 -0.913660797798 -0.283335352767 H -3.313356183445 -0.663729781207 -1.408465575248 H -2.877036964703 -1.518274278002 1.505474270168 H -3.228135005269 -2.682198217407 0.265368459879 H -1.225392070756 -2.220062054576 -0.963992292922 H -0.817581075574 -2.508114264473 0.702369958893 """) #psi4.energy('mp2/cc-pvdz', molecule=mol) #psi4.energy('scf/cc-pvdz', molecule=mol) psi4.energy('pbeh3c/', molecule=mol) # default is def2-mSVP #psi4.optimize('pbeh3c/', molecule=mol) # default is def2-mSVP psi4.frequency('pbeh3c/', molecule=mol) # default is def2-mSVP
H 0.21028 2.41258 0.00000 H -1.21638 2.69390 -0.96879 H -1.21639 3.11091 0.72802 H -1.21639 1.43293 0.24076 """) # Geometry optimization psi4.set_output_file(file_prefix + '_geomopt.dat', False) psi4.set_options({'g_convergence': 'gau_tight'}) psi4.optimize('scf/cc-pVDZ', molecule=ch4) # Run vibrational frequency analysis psi4.set_output_file(file_prefix + '_vibfreq.dat', False) scf_energy, scf_wfn = psi4.frequency('scf/cc-pVDZ', molecule=ch4, return_wfn=True, dertype='gradient') # Save "raw" frequencies into a variable scf_wfn_freq = scf_wfn.frequency_analysis['omega'][2] print(scf_wfn_freq) # Eliminate imaginary parts of frequencies, scf_wfn_real=scf_wfn_freq.real # round the frequencies (to the nearest whole number), scf_wfn_round=np.rint(scf_wfn_real) # and extract only the *non-zero* frequencies scf_wfn_nonzero=np.extract(scf_wfn_round>0, scf_wfn_round) # Determine the unique non-zero frequencies and
def calculate_frequency(mol: psi4.core.Molecule, method: str = "wB97X/6-31g*"): e, wfn = psi4.frequency(method, molecule=mol, return_wfn=True) return (e * hartree_to_kJ_mol) * unit.kilojoule_per_mole, wfn
import psi4 #as psi4 import numpy as np psi4.set_output_file("output.dat", True) psi4.set_memory('500 MB') numpy_memory = 2 h2o = psi4.geometry(""" O 0.0 0.0 0.0 H 1.0 0.0 0.0 H 0.0 1.0 0.0 symmetry c1 """) #psi4.set_options({'basis': 'cc-pcdz'}) psi4.energy('scf/cc-pvdz', molecule=h2o) psi4.optimize('scf/cc-pvdz', molecule=h2o) scf_e, scf_wfn = psi4.frequency('scf/cc-pvdz', molecule=h2o, return_wfn=True, dertype=1)
def cmd(method, mol): frequency(method, molecule=mol)
SP 3 1.00 5.0331513 -0.09996723 0.15591627 1.1695961 0.39951283 0.60768372 0.3803890 0.70011547 0.39195739 **** """ return basstrings qcdb.libmintsbasisset.basishorde['STO-3G_DALTON'] = define_custom_basis core.set_global_option("BASIS", "STO-3G_dalton") psi4.set_options(options) # Perform SCF Energy Calculation rhf_e, wfn = psi4.frequency('SCF', return_wfn=True) # Relevant Variables natoms = mol.natom() nmo = wfn.nmo() nocc = wfn.doccpi()[0] nvir = nmo - nocc # MO Coefficients C = wfn.Ca_subset("AO", "ALL") npC = psi4.core.Matrix.to_array(C) # Integral generation from Psi4's MintsHelper mints = psi4.core.MintsHelper(wfn.basisset()) # Build T, V, and S