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

Fix inconsistencies in ORCA interface #125

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions mindlessgen.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ ncores = 2
engine = "orca"
# > Optimize geometry in the post-processing part. If `false`, only a single-point is conducted. Options: <bool>
optimize = true
# > Optimization cycles for the post-processing part. If not given, the program default is chosen. Options: <int>
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: <int> or "none"
opt_cycles = "none"
# > Debug this step. Leads to more verbose output as soon as the post-processing part is reached. Options: <bool>
# > 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'.
Expand Down
16 changes: 12 additions & 4 deletions src/mindlessgen/prog/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions src/mindlessgen/qm/orca.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,19 @@ 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 += "! 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):
orca_input += "! AutoAux\n"
if optimization:
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
Expand Down