Skip to content

Commit

Permalink
Try both initden and OLDMOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
greghjones committed Feb 23, 2024
1 parent 049eaef commit 9e1ea20
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions pysisyphus/calculators/CFOUR.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def __init__(
cfour_input,
wavefunction_dump=True,
initden_file=None,
oldmos_file=None,
**kwargs,
):
"""CFOUR calculator.
Expand All @@ -130,14 +131,16 @@ def __init__(
self.inp_fn = "ZMAT"
self.out_fn = "out.log"
self.gradient_fn = "GRD"
self.to_keep = ("out.log", "density:__den.dat")
self.to_keep = ("out.log", "density:__den.dat", "mos:NEWMOS")
self.initden = None
self.wavefunction_dump = wavefunction_dump

if self.wavefunction_dump:
self.to_keep = self.to_keep + ("MOLDEN*",)
if initden_file:
self.initden = initden_file
if oldmos_file:
self.mos = oldmos_file

self.base_cmd = self.get_cmd("cmd")
self.parser_funcs = {
Expand All @@ -158,12 +161,15 @@ def prepare(self, inp):
path = super().prepare(inp)
if self.initden:
shutil.copy(self.initden, f"{path}/initden.dat")
if self.oldmos:
shutil.copy(self.mos, f"{path}/OLDMOS")
return path

def keep(self, path):
kept_fns = super().keep(path)
try:
self.initden = kept_fns["density"]
self.mos = kept_fns["mos"]
except KeyError:
self.log("den.dat not found!")

Expand Down Expand Up @@ -247,18 +253,23 @@ def run_calculation(self, atoms, coords, calc_type, **prepare_kwargs):
return results

def get_chkfiles(self):
self.log("Called get_chkfiles")
return {
"initden": self.initden,
"mos": self.mos,
}


def set_chkfiles(self, chkfiles):
self.log("Called set_chkfiles")
try:
initden = chkfiles["initden"]
mos = chkfiles["mos"]
self.initden = initden
self.log(f"Set chkfile '{initden}' as initden.")
self.mos = mos
self.log(f"Set chkfile '{initden}' as initden and {mos} as OLDMOS.")
except KeyError:
self.log("Found no initden information in chkfiles!")
self.log("Missing either initden or OLDMOS in chkfiles")


def __str__(self):
Expand Down

0 comments on commit 9e1ea20

Please sign in to comment.