Created
August 7, 2020 12:01
-
-
Save hokru/f1b00a87665ac345415b4ad3e0006f1d to your computer and use it in GitHub Desktop.
tool to generate psi4 fchk files for many methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test FCHK file format | |
import numpy as np | |
import psi4 | |
import re | |
from ast import literal_eval | |
import sys | |
flag='' | |
# | |
# | |
np.set_printoptions(precision=12) | |
psi4.core.IOManager.shared_object().set_default_path('/Users/kruse/scratch/PSI4/FCHK') | |
def run_psi4fchk(geom,method,ref): | |
m_string=f"{flag}-{ref}-{method}" | |
psi4.set_options({'reference':ref}) | |
print(f"user method: {m_string}") | |
psi4.set_options({'reference':ref}) | |
print(ref) | |
e, wfn = psi4.gradient(method, return_wfn=True,mol=geom) | |
ret = psi4.driver.fchk(wfn, m_string+'.fchk',debug=True) | |
if ret is not None: | |
print('FCHK energy var:',ret["detected energy"],'label:',ret["selected label"]) | |
psi4.core.clean() | |
print("---") | |
return 0 | |
def run_test(m,skip=[]): | |
psi4.activate(geom_rhf) | |
run_psi4fchk(geom_rhf,m.upper(),ref='RHF') | |
if m in skip[:]: return | |
psi4.activate(geom_uhf) | |
run_psi4fchk(geom_uhf,m.upper(),ref='UHF') | |
return 0 | |
psi4.set_output_file("output.dat", False) | |
geom_uhf = psi4.geometry(""" | |
0 3 | |
O 0.0 0.0 0.0 | |
O 0.0 0.0 1.1 | |
""") | |
geom_rhf = psi4.geometry(""" | |
0 1 | |
O | |
H 1 1.0 | |
H 1 1.0 2 104.5 | |
""") | |
psi4.set_options({ | |
"BASIS": "pcseg-1", | |
}) | |
psi4.set_memory('1 GiB') | |
psi4.set_options({ | |
"SCF_TYPE": "DF", | |
"dct_type":"DF", | |
"cc_type":"df", | |
"df_basis_scf":"def2-universal-jkfit", | |
"df_basis_dct":"def2-svp-ri", | |
'mp2_type':'df', | |
'mp_type':'df', | |
}) | |
flag='DFMP2' | |
# DF correlated | |
psi4.set_options({'qc_module':'dfmp2'}) | |
run_test('mp2',['mp2']) | |
# DF SCF/DFT | |
flag='DF' | |
for m in ['scf','pbe']: | |
run_test(m,) | |
flag='DFOCC' | |
psi4.set_options({'qc_module':'occ'}) | |
for m in ['mp2','omp2','ccsd']: | |
run_test(m,['ccsd']) | |
# DCT | |
flag='DF' | |
run_test('dct') | |
#------------------------ | |
# CONV | |
flag='CONV' | |
# CONV SCF | |
for m in ['scf','pbe']: | |
run_test(m,) | |
# CCENERGY | |
psi4.set_options({'qc_module':'ccenergy'}) | |
psi4.set_options({ | |
'cc_type':'conv', | |
'scf_type':'pk', | |
'mp2_type':'conv' | |
}) | |
run_test('ccsd') | |
for m in ['ccsd','cc2']: | |
run_test(m) | |
# Turned off in driver | |
flag='OCC' | |
psi4.set_options({'qc_module':'occ'}) | |
for m in ['mp2']: | |
run_test(m) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment