Skip to content

Commit

Permalink
Merge pull request #35 from molssi-seamm/dev
Browse files Browse the repository at this point in the history
Updated for new open source mop and properties
  • Loading branch information
seamm authored Oct 20, 2022
2 parents 8a19838 + d5e7895 commit 3c16d3f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
14 changes: 7 additions & 7 deletions read_structure_step/formats/mop/find_mopac.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,37 @@ def find_mopac():

# Next try common locations
try:
mopac_exe = "/opt/mopac/MOPAC2016.exe"
mopac_exe = "/opt/mopac/mopac"

if os.path.isfile(mopac_exe) is False:
raise FileNotFoundError(
'The directory "/opt/mopac/" exists, but the executable \
"MOPAC2016.exe" is not there'
"mopac" is not there'
)
except FileNotFoundError:
try:
mopac_path = os.path.split(os.environ["mopac"])[0]
mopac_exe = mopac_path + "MOPAC2016.exe"
mopac_exe = mopac_path + "mopac"

if os.path.isfile(mopac_exe) is False:
raise FileNotFoundError(
'The environment variable "mopac" is defined, but \
the executable "MOPAC2016.exe" is not there'
the executable "mopac" is not there'
)
except (KeyError, FileNotFoundError):
try:
mopac_exe = Path(os.environ["MOPAC_LICENSE"]) / "MOPAC2016.exe"
mopac_exe = Path(os.environ["MOPAC_LICENSE"]) / "mopac"
mopac_exe = str(mopac_exe)

if os.path.isfile(mopac_exe) is False:
raise FileNotFoundError(
'The environment variable "mopac" is defined, but the \
executable "MOPAC2016.exe" is not there'
executable "mopac" is not there'
)

except (KeyError, FileNotFoundError):
try:
mopac_exe = seamm_util.check_executable("MOPAC2016.exe")
mopac_exe = seamm_util.check_executable("mopac")
except FileNotFoundError:
return None

Expand Down
39 changes: 21 additions & 18 deletions read_structure_step/formats/mop/obabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
logger = logging.getLogger("read_structure_step.read_structure")

metadata = {
"CP": "constant pressure heat capacity",
"CPR": "reference.constant pressure heat capacity",
"D": "dipole moment",
"DR": "dipole moment.reference",
"H": "enthalpy of formation",
"HR": "enthalpy of formation.reference",
"S": "entropy",
"SR": "entropy.reference",
"I": "ionization energy",
"IE": "ionization energy",
"IA": "ionization energy",
"IR": "ionization energy.reference",
"GR": "geometry.reference",
"CP": "constant pressure heat capacity#experiment",
"CPR": "reference.constant pressure heat capacity#experiment",
"D": "dipole moment#experiment",
"DR": "dipole moment.reference#experiment",
"H": "enthalpy of formation#experiment",
"HR": "enthalpy of formation.reference#experiment",
"S": "entropy#experiment",
"SR": "entropy.reference#experiment",
"I": "ionization energy#experiment",
"IE": "ionization energy#experiment",
"IA": "ionization energy#experiment",
"IR": "ionization energy.reference#experiment",
"GR": "geometry.reference#experiment",
}
multiplicities = {
"SINGLET": 1,
Expand Down Expand Up @@ -495,13 +495,13 @@ def load_mop(
if save_data:
properties = configuration.properties
if len(keywords) != 0:
key = "MOPAC.keywords"
key = "keywords#MOPAC"
properties.add(
key, "str", description="The keywords for MOPAC", noerror=True
)
properties.put(key, " ".join(keywords))
if len(description_lines) > 0:
key = "MOPAC.description"
key = "description#MOPAC"
properties.add(
key,
"str",
Expand All @@ -510,7 +510,7 @@ def load_mop(
)
properties.put(key, "\n".join(description_lines))
if energy is not None:
key = "MOPAC.reference energy"
key = "reference energy#MOPAC"
properties.add(
key,
"float",
Expand Down Expand Up @@ -552,13 +552,16 @@ def load_mop(
tmp = value.split(",")
value = tmp[0].strip()
stderr = tmp[1].strip()
tmp = keyword.split("#")
tmp[0] = tmp[0] + " stderr"
new_keyword = "#".join(tmp)
properties.add(
f"{keyword}.stderr",
new_keyword,
"float",
description=f"stderr for the {keyword}.",
noerror=True,
)
properties.put(f"{keyword}.stderr", stderr)
properties.put(new_keyword, stderr)
properties.put(keyword, value)
except Exception as e:
print(f"{e}: {key}")
Expand Down

0 comments on commit 3c16d3f

Please sign in to comment.