Skip to content

Commit

Permalink
adding HF option (#4)
Browse files Browse the repository at this point in the history
option to prepare control file for a Hartree Fock calculation. 
Usage:

`tmprep -hf ` or `tmprep -wfunc hf`
  • Loading branch information
fabothch authored Apr 7, 2021
1 parent ac5b883 commit 5a6bfa1
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions tmprep.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import argparse
from collections import Counter

version = "0.1.2"
version = "0.1.3"

def read_chrg(default=0):
# READ .CHRG .UHF
Expand Down Expand Up @@ -84,6 +84,7 @@ def cml(internal_defaults, solvent_dcosmors, argv=None):
"""
)
group0 = parser.add_mutually_exclusive_group(required=True)
group1 = parser.add_argument_group("Options")
group1.add_argument(
"-chrg",
Expand All @@ -105,7 +106,7 @@ def cml(internal_defaults, solvent_dcosmors, argv=None):
metavar="",
help="Integer number of unpaired electrons of the molecule.",
)
group1.add_argument(
group0.add_argument(
"-func",
"--func",
dest="functional",
Expand All @@ -114,6 +115,23 @@ def cml(internal_defaults, solvent_dcosmors, argv=None):
metavar="",
help="Density functional aproximation.",
)
group0.add_argument(
"-wfunc",
"--wfunc",
dest="wave_func",
action="store",
required=False,
metavar="",
help="Wavefunction based method. E.g. HF.",
)
group0.add_argument(
"-hf",
"--hf",
dest="hf",
action="store_true",
required=False,
help="Selecting Hartree Fock (HF).",
)
group1.add_argument(
"-basis",
"--basis",
Expand Down Expand Up @@ -265,6 +283,14 @@ def cml(internal_defaults, solvent_dcosmors, argv=None):
help=("Create auxbasis file."),
)
args = parser.parse_args(argv)
if args.hf:
args.wave_func ="hf"
try:
delattr(args, "hf")
except Exception as e:
print(e)
if args.wave_func:
args.wave_func = getattr(args, "wave_func").lower()
if args.functional:
args.functional = getattr(args, "functional").lower()
if args.basis:
Expand Down Expand Up @@ -587,8 +613,12 @@ def cml(internal_defaults, solvent_dcosmors, argv=None):
if args.novdw:
args.disp = ""

if args.functional and not args.wave_func:
tmp_method = args.functional
else:
tmp_method = args.wave_func
print("Settings: {}/{} scfconv {} grid {}".format(
args.functional, args.basis, args.scfconv, args.grid)
tmp_method, args.basis, args.scfconv, args.grid)
)

#------- write basis file-------------------------------------------------------
Expand Down Expand Up @@ -863,7 +893,7 @@ def cml(internal_defaults, solvent_dcosmors, argv=None):
if args.gen_auxbas:
out.write('$jbas file=auxbasis \n')
out.write("$scforbitalshift automatic=0.1 \n")
if args.functional:
if args.functional and not args.wave_func:
out.write("$dft\n")
if args.xcfun: # currently only kt1 kt2
# can be improved for sure, currently just as a demonstration
Expand Down

0 comments on commit 5a6bfa1

Please sign in to comment.