Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from grimme-lab:main #6

Merged
merged 1 commit into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ Explainations on the commandline arguments can be printed by:
Requirements:
-------------

* newest xtb (currently: https://github.com/grimme-lab/xtb/releases/tag/v6.4.0 )
* newest xtb >= v6.4.0
* newest cefine https://github.com/grimme-lab/cefine/releases
* ORCA > version 4.1 and below 5.0.0 !!!
* ORCA > version 4.1


Further information (will be ordered later on):
Expand All @@ -112,8 +112,8 @@ Further information (will be ordered later on):
* a folder ~/.censo_assets/ will be created upon usage of censo
* ORCA has not been tested extensively so please be careful, test calculations
and report possible "bad" settings
* To be efficient COSMO-RS calculations are not performed with BP86 but whith the functionals
for energy evaluation.
* To save computational cost COSMO-RS calculations are not performed with BP86 but whith the
density functionals for energy evaluation.


Usage:
Expand All @@ -134,23 +134,23 @@ The molecule numbering from the input structure ensemble is kept throughout the
entire program. There are several program parts which can be used to filter a structure
ensemble:

0) Cheap prescreening (part0): Very fast DFT energies in order to improve upon the energy
1) Cheap prescreening (part0): Very fast DFT energies in order to improve upon the energy
description of the SQM method used to generate the input structure ensemble.
The (free) energies are evaluated on the input geometries (DFT unoptimized).

1) Prescreening (part1): Improved DFT energies and accurate solvation energies (if needed).
2) Prescreening (part1): Improved DFT energies and accurate solvation energies (if needed).
The free energies are evaluated on the input geometries (DFT unoptimized).

2) Optimization (part2): efficient structure ensemble optimization and
3) Optimization (part2): efficient structure ensemble optimization and
free energy calculation on DFT optimized geometries.

3) Refinement (part3): Optional free energy refinement (on DFT optimized geometries).
4) Refinement (part3): Optional free energy refinement (on DFT optimized geometries).
E.g. using hybrid DFA with large basis set.

4) NMR properties (part4): Optional calculation of shielding and coupling constants on
5) NMR properties (part4): Optional calculation of shielding and coupling constants on
populated conformers.

5) Optical Rotation (part5): Optional calculation of optical rotatory dispersion
6) Optical Rotation (part5): Optional calculation of optical rotatory dispersion
for the populated ensemble.


Expand All @@ -169,9 +169,15 @@ holds for *maxcor* and/or *rpacor*.
For ORCA user:
--------------

CENSO currently does not work with the new ORCA 5.x release. In the new ORCA release
changes to the input have been introduced (e.g. DFT grids) and the input creation
inside CENSO has to be updated.
CENSO has been updated to work with the new ORCA 5.0.1 release. The user has to provide the matching
ORCA version number in the `.cefinerc` file in order for the correct ORCA input generation
to work, e.g.

.. code::

ORCA: /tmp1/orca_5_0_1_linux_x86-64_openmpi411
ORCA version: 5.0.1


Available solvation models:
---------------------------
Expand Down
11 changes: 9 additions & 2 deletions censo_qm/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
import sys

__version__ = "1.1.1"
__version__ = "1.1.2"

DESCR = f"""
______________________________________________________________
Expand Down Expand Up @@ -206,7 +206,7 @@ class dfa_settings:
},
"r2scan-3c": {
"tm": "r2scan-3c",
"orca": None,
"orca": "r2scan-3c",
"disp": "composite",
"part": [
"func0",
Expand Down Expand Up @@ -634,6 +634,13 @@ class dfa_settings:
"part": ["func0", "func", "func3", "func_j", "func_s"],
"type": "rsh_hybrid",
},
"wb97x-d4": {
"tm": None,
"orca": "wb97x-d4",
"disp": "included",
"part": ["func0", "func", "func3", "func_j", "func_s"],
"type": "rsh_hybrid",
},
"dsd-blyp-d3": {
"tm": None,
"orca": "ri-dsd-blyp",
Expand Down
87 changes: 62 additions & 25 deletions censo_qm/inputhandling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,7 @@ class internal_settings:
"ethylacetate_c0",
"furane_c0",
"phenol_c0",
"1,2-dichloroethane_c0",
]

# only using the dielectric constant (DC) for cosmo
Expand Down Expand Up @@ -2230,6 +2231,11 @@ def check_logic(self, error_logical=False, silent=False):
self.func_or_scf = self.func_info.relay_functionals.get(
self.func_or_scf, self.func_or_scf
)
# extracheck for r2scan-3c and ORCA
try:
orcaversion = int(self.external_paths['orcaversion'].split('.')[0])
except (ValueError, AttributeError):
orcaversion = 2
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Handle func0
# available with QM code
Expand All @@ -2240,6 +2246,11 @@ def check_logic(self, error_logical=False, silent=False):
f"(func0) {self.func0} is not implemented with the {self.prog} program package.\n"
)
error_logical = True
if (self.func0 == "r2scan-3c" and
self.prog == "orca" and
orcaversion < 5):
self.save_errors.append(f"{'WARNING:':{WARNLEN}}The composite "+
"functional r2scan-3c is only available in ORCA since version 5.0.0 !")
# check if available for part0
if self.func0 not in self.func_info.infos("func0"):
self.save_errors.append(
Expand Down Expand Up @@ -2290,6 +2301,11 @@ def check_logic(self, error_logical=False, silent=False):
f"(func) {self.func} is not implemented with the {self.prog} program package.\n"
)
error_logical = True
if (self.func == "r2scan-3c" and
self.prog == "orca" and
orcaversion < 5):
self.save_errors.append(f"{'WARNING:':{WARNLEN}}The composite "+
"functional r2scan-3c is only available in ORCA since version 5.0.0 !")
# check if available for part1 / part2
if self.func not in self.func_info.infos("func"):
self.save_errors.append(
Expand Down Expand Up @@ -2387,6 +2403,11 @@ def check_logic(self, error_logical=False, silent=False):
f"(func3) {self.func3} is not implemented with the {self.prog3} program package.\n"
)
error_logical = True
if (self.func3 == "r2scan-3c" and
self.prog3 == "orca" and
orcaversion< 5):
self.save_errors.append(f"{'WARNING:':{WARNLEN}}The composite "+
"functional r2scan-3c is only available in ORCA since version 5.0.0 !")
# check if available for part3
if self.func3 not in self.func_info.infos("func3"):
self.save_errors.append(
Expand All @@ -2408,6 +2429,11 @@ def check_logic(self, error_logical=False, silent=False):
"program package.\n"
)
error_logical = True
if (self.func_j == "r2scan-3c" and
self.prog4_j == "orca" and
orcaversion < 5):
self.save_errors.append(f"{'WARNING:':{WARNLEN}}The composite "+
"functional r2scan-3c is only available in ORCA since version 5.0.0 !")
# check if available for part4
if self.func_j not in self.func_info.infos("func_j"):
self.save_errors.append(
Expand Down Expand Up @@ -2449,6 +2475,11 @@ def check_logic(self, error_logical=False, silent=False):
"program package.\n"
)
error_logical = True
if (self.func_s == "r2scan-3c" and
self.prog4_s == "orca" and
orcaversion < 5):
self.save_errors.append(f"{'WARNING:':{WARNLEN}}The composite "+
"functional r2scan-3c is only available in ORCA since version 5.0.0 !")
# check if available for part4
if self.func_s not in self.func_info.infos("func_s"):
self.save_errors.append(
Expand Down Expand Up @@ -3499,19 +3530,22 @@ def create_SI(self, ensembledata):
for line in out_bib:
print(line)

def read_program_paths(self, configpath):
def read_program_paths(self, configpath, silent=False):
"""
Get absolute paths of external programs employed in enso
Read from the configuration file .censorc
"""
if silent:
keep = self.save_errors

with open(configpath, "r") as inp:
stor = inp.readlines()
for line in stor:
if "ctd =" in line:
try:
self.external_paths["cosmorssetup"] = str(line.rstrip(os.linesep))
except Exception:
print(
self.save_errors.append(
f"{'WARNING:':{WARNLEN}}Could not read settings for COSMO-RS from .censorc!"
)
try:
Expand All @@ -3527,8 +3561,8 @@ def read_program_paths(self, configpath):
tmp_path, normal
)
except Exception as e:
print(e)
print(
self.save_errors.append(e)
self.save_errors.append(
f"{'WARNING:':{WARNLEN}}Could not read settings for COSMO-RS from "
f".censorc!\n{'':{WARNLEN}}Most probably there is a user "
"input error."
Expand All @@ -3537,7 +3571,7 @@ def read_program_paths(self, configpath):
try:
self.external_paths["orcapath"] = str(line.split()[1])
except Exception:
print(
self.save_errors.append(
f"{'WARNING:':{WARNLEN}}Could not read path for ORCA from .censorc!."
)
if "ORCA version:" in line:
Expand All @@ -3548,50 +3582,53 @@ def read_program_paths(self, configpath):
tmp = "".join(tmp)
self.external_paths["orcaversion"] = tmp
except Exception:
print(
self.save_errors.append(
f"{'WARNING:':{WARNLEN}}Could not read ORCA version from .censorc!"
)
if "GFN-xTB:" in line:
try:
self.external_paths["xtbpath"] = str(line.split()[1])
except Exception:
print(
self.save_errors.append(
f"{'WARNING:':{WARNLEN}}Could not read path for GFNn-xTB from .censorc!"
)
if shutil.which("xtb") is not None:
self.external_paths["xtbpath"] = shutil.which("xtb")
print(
self.save_errors.append(
f"{'':{WARNLEN}}Going to use {self.external_paths['xtbpath']} instead."
)
if "CREST:" in line:
try:
self.external_paths["crestpath"] = str(line.split()[1])
except Exception:
print(
self.save_errors.append(
f"{'WARNING:':{WARNLEN}}Could not read path for CREST from .censorc!"
)
if shutil.which("crest") is not None:
self.external_paths["crestpath"] = shutil.which("crest")
print(
self.save_errors.append(
f"{'':{WARNLEN}}Going to use {self.external_paths['crestpath']} instead."
)
if "mpshift:" in line:
try:
self.external_paths["mpshiftpath"] = str(line.split()[1])
except Exception:
print(
self.save_errors.append(
f"{'WARNING:':{WARNLEN}}Could not read path for mpshift from .censorc!"
)
if "escf:" in line:
try:
self.external_paths["escfpath"] = str(line.split()[1])
except Exception:
print(
self.save_errors.append(
f"{'WARNING:':{WARNLEN}}Could not read path for escf from .censorc!"
)
if "$ENDPROGRAMS" in line:
break

if silent:
self.save_errors = keep

def needed_external_programs(self):
"""
Automatically checks which external programs are required for the
Expand Down Expand Up @@ -3739,28 +3776,28 @@ def processQMpaths(self, requirements, error_logical):
self.external_paths["crestpath"] is None
or shutil.which(self.external_paths["crestpath"]) is None
):
print(f"{'ERROR:':{WARNLEN}}path for CREST is not correct!")
self.save_errors.append(f"{'ERROR:':{WARNLEN}}path for CREST is not correct!")
error_logical = True
# xTB
if requirements.get("needxtb", False):
if (
self.external_paths["xtbpath"] is None
or shutil.which(self.external_paths["xtbpath"]) is None
):
print(f"{'ERROR:':{WARNLEN}}path for xTB is not correct!")
self.save_errors.append(f"{'ERROR:':{WARNLEN}}path for xTB is not correct!")
error_logical = True
try:
ENVIRON["OMP_NUM_THREADS"] = "{:d}".format(self.omp)
except Exception:
print(f"{'ERROR:':{WARNLEN}}can not set omp for xTB calculation!")
self.save_errors.append(f"{'ERROR:':{WARNLEN}}can not set omp for xTB calculation!")
# ORCA
if requirements.get("needorca", False):
if (
self.external_paths["orcapath"] is None
or shutil.which(os.path.join(self.external_paths["orcapath"], "orca"))
is None
):
print(f"{'ERROR:':{WARNLEN}}path for ORCA is not correct!")
self.save_errors.append(f"{'ERROR:':{WARNLEN}}path for ORCA is not correct!")
error_logical = True
# cefine
if requirements.get("needcefine", False):
Expand All @@ -3780,10 +3817,10 @@ def processQMpaths(self, requirements, error_logical):
print(" Using cefine from {}".format(path_to_cefine))
self.external_paths["cefinepath"] = path_to_cefine
else:
print(
self.save_errors.append(
f"{'ERROR:':{WARNLEN}}cefine (the commandline program for define) has not been found!"
)
print(f"{'':{WARNLEN}}all programs needing TM can not start!")
self.save_errors.append(f"{'':{WARNLEN}}all programs needing TM can not start!")
error_logical = True
# TM
if requirements.get("needtm", False):
Expand All @@ -3802,14 +3839,14 @@ def processQMpaths(self, requirements, error_logical):
error_logical = True
raise
else:
print(
self.save_errors.append(
f"{'ERROR:':{WARNLEN}}PARA_ARCH has to be set to SMP for parallel TM "
"calculations!"
)
if self.run:
error_logical = True
except Exception:
print(
self.save_errors.append(
f"{'ERROR:':{WARNLEN}}PARA_ARCH has to be set to SMP and PARNODES have to "
f"be set\n{'':{WARNLEN}}for parallel TM calculations!."
)
Expand All @@ -3821,31 +3858,31 @@ def processQMpaths(self, requirements, error_logical):
self.external_paths["escfpath"] is None
or shutil.which(self.external_paths["escfpath"]) is None
):
print(f"{'ERROR:':{WARNLEN}}path for escf is not correct!")
self.save_errors.append(f"{'ERROR:':{WARNLEN}}path for escf is not correct!")
error_logical = True
if requirements.get("needmpshift", False):
if (
self.external_paths["mpshiftpath"] is None
or shutil.which(self.external_paths["mpshiftpath"]) is None
):
print(f"{'ERROR:':{WARNLEN}}path for mpshift is not correct!")
self.save_errors.append(f"{'ERROR:':{WARNLEN}}path for mpshift is not correct!")
error_logical = True
# COSMORS
if requirements.get("needcosmors", False):
if self.external_paths["cosmorssetup"] is None:
print(
self.save_errors.append(
f"{'ERROR:':{WARNLEN}}Set up for COSMO-RS has to be written to .censorc!"
)
error_logical = True
if self.external_paths["cosmothermversion"] is None:
print(
self.save_errors.append(
f"{'ERROR:':{WARNLEN}}Version of COSMO-RS has to be written to .censorc!"
)
error_logical = True
if shutil.which("cosmotherm") is not None:
print(" Using COSMOtherm from {}".format(shutil.which("cosmotherm")))
else:
print(f"{'ERROR:':{WARNLEN}}COSMOtherm has not been found!")
self.save_errors.append(f"{'ERROR:':{WARNLEN}}COSMOtherm has not been found!")
error_logical = True
# update cfg.external paths
external_paths.update(self.external_paths)
Expand Down
Loading