From 3c248d9dbefc9e2d79c8f19867ae58b4eae8fc49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Mon, 17 Feb 2025 13:17:47 +0100 Subject: [PATCH 1/4] fix inconsistencies in ORCA interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- src/mindlessgen/prog/config.py | 2 +- src/mindlessgen/qm/orca.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mindlessgen/prog/config.py b/src/mindlessgen/prog/config.py index 0162edd..ed931a6 100644 --- a/src/mindlessgen/prog/config.py +++ b/src/mindlessgen/prog/config.py @@ -741,7 +741,7 @@ class PostProcessConfig(BaseConfig): def __init__(self: PostProcessConfig) -> None: self._engine: str = "orca" - self._opt_cycles: int | None = 5 + self._opt_cycles: int | None = None self._optimize: bool = True self._debug: bool = False self._ncores: int = 4 diff --git a/src/mindlessgen/qm/orca.py b/src/mindlessgen/qm/orca.py index 31f2120..76e954a 100644 --- a/src/mindlessgen/qm/orca.py +++ b/src/mindlessgen/qm/orca.py @@ -171,7 +171,7 @@ def _gen_input( """ orca_input = f"! {self.cfg.functional} {self.cfg.basis}\n" orca_input += f"! DEFGRID{self.cfg.gridsize}\n" - orca_input += "! NoTRAH NoSOSCF SlowConv\n" + orca_input += "! NoTRAH\n" # "! AutoAux" keyword for super-heavy elements as def2/J ends at Rn if any(atom >= 86 for atom in molecule.ati): orca_input += "! AutoAux\n" @@ -179,9 +179,10 @@ def _gen_input( orca_input += "! OPT\n" if opt_cycles is not None: orca_input += f"%geom MaxIter {opt_cycles} end\n" - orca_input += ( - f"%scf\n\tMaxIter {self.cfg.scf_cycles}\n\tConvergence Medium\nend\n" - ) + orca_input += f"%scf\n\tMaxIter {self.cfg.scf_cycles}\n" + if not optimization: + orca_input += "\tConvergence Medium\n" + orca_input += "end\n" orca_input += f"%pal nprocs {ncores} end\n\n" orca_input += f"* xyzfile {molecule.charge} {molecule.uhf + 1} {xyzfile}\n" return orca_input From 0bcc7c71b994cec8eab96682a273cd41df483dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Mon, 17 Feb 2025 13:49:30 +0100 Subject: [PATCH 2/4] make new default more consistent; allow setting to 'none' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- CHANGELOG.md | 2 ++ mindlessgen.toml | 4 ++-- src/mindlessgen/prog/config.py | 14 +++++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0842e14..4a9032a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - dict keys for elemental compositions will now always be checked for validity - Renamed GP3-xTB to g-xTB - Moved constants and (empirical) parameters to the `data` module +- Default for optimization cycles in the postprocessing step set to program default (convergence) ### Deprecated - Nothing will be printed while multiple molecules are generated in parallel, tqdm-based progress bar instead @@ -20,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - support for TURBOMOLE as QM engine - updated the parallelization to work over the number of molecules - possibility to generate symmetrical molecules (choice from rotation, inversion, mirroring) +- Number of optimization steps in the postprocessing part can be set to program default by `none` ### Fixed - version string is now correctly formatted and printed diff --git a/mindlessgen.toml b/mindlessgen.toml index 2c29872..53c288e 100644 --- a/mindlessgen.toml +++ b/mindlessgen.toml @@ -69,8 +69,8 @@ ncores = 2 engine = "orca" # > Optimize geometry in the post-processing part. If `false`, only a single-point is conducted. Options: optimize = true -# > Optimization cycles for the post-processing part. If not given, the program default is chosen. Options: -opt_cycles = 5 +# > Optimization cycles for the post-processing part. If not given or set to "none" or 0, the program default is chosen. Options: or "none" +opt_cycles = "none" # > Debug this step. Leads to more verbose output as soon as the post-processing part is reached. Options: # > If `debug` is true, the process is terminated after the first (successful or not) post-processing step. # > Note: This option is only relevant if the 'postprocess' option in the 'general' section is set to 'true'. diff --git a/src/mindlessgen/prog/config.py b/src/mindlessgen/prog/config.py index ed931a6..a152d2b 100644 --- a/src/mindlessgen/prog/config.py +++ b/src/mindlessgen/prog/config.py @@ -795,10 +795,18 @@ def opt_cycles(self, opt_cycles: int): """ Set the optimization cycles for post-processing. """ - if not isinstance(opt_cycles, int): - raise TypeError("Optimization cycles should be an integer.") + if not isinstance(opt_cycles, (int, str)): + raise TypeError("Optimization cycles can only be an integer or a string.") + if isinstance(opt_cycles, str): + if opt_cycles.lower() != "none": + raise ValueError( + "Optimization cycles can only be an integer or 'none'." + ) + self._opt_cycles = None + if opt_cycles == 0: + self._opt_cycles = None if opt_cycles < 0: - raise ValueError("Optimization cycles should be 0 or greater.") + raise ValueError("Optimization cycles can only be 0 or greater.") self._opt_cycles = opt_cycles @property From dd0a918602c76bd6c0ee5e286ba1790aa05a8552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Mon, 17 Feb 2025 14:33:41 +0100 Subject: [PATCH 3/4] reduce printout as nobody sees it anyway MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- src/mindlessgen/qm/orca.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mindlessgen/qm/orca.py b/src/mindlessgen/qm/orca.py index 76e954a..1aa8cd8 100644 --- a/src/mindlessgen/qm/orca.py +++ b/src/mindlessgen/qm/orca.py @@ -171,6 +171,7 @@ def _gen_input( """ orca_input = f"! {self.cfg.functional} {self.cfg.basis}\n" orca_input += f"! DEFGRID{self.cfg.gridsize}\n" + orca_input += "! MiniPrint\n" orca_input += "! NoTRAH\n" # "! AutoAux" keyword for super-heavy elements as def2/J ends at Rn if any(atom >= 86 for atom in molecule.ati): From 6e265c2ff350618cb8ae0dc2ba299e893854b118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Mon, 17 Feb 2025 17:45:46 +0100 Subject: [PATCH 4/4] forgot some return statements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- src/mindlessgen/prog/config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mindlessgen/prog/config.py b/src/mindlessgen/prog/config.py index a152d2b..6b5ea2c 100644 --- a/src/mindlessgen/prog/config.py +++ b/src/mindlessgen/prog/config.py @@ -803,8 +803,10 @@ def opt_cycles(self, opt_cycles: int): "Optimization cycles can only be an integer or 'none'." ) self._opt_cycles = None + return if opt_cycles == 0: self._opt_cycles = None + return if opt_cycles < 0: raise ValueError("Optimization cycles can only be 0 or greater.") self._opt_cycles = opt_cycles