stjames 0.0.43__tar.gz → 0.0.44__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of stjames might be problematic. Click here for more details.
- {stjames-0.0.43/stjames.egg-info → stjames-0.0.44}/PKG-INFO +1 -1
- {stjames-0.0.43 → stjames-0.0.44}/pyproject.toml +1 -1
- {stjames-0.0.43 → stjames-0.0.44}/stjames/molecule.py +2 -0
- stjames-0.0.44/stjames/settings.py +216 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/workflows/bde.py +14 -25
- {stjames-0.0.43 → stjames-0.0.44}/stjames/workflows/molecular_dynamics.py +2 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/workflows/multistage_opt.py +10 -4
- {stjames-0.0.43 → stjames-0.0.44}/stjames/workflows/spin_states.py +1 -13
- {stjames-0.0.43 → stjames-0.0.44}/stjames/workflows/workflow.py +18 -22
- {stjames-0.0.43 → stjames-0.0.44/stjames.egg-info}/PKG-INFO +1 -1
- {stjames-0.0.43 → stjames-0.0.44}/stjames.egg-info/SOURCES.txt +2 -1
- stjames-0.0.44/tests/test_settings.py +34 -0
- stjames-0.0.43/stjames/settings.py +0 -209
- {stjames-0.0.43 → stjames-0.0.44}/LICENSE +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/README.md +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/setup.cfg +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/__init__.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/_deprecated_solvent_settings.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/atom.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/base.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/basis_set.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/calculation.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/constraint.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/correction.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/data/__init__.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/data/bragg_radii.json +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/data/elements.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/data/isotopes.json +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/data/nist_isotopes.json +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/data/read_nist_isotopes.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/data/symbol_element.json +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/diis_settings.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/grid_settings.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/int_settings.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/message.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/method.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/mode.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/opt_settings.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/periodic_cell.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/py.typed +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/scf_settings.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/solvent.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/status.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/task.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/thermochem_settings.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/types.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/workflows/__init__.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/workflows/admet.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/workflows/basic_calculation.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/workflows/conformer.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/workflows/descriptors.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/workflows/fukui.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/workflows/pka.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/workflows/redox_potential.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/workflows/scan.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames/workflows/tautomer.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames.egg-info/dependency_links.txt +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames.egg-info/requires.txt +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/stjames.egg-info/top_level.txt +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/tests/test_from_extxyz.py +0 -0
- {stjames-0.0.43 → stjames-0.0.44}/tests/test_molecule.py +0 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
from typing import Any, Optional, Self, TypeVar
|
|
2
|
+
|
|
3
|
+
from pydantic import computed_field, field_validator, model_validator
|
|
4
|
+
|
|
5
|
+
from .base import Base, UniqueList
|
|
6
|
+
from .basis_set import BasisSet
|
|
7
|
+
from .correction import Correction
|
|
8
|
+
from .method import METHODS_WITH_CORRECTION, PREPACKAGED_METHODS, Method
|
|
9
|
+
from .mode import Mode
|
|
10
|
+
from .opt_settings import OptimizationSettings
|
|
11
|
+
from .scf_settings import SCFSettings
|
|
12
|
+
from .solvent import SolventSettings
|
|
13
|
+
from .task import Task
|
|
14
|
+
from .thermochem_settings import ThermochemistrySettings
|
|
15
|
+
|
|
16
|
+
_T = TypeVar("_T")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class Settings(Base):
|
|
20
|
+
mode: Mode = Mode.AUTO
|
|
21
|
+
|
|
22
|
+
method: Method = Method.HARTREE_FOCK
|
|
23
|
+
basis_set: Optional[BasisSet] = None
|
|
24
|
+
tasks: UniqueList[Task] = [Task.ENERGY, Task.CHARGE, Task.DIPOLE]
|
|
25
|
+
corrections: UniqueList[Correction] = []
|
|
26
|
+
|
|
27
|
+
solvent_settings: Optional[SolventSettings] = None
|
|
28
|
+
|
|
29
|
+
# scf/opt settings will be set automatically based on mode, but can be overridden manually
|
|
30
|
+
scf_settings: SCFSettings = SCFSettings()
|
|
31
|
+
opt_settings: OptimizationSettings = OptimizationSettings()
|
|
32
|
+
thermochem_settings: ThermochemistrySettings = ThermochemistrySettings()
|
|
33
|
+
|
|
34
|
+
# mypy has this dead wrong (https://docs.pydantic.dev/2.0/usage/computed_fields/)
|
|
35
|
+
# Python 3.12 narrows the reason for the ignore to prop-decorator
|
|
36
|
+
@computed_field # type: ignore[misc, prop-decorator, unused-ignore]
|
|
37
|
+
@property
|
|
38
|
+
def level_of_theory(self) -> str:
|
|
39
|
+
corrections = list(filter(lambda x: x not in (None, ""), self.corrections))
|
|
40
|
+
|
|
41
|
+
if self.method in PREPACKAGED_METHODS or self.basis_set is None:
|
|
42
|
+
method = self.method.value
|
|
43
|
+
elif self.method in METHODS_WITH_CORRECTION or len(corrections) == 0:
|
|
44
|
+
method = f"{self.method.value}/{self.basis_set.name.lower()}"
|
|
45
|
+
else:
|
|
46
|
+
method = f"{self.method.value}-{'-'.join([c.value for c in corrections])}/{self.basis_set.name.lower()}"
|
|
47
|
+
|
|
48
|
+
if self.solvent_settings is not None:
|
|
49
|
+
method += f"/{self.solvent_settings.model.value}({self.solvent_settings.solvent.value})"
|
|
50
|
+
|
|
51
|
+
return method
|
|
52
|
+
|
|
53
|
+
@field_validator("mode")
|
|
54
|
+
@classmethod
|
|
55
|
+
def set_mode_auto(cls, mode: Mode) -> Mode:
|
|
56
|
+
"""Set the mode to RAPID if AUTO is selected."""
|
|
57
|
+
if mode == Mode.AUTO:
|
|
58
|
+
return Mode.RAPID
|
|
59
|
+
|
|
60
|
+
return mode
|
|
61
|
+
|
|
62
|
+
@model_validator(mode="after")
|
|
63
|
+
def validate_and_build(self) -> Self:
|
|
64
|
+
if self.mode == Mode.AUTO:
|
|
65
|
+
self.mode = Mode.RAPID
|
|
66
|
+
|
|
67
|
+
self.scf_settings = _assign_scf_settings_by_mode(self.mode, self.scf_settings)
|
|
68
|
+
self.opt_settings = _assign_opt_settings_by_mode(self.mode, self.opt_settings)
|
|
69
|
+
|
|
70
|
+
return self
|
|
71
|
+
|
|
72
|
+
def model_post_init(self, __context: Any) -> None:
|
|
73
|
+
# figure out `optimize_ts`
|
|
74
|
+
if Task.OPTIMIZE_TS in self.tasks:
|
|
75
|
+
self.tasks.pop(self.tasks.index(Task.OPTIMIZE_TS))
|
|
76
|
+
self.tasks.append(Task.OPTIMIZE)
|
|
77
|
+
self.opt_settings.transition_state = True
|
|
78
|
+
|
|
79
|
+
# composite methods have their own basis sets, so overwrite user stuff
|
|
80
|
+
if self.method == Method.HF3C:
|
|
81
|
+
self.basis_set = BasisSet(name="minix")
|
|
82
|
+
elif self.method == Method.B973C:
|
|
83
|
+
self.basis_set = BasisSet(name="def2-mTZVP")
|
|
84
|
+
elif self.method == Method.R2SCAN3C:
|
|
85
|
+
self.basis_set = BasisSet(name="def2-mTZVPP")
|
|
86
|
+
elif self.method == Method.WB97X3C:
|
|
87
|
+
self.basis_set = BasisSet(name="vDZP")
|
|
88
|
+
|
|
89
|
+
@field_validator("basis_set", mode="before")
|
|
90
|
+
@classmethod
|
|
91
|
+
def parse_basis_set(cls, v: Any) -> BasisSet | dict[str, Any] | None:
|
|
92
|
+
"""Turn a string into a ``BasisSet`` object. (This is a little crude.)"""
|
|
93
|
+
if isinstance(v, BasisSet):
|
|
94
|
+
return None if v.name is None else v
|
|
95
|
+
elif isinstance(v, dict):
|
|
96
|
+
return None if v.get("name") is None else v
|
|
97
|
+
elif isinstance(v, str):
|
|
98
|
+
if len(v):
|
|
99
|
+
return BasisSet(name=v)
|
|
100
|
+
# "" is basically None, let's be real here...
|
|
101
|
+
return None
|
|
102
|
+
elif v is None:
|
|
103
|
+
return None
|
|
104
|
+
else:
|
|
105
|
+
raise ValueError(f"invalid value ``{v}`` for ``basis_set``")
|
|
106
|
+
|
|
107
|
+
@field_validator("corrections", mode="before")
|
|
108
|
+
@classmethod
|
|
109
|
+
def remove_empty_string(cls, v: list[_T]) -> list[_T]:
|
|
110
|
+
"""Remove empty string values."""
|
|
111
|
+
return [c for c in v if c] if v is not None else v
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _assign_scf_settings_by_mode(mode: Mode, scf_settings: SCFSettings) -> SCFSettings:
|
|
115
|
+
"""
|
|
116
|
+
Assign SCF settings based on the mode.
|
|
117
|
+
|
|
118
|
+
Values based off of the following sources:
|
|
119
|
+
QChem:
|
|
120
|
+
- https://manual.q-chem.com/5.2/Ch4.S3.SS2.html
|
|
121
|
+
- https://manual.q-chem.com/5.2/Ch4.S5.SS2.html
|
|
122
|
+
|
|
123
|
+
Gaussian:
|
|
124
|
+
- https://gaussian.com/integral/
|
|
125
|
+
- https://gaussian.com/overlay5/
|
|
126
|
+
|
|
127
|
+
Orca:
|
|
128
|
+
- manual 4.2.1, §9.6.1 and §9.7.3
|
|
129
|
+
|
|
130
|
+
Psi4:
|
|
131
|
+
- https://psicode.org/psi4manual/master/autodir_options_c/module__scf.html
|
|
132
|
+
- https://psicode.org/psi4manual/master/autodoc_glossary_options_c.html
|
|
133
|
+
|
|
134
|
+
TeraChem:
|
|
135
|
+
- Manual, it's easy to locate everything.
|
|
136
|
+
|
|
137
|
+
The below values are my best attempt at homogenizing various sources.
|
|
138
|
+
In general, eri_threshold should be 3 OOM lower than SCF convergence.
|
|
139
|
+
"""
|
|
140
|
+
if mode == Mode.MANUAL:
|
|
141
|
+
return scf_settings
|
|
142
|
+
|
|
143
|
+
match mode:
|
|
144
|
+
case Mode.RECKLESS:
|
|
145
|
+
scf_settings.energy_threshold = 1e-5
|
|
146
|
+
scf_settings.rms_error_threshold = 1e-7
|
|
147
|
+
scf_settings.max_error_threshold = 1e-5
|
|
148
|
+
scf_settings.rebuild_frequency = 100
|
|
149
|
+
scf_settings.int_settings.eri_threshold = 1e-8
|
|
150
|
+
scf_settings.int_settings.csam_multiplier = 3.0
|
|
151
|
+
scf_settings.int_settings.pair_overlap_threshold = 1e-8
|
|
152
|
+
case Mode.RAPID | Mode.CAREFUL:
|
|
153
|
+
scf_settings.energy_threshold = 1e-6
|
|
154
|
+
scf_settings.rms_error_threshold = 1e-9
|
|
155
|
+
scf_settings.max_error_threshold = 1e-7
|
|
156
|
+
scf_settings.rebuild_frequency = 10
|
|
157
|
+
scf_settings.int_settings.eri_threshold = 1e-10
|
|
158
|
+
scf_settings.int_settings.csam_multiplier = 1.0
|
|
159
|
+
scf_settings.int_settings.pair_overlap_threshold = 1e-10
|
|
160
|
+
case Mode.METICULOUS:
|
|
161
|
+
scf_settings.energy_threshold = 1e-8
|
|
162
|
+
scf_settings.rms_error_threshold = 1e-9
|
|
163
|
+
scf_settings.max_error_threshold = 1e-7
|
|
164
|
+
scf_settings.rebuild_frequency = 5
|
|
165
|
+
scf_settings.int_settings.eri_threshold = 1e-12
|
|
166
|
+
scf_settings.int_settings.csam_multiplier = 1.0
|
|
167
|
+
scf_settings.int_settings.pair_overlap_threshold = 1e-12
|
|
168
|
+
case Mode.DEBUG:
|
|
169
|
+
scf_settings.energy_threshold = 1e-9
|
|
170
|
+
scf_settings.rms_error_threshold = 1e-10
|
|
171
|
+
scf_settings.max_error_threshold = 1e-9
|
|
172
|
+
scf_settings.rebuild_frequency = 1
|
|
173
|
+
scf_settings.int_settings.eri_threshold = 1e-14
|
|
174
|
+
scf_settings.int_settings.csam_multiplier = 1e10 # in other words, disable CSAM
|
|
175
|
+
scf_settings.int_settings.pair_overlap_threshold = 1e-14
|
|
176
|
+
case _:
|
|
177
|
+
raise ValueError(f"Unknown mode ``{mode.value}``!")
|
|
178
|
+
|
|
179
|
+
return scf_settings
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def _assign_opt_settings_by_mode(mode: Mode, opt_settings: OptimizationSettings) -> OptimizationSettings:
|
|
183
|
+
"""
|
|
184
|
+
Assign optimization settings based on the mode.
|
|
185
|
+
|
|
186
|
+
Constraints lead to a lot of noise, so we need to loosen the thresholds.
|
|
187
|
+
|
|
188
|
+
cf. DLFIND manual, and https://www.cup.uni-muenchen.de/ch/compchem/geom/basic.html
|
|
189
|
+
and the discussion at https://geometric.readthedocs.io/en/latest/how-it-works.html
|
|
190
|
+
in periodic systems, "normal" is 0.05 eV/Å ~= 2e-3 Hartree/Å, and "careful" is 0.01 ~= 4e-4
|
|
191
|
+
|
|
192
|
+
Note: thresholds here are in units of Hartree/Å, not Hartree/Bohr as listed in many places.
|
|
193
|
+
"""
|
|
194
|
+
opt_settings.energy_threshold = 1e-6
|
|
195
|
+
match mode:
|
|
196
|
+
case Mode.RECKLESS:
|
|
197
|
+
opt_settings.energy_threshold = 2e-5
|
|
198
|
+
opt_settings.max_gradient_threshold = 7e-3
|
|
199
|
+
opt_settings.rms_gradient_threshold = 6e-3
|
|
200
|
+
case Mode.RAPID:
|
|
201
|
+
opt_settings.energy_threshold = 5e-5
|
|
202
|
+
opt_settings.max_gradient_threshold = 5e-3
|
|
203
|
+
opt_settings.rms_gradient_threshold = 3.5e-3
|
|
204
|
+
case Mode.CAREFUL:
|
|
205
|
+
opt_settings.max_gradient_threshold = 9e-4
|
|
206
|
+
opt_settings.rms_gradient_threshold = 6e-4
|
|
207
|
+
case Mode.METICULOUS:
|
|
208
|
+
opt_settings.max_gradient_threshold = 3e-5
|
|
209
|
+
opt_settings.rms_gradient_threshold = 2e-5
|
|
210
|
+
case Mode.DEBUG:
|
|
211
|
+
opt_settings.max_gradient_threshold = 4e-6
|
|
212
|
+
opt_settings.rms_gradient_threshold = 2e-6
|
|
213
|
+
case _:
|
|
214
|
+
raise ValueError(f"Unknown mode ``{mode.value}``!")
|
|
215
|
+
|
|
216
|
+
return opt_settings
|
|
@@ -56,6 +56,7 @@ class BDEWorkflow(Workflow, MultiStageOptMixin):
|
|
|
56
56
|
|
|
57
57
|
Inherited:
|
|
58
58
|
:param initial_molecule: Molecule of interest
|
|
59
|
+
:param mode: Mode for workflow
|
|
59
60
|
:param multistage_opt_settings: set by mode unless mode=MANUAL (ignores additional settings if set)
|
|
60
61
|
:param solvent: solvent to use
|
|
61
62
|
:param xtb_preopt: pre-optimize with xtb (sets based on mode when None)
|
|
@@ -69,7 +70,6 @@ class BDEWorkflow(Workflow, MultiStageOptMixin):
|
|
|
69
70
|
:param transition_state: whether this is a transition state (not supported)
|
|
70
71
|
|
|
71
72
|
New:
|
|
72
|
-
:param mode: Mode for workflow
|
|
73
73
|
:param optimize_fragments: whether to optimize the fragments, or just the starting molecule (default depends on mode)
|
|
74
74
|
:param atoms: atoms to dissociate (1-indexed)
|
|
75
75
|
:param fragment_indices: fragments to dissociate (all fields feed into this, 1-indexed)
|
|
@@ -80,7 +80,6 @@ class BDEWorkflow(Workflow, MultiStageOptMixin):
|
|
|
80
80
|
:param bdes: BDE results
|
|
81
81
|
"""
|
|
82
82
|
|
|
83
|
-
mode: Mode
|
|
84
83
|
mso_mode: Mode = _sentinel_mso_mode # type: ignore [assignment]
|
|
85
84
|
frequencies: bool = False
|
|
86
85
|
optimize_fragments: bool = None # type: ignore [assignment]
|
|
@@ -107,15 +106,6 @@ class BDEWorkflow(Workflow, MultiStageOptMixin):
|
|
|
107
106
|
"""
|
|
108
107
|
return f"{type(self).__name__} {self.mode.name}\n" + "\n".join(map(str, self.fragment_indices))
|
|
109
108
|
|
|
110
|
-
def __repr__(self) -> str:
|
|
111
|
-
"""
|
|
112
|
-
Return a string representation of the BDE workflow.
|
|
113
|
-
|
|
114
|
-
>>> BDEWorkflow(initial_molecule=Molecule.from_xyz("He 0 0 0"), mode=Mode.METICULOUS, atoms=[])
|
|
115
|
-
<BDEWorkflow METICULOUS>
|
|
116
|
-
"""
|
|
117
|
-
return f"<{type(self).__name__} {self.mode.name}>"
|
|
118
|
-
|
|
119
109
|
@property
|
|
120
110
|
def energies(self) -> tuple[float | None, ...]:
|
|
121
111
|
return tuple(bde.energy for bde in self.bdes)
|
|
@@ -128,22 +118,21 @@ class BDEWorkflow(Workflow, MultiStageOptMixin):
|
|
|
128
118
|
|
|
129
119
|
return value
|
|
130
120
|
|
|
131
|
-
@field_validator("mode")
|
|
132
|
-
@classmethod
|
|
133
|
-
def set_mode_auto(cls, mode: Mode) -> Mode:
|
|
134
|
-
if mode == Mode.AUTO:
|
|
135
|
-
return Mode.RAPID
|
|
136
|
-
|
|
137
|
-
return mode
|
|
138
|
-
|
|
139
121
|
@field_validator("initial_molecule", mode="before")
|
|
140
122
|
@classmethod
|
|
141
|
-
def no_charge_or_spin(cls,
|
|
123
|
+
def no_charge_or_spin(cls, val: Molecule | dict[str, Any]) -> Molecule | dict[str, Any]:
|
|
142
124
|
"""Ensure the molecule has no charge or spin."""
|
|
125
|
+
if isinstance(val, dict):
|
|
126
|
+
mol = Molecule(**val)
|
|
127
|
+
elif isinstance(val, Molecule):
|
|
128
|
+
mol = val
|
|
129
|
+
else:
|
|
130
|
+
raise ValueError(f"{val=} is not a Molecule.")
|
|
131
|
+
|
|
143
132
|
if mol.charge != 0 or mol.multiplicity != 1:
|
|
144
133
|
raise ValueError("Charge and spin partitioning undefined for BDE, only neutral singlet molecules supported.")
|
|
145
134
|
|
|
146
|
-
return
|
|
135
|
+
return val
|
|
147
136
|
|
|
148
137
|
@model_validator(mode="before")
|
|
149
138
|
@classmethod
|
|
@@ -159,10 +148,10 @@ class BDEWorkflow(Workflow, MultiStageOptMixin):
|
|
|
159
148
|
self.fragment_indices = tuple(map(tuple, self.fragment_indices))
|
|
160
149
|
|
|
161
150
|
match self.mode:
|
|
162
|
-
case Mode.RECKLESS
|
|
163
|
-
#
|
|
164
|
-
self.optimize_fragments =
|
|
165
|
-
case Mode.CAREFUL | Mode.METICULOUS:
|
|
151
|
+
case Mode.RECKLESS:
|
|
152
|
+
# GFN-FF doesn't support open-shell species
|
|
153
|
+
self.optimize_fragments = False
|
|
154
|
+
case Mode.RAPID | Mode.CAREFUL | Mode.METICULOUS:
|
|
166
155
|
# Default on
|
|
167
156
|
self.optimize_fragments = self.optimize_fragments or self.optimize_fragments is None
|
|
168
157
|
case _:
|
|
@@ -22,9 +22,9 @@ class MultiStageOptSettings(BaseModel):
|
|
|
22
22
|
RAPID *default
|
|
23
23
|
r²SCAN-3c//GFN2-xTB with GFN0-xTB pre-opt (off by default)
|
|
24
24
|
CAREFUL
|
|
25
|
-
wB97X-3c//
|
|
25
|
+
wB97X-3c//r²SCAN-3c with GFN2-xTB pre-opt
|
|
26
26
|
METICULOUS
|
|
27
|
-
wB97M-D3BJ/def2-TZVPPD//wB97X-3c//
|
|
27
|
+
wB97M-D3BJ/def2-TZVPPD//wB97X-3c//r²SCAN-3c with GFN2-xTB pre-opt
|
|
28
28
|
|
|
29
29
|
Notes:
|
|
30
30
|
- No solvent in pre-opt
|
|
@@ -163,7 +163,7 @@ class MultiStageOptSettings(BaseModel):
|
|
|
163
163
|
self.xtb_preopt = (self.xtb_preopt is None) or self.xtb_preopt
|
|
164
164
|
self.optimization_settings = [
|
|
165
165
|
*gfn2_pre_opt * self.xtb_preopt,
|
|
166
|
-
opt(Method.
|
|
166
|
+
opt(Method.R2SCAN3C, solvent=self.solvent, freq=self.frequencies),
|
|
167
167
|
]
|
|
168
168
|
self.singlepoint_settings = sp(Method.WB97X3C, solvent=self.solvent)
|
|
169
169
|
|
|
@@ -171,7 +171,7 @@ class MultiStageOptSettings(BaseModel):
|
|
|
171
171
|
self.xtb_preopt = (self.xtb_preopt is None) or self.xtb_preopt
|
|
172
172
|
self.optimization_settings = [
|
|
173
173
|
*gfn2_pre_opt * self.xtb_preopt,
|
|
174
|
-
opt(Method.
|
|
174
|
+
opt(Method.R2SCAN3C, solvent=self.solvent),
|
|
175
175
|
opt(Method.WB97X3C, solvent=self.solvent, freq=self.frequencies),
|
|
176
176
|
]
|
|
177
177
|
self.singlepoint_settings = sp(Method.WB97MD3BJ, "def2-TZVPPD", solvent=self.solvent)
|
|
@@ -212,6 +212,12 @@ class MultiStageOptWorkflow(Workflow, MultiStageOptSettings):
|
|
|
212
212
|
# Populated while running the workflow
|
|
213
213
|
calculations: list[UUID | None] = Field(default_factory=list)
|
|
214
214
|
|
|
215
|
+
def __repr__(self) -> str:
|
|
216
|
+
if self.mode != Mode.MANUAL:
|
|
217
|
+
return f"<{type(self).__name__} {self.mode.name}>"
|
|
218
|
+
|
|
219
|
+
return f"<{type(self).__name__} {self.level_of_theory}>"
|
|
220
|
+
|
|
215
221
|
|
|
216
222
|
# the id of a mutable object may change, thus using object()
|
|
217
223
|
_sentinel_msos = object()
|
|
@@ -49,6 +49,7 @@ class SpinStatesWorkflow(Workflow, MultiStageOptMixin):
|
|
|
49
49
|
|
|
50
50
|
Inherited
|
|
51
51
|
:param initial_molecule: Molecule of interest
|
|
52
|
+
:param mode: Mode for workflow
|
|
52
53
|
:param multistage_opt_settings: set by mode unless mode=MANUAL (ignores additional settings if set)
|
|
53
54
|
:param solvent: solvent to use
|
|
54
55
|
:param xtb_preopt: pre-optimize with xtb (sets based on mode when None)
|
|
@@ -60,7 +61,6 @@ class SpinStatesWorkflow(Workflow, MultiStageOptMixin):
|
|
|
60
61
|
:param mso_mode: Mode for MultiStageOptSettings
|
|
61
62
|
|
|
62
63
|
New:
|
|
63
|
-
:param mode: Mode for workflow
|
|
64
64
|
:param states: multiplicities of the spin state targetted
|
|
65
65
|
:param spin_states: resulting spin states data
|
|
66
66
|
|
|
@@ -72,16 +72,12 @@ class SpinStatesWorkflow(Workflow, MultiStageOptMixin):
|
|
|
72
72
|
'<SpinStatesWorkflow [1, 3, 5] RAPID>'
|
|
73
73
|
"""
|
|
74
74
|
|
|
75
|
-
mode: Mode
|
|
76
75
|
mso_mode: Mode = _sentinel_mso_mode # type: ignore [assignment]
|
|
77
76
|
states: list[PositiveInt]
|
|
78
77
|
|
|
79
78
|
# Results
|
|
80
79
|
spin_states: list[SpinState] = Field(default_factory=list)
|
|
81
80
|
|
|
82
|
-
def __str__(self) -> str:
|
|
83
|
-
return repr(self)
|
|
84
|
-
|
|
85
81
|
def __repr__(self) -> str:
|
|
86
82
|
if self.mode != Mode.MANUAL:
|
|
87
83
|
return f"<{type(self).__name__} {self.states} {self.mode.name}>"
|
|
@@ -121,14 +117,6 @@ class SpinStatesWorkflow(Workflow, MultiStageOptMixin):
|
|
|
121
117
|
values["mso_mode"] = values["mode"]
|
|
122
118
|
return values
|
|
123
119
|
|
|
124
|
-
@field_validator("mode")
|
|
125
|
-
@classmethod
|
|
126
|
-
def set_mode_auto(cls, mode: Mode) -> Mode:
|
|
127
|
-
if mode == Mode.AUTO:
|
|
128
|
-
return Mode.RAPID
|
|
129
|
-
|
|
130
|
-
return mode
|
|
131
|
-
|
|
132
120
|
@field_validator("spin_states")
|
|
133
121
|
@classmethod
|
|
134
122
|
def validate_spin_states(cls, spin_states: list[SpinState]) -> list[SpinState]:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from pydantic import
|
|
1
|
+
from pydantic import field_validator
|
|
2
2
|
|
|
3
3
|
from ..base import Base
|
|
4
4
|
from ..message import Message
|
|
@@ -8,30 +8,17 @@ from ..types import UUID
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class Workflow(Base):
|
|
11
|
-
"""All workflows should have these properties."""
|
|
12
|
-
|
|
13
|
-
initial_molecule: Molecule
|
|
14
|
-
messages: list[Message] = []
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class DBCalculation(Base):
|
|
18
|
-
"""Encodes a calculation that's in the database. This isn't terribly useful by itself."""
|
|
19
|
-
|
|
20
|
-
uuid: UUID
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class WorkflowInput(BaseModel):
|
|
24
11
|
"""
|
|
25
|
-
|
|
12
|
+
Base class for Workflows.
|
|
26
13
|
|
|
27
14
|
:param initial_molecule: Molecule of interest
|
|
28
|
-
:param mode: Mode
|
|
15
|
+
:param mode: Mode to use
|
|
16
|
+
:param messages: messages to display
|
|
29
17
|
"""
|
|
30
18
|
|
|
31
|
-
model_config = ConfigDict(extra="forbid")
|
|
32
|
-
|
|
33
19
|
initial_molecule: Molecule
|
|
34
|
-
mode: Mode
|
|
20
|
+
mode: Mode = Mode.AUTO
|
|
21
|
+
messages: list[Message] = []
|
|
35
22
|
|
|
36
23
|
def __str__(self) -> str:
|
|
37
24
|
return repr(self)
|
|
@@ -39,8 +26,17 @@ class WorkflowInput(BaseModel):
|
|
|
39
26
|
def __repr__(self) -> str:
|
|
40
27
|
return f"<{type(self).__name__} {self.mode.name}>"
|
|
41
28
|
|
|
29
|
+
@field_validator("mode")
|
|
30
|
+
@classmethod
|
|
31
|
+
def set_mode_auto(cls, mode: Mode) -> Mode:
|
|
32
|
+
"""Set the mode to RAPID if AUTO is selected."""
|
|
33
|
+
if mode == Mode.AUTO:
|
|
34
|
+
return Mode.RAPID
|
|
35
|
+
|
|
36
|
+
return mode
|
|
42
37
|
|
|
43
|
-
class WorkflowResults(BaseModel):
|
|
44
|
-
"""Results of a workflow."""
|
|
45
38
|
|
|
46
|
-
|
|
39
|
+
class DBCalculation(Base):
|
|
40
|
+
"""Encodes a calculation that's in the database. This isn't terribly useful by itself."""
|
|
41
|
+
|
|
42
|
+
uuid: UUID
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from stjames import Constraint, Mode, OptimizationSettings, Settings
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_set_mode_auto() -> None:
|
|
5
|
+
Settings()
|
|
6
|
+
assert Settings().mode == Mode.RAPID
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def test_opt_settings() -> None:
|
|
10
|
+
settings_rapid = Settings(mode=Mode.RAPID)
|
|
11
|
+
settings_meticulous = Settings(mode=Mode.METICULOUS)
|
|
12
|
+
|
|
13
|
+
cons = [Constraint(atoms=[1, 2], constraint_type="bond")]
|
|
14
|
+
settings_careful = Settings(mode=Mode.CAREFUL, opt_settings=OptimizationSettings(constraints=cons))
|
|
15
|
+
|
|
16
|
+
rap_opt_set = settings_rapid.opt_settings
|
|
17
|
+
car_opt_set = settings_careful.opt_settings
|
|
18
|
+
met_opt_set = settings_meticulous.opt_settings
|
|
19
|
+
|
|
20
|
+
assert not rap_opt_set.constraints
|
|
21
|
+
assert not met_opt_set.constraints
|
|
22
|
+
assert car_opt_set.constraints == cons
|
|
23
|
+
|
|
24
|
+
assert rap_opt_set.energy_threshold == 5e-5
|
|
25
|
+
assert rap_opt_set.max_gradient_threshold == 5e-3
|
|
26
|
+
assert rap_opt_set.rms_gradient_threshold == 3.5e-3
|
|
27
|
+
|
|
28
|
+
assert car_opt_set.energy_threshold == 1e-6
|
|
29
|
+
assert car_opt_set.max_gradient_threshold == 9e-4
|
|
30
|
+
assert car_opt_set.rms_gradient_threshold == 6e-4
|
|
31
|
+
|
|
32
|
+
assert met_opt_set.energy_threshold == 1e-6
|
|
33
|
+
assert met_opt_set.max_gradient_threshold == 3e-5
|
|
34
|
+
assert met_opt_set.rms_gradient_threshold == 2e-5
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
from typing import Any, Optional, TypeVar
|
|
2
|
-
|
|
3
|
-
import pydantic
|
|
4
|
-
|
|
5
|
-
from .base import Base, UniqueList
|
|
6
|
-
from .basis_set import BasisSet
|
|
7
|
-
from .correction import Correction
|
|
8
|
-
from .method import METHODS_WITH_CORRECTION, PREPACKAGED_METHODS, Method
|
|
9
|
-
from .mode import Mode
|
|
10
|
-
from .opt_settings import OptimizationSettings
|
|
11
|
-
from .scf_settings import SCFSettings
|
|
12
|
-
from .solvent import SolventSettings
|
|
13
|
-
from .task import Task
|
|
14
|
-
from .thermochem_settings import ThermochemistrySettings
|
|
15
|
-
|
|
16
|
-
_T = TypeVar("_T")
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class Settings(Base):
|
|
20
|
-
method: Method = Method.HARTREE_FOCK
|
|
21
|
-
basis_set: Optional[BasisSet] = None
|
|
22
|
-
tasks: UniqueList[Task] = [Task.ENERGY, Task.CHARGE, Task.DIPOLE]
|
|
23
|
-
corrections: UniqueList[Correction] = []
|
|
24
|
-
|
|
25
|
-
mode: Mode = Mode.AUTO
|
|
26
|
-
|
|
27
|
-
solvent_settings: Optional[SolventSettings] = None
|
|
28
|
-
|
|
29
|
-
# scf/opt settings will be set automatically based on mode, but can be overridden manually
|
|
30
|
-
scf_settings: SCFSettings = SCFSettings()
|
|
31
|
-
opt_settings: OptimizationSettings = OptimizationSettings()
|
|
32
|
-
thermochem_settings: ThermochemistrySettings = ThermochemistrySettings()
|
|
33
|
-
|
|
34
|
-
# mypy has this dead wrong (https://docs.pydantic.dev/2.0/usage/computed_fields/)
|
|
35
|
-
# Python 3.12 narrows the reason for the ignore to prop-decorator
|
|
36
|
-
@pydantic.computed_field # type: ignore[misc, prop-decorator, unused-ignore]
|
|
37
|
-
@property
|
|
38
|
-
def level_of_theory(self) -> str:
|
|
39
|
-
corrections = list(filter(lambda x: x not in (None, ""), self.corrections))
|
|
40
|
-
|
|
41
|
-
if self.method in PREPACKAGED_METHODS or self.basis_set is None:
|
|
42
|
-
method = self.method.value
|
|
43
|
-
elif self.method in METHODS_WITH_CORRECTION or len(corrections) == 0:
|
|
44
|
-
method = f"{self.method.value}/{self.basis_set.name.lower()}"
|
|
45
|
-
else:
|
|
46
|
-
method = f"{self.method.value}-{'-'.join([c.value for c in corrections])}/{self.basis_set.name.lower()}"
|
|
47
|
-
|
|
48
|
-
if self.solvent_settings is not None:
|
|
49
|
-
method += f"/{self.solvent_settings.model.value}({self.solvent_settings.solvent.value})"
|
|
50
|
-
|
|
51
|
-
return method
|
|
52
|
-
|
|
53
|
-
def model_post_init(self, __context: Any) -> None:
|
|
54
|
-
_assign_settings_by_mode(self)
|
|
55
|
-
|
|
56
|
-
# figure out `optimize_ts`
|
|
57
|
-
if Task.OPTIMIZE_TS in self.tasks:
|
|
58
|
-
self.tasks.pop(self.tasks.index(Task.OPTIMIZE_TS))
|
|
59
|
-
self.tasks.append(Task.OPTIMIZE)
|
|
60
|
-
self.opt_settings.transition_state = True
|
|
61
|
-
|
|
62
|
-
# composite methods have their own basis sets, so overwrite user stuff
|
|
63
|
-
if self.method == Method.HF3C:
|
|
64
|
-
self.basis_set = BasisSet(name="minix")
|
|
65
|
-
elif self.method == Method.B973C:
|
|
66
|
-
self.basis_set = BasisSet(name="def2-mTZVP")
|
|
67
|
-
elif self.method == Method.R2SCAN3C:
|
|
68
|
-
self.basis_set = BasisSet(name="def2-mTZVPP")
|
|
69
|
-
elif self.method == Method.WB97X3C:
|
|
70
|
-
self.basis_set = BasisSet(name="vDZP")
|
|
71
|
-
|
|
72
|
-
@pydantic.field_validator("basis_set", mode="before")
|
|
73
|
-
@classmethod
|
|
74
|
-
def parse_basis_set(cls, v: Any) -> BasisSet | dict[str, Any] | None:
|
|
75
|
-
"""Turn a string into a ``BasisSet`` object. (This is a little crude.)"""
|
|
76
|
-
if isinstance(v, BasisSet):
|
|
77
|
-
return None if v.name is None else v
|
|
78
|
-
elif isinstance(v, dict):
|
|
79
|
-
return None if v.get("name") is None else v
|
|
80
|
-
elif isinstance(v, str):
|
|
81
|
-
if len(v):
|
|
82
|
-
return BasisSet(name=v)
|
|
83
|
-
# "" is basically None, let's be real here...
|
|
84
|
-
return None
|
|
85
|
-
elif v is None:
|
|
86
|
-
return None
|
|
87
|
-
else:
|
|
88
|
-
raise ValueError(f"invalid value ``{v}`` for ``basis_set``")
|
|
89
|
-
|
|
90
|
-
@pydantic.field_validator("corrections", mode="before")
|
|
91
|
-
@classmethod
|
|
92
|
-
def remove_empty_string(cls, v: list[_T]) -> list[_T]:
|
|
93
|
-
"""Remove empty string values."""
|
|
94
|
-
return [c for c in v if c] if v is not None else v
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def _assign_settings_by_mode(settings: Settings) -> None:
|
|
98
|
-
"""Modifies ``scf_settings`` and ``opt_settings`` based on preset ``mode``."""
|
|
99
|
-
mode = settings.mode
|
|
100
|
-
|
|
101
|
-
if mode == Mode.AUTO:
|
|
102
|
-
if (Task.OPTIMIZE in settings.tasks) or (Task.GRADIENT in settings.tasks) or (Task.FREQUENCIES in settings.tasks) or (Task.HESSIAN in settings.tasks):
|
|
103
|
-
# noisy gradient! struggles to converge
|
|
104
|
-
if settings.method == Method.AIMNET2_WB97MD3:
|
|
105
|
-
mode = Mode.RAPID
|
|
106
|
-
else:
|
|
107
|
-
mode = Mode.CAREFUL
|
|
108
|
-
else:
|
|
109
|
-
mode = Mode.RAPID
|
|
110
|
-
elif mode == Mode.MANUAL:
|
|
111
|
-
return
|
|
112
|
-
|
|
113
|
-
# modify scf settings!
|
|
114
|
-
#
|
|
115
|
-
# values based off of the following sources:
|
|
116
|
-
# qchem:
|
|
117
|
-
# https://manual.q-chem.com/5.2/Ch4.S3.SS2.html
|
|
118
|
-
# https://manual.q-chem.com/5.2/Ch4.S5.SS2.html
|
|
119
|
-
#
|
|
120
|
-
# gaussian:
|
|
121
|
-
# https://gaussian.com/integral/
|
|
122
|
-
# https://gaussian.com/overlay5/
|
|
123
|
-
#
|
|
124
|
-
# orca:
|
|
125
|
-
# manual 4.2.1, §9.6.1 and §9.7.3
|
|
126
|
-
#
|
|
127
|
-
# psi4:
|
|
128
|
-
# https://psicode.org/psi4manual/master/autodir_options_c/module__scf.html
|
|
129
|
-
# https://psicode.org/psi4manual/master/autodoc_glossary_options_c.html
|
|
130
|
-
#
|
|
131
|
-
# terachem:
|
|
132
|
-
# manual, it's easy to locate everything.
|
|
133
|
-
#
|
|
134
|
-
# the below values are my best attempt at homogenizing various sources.
|
|
135
|
-
# in general, eri_threshold should be 3 OOM lower than scf convergence
|
|
136
|
-
scf_settings = settings.scf_settings
|
|
137
|
-
if mode == Mode.RECKLESS:
|
|
138
|
-
scf_settings.energy_threshold = 1e-5
|
|
139
|
-
scf_settings.rms_error_threshold = 1e-7
|
|
140
|
-
scf_settings.max_error_threshold = 1e-5
|
|
141
|
-
scf_settings.rebuild_frequency = 100
|
|
142
|
-
scf_settings.int_settings.eri_threshold = 1e-8
|
|
143
|
-
scf_settings.int_settings.csam_multiplier = 3.0
|
|
144
|
-
scf_settings.int_settings.pair_overlap_threshold = 1e-8
|
|
145
|
-
elif mode == Mode.RAPID:
|
|
146
|
-
scf_settings.energy_threshold = 5e-5
|
|
147
|
-
scf_settings.rms_error_threshold = 1e-8
|
|
148
|
-
scf_settings.max_error_threshold = 1e-6
|
|
149
|
-
scf_settings.rebuild_frequency = 20
|
|
150
|
-
scf_settings.int_settings.eri_threshold = 1e-9
|
|
151
|
-
scf_settings.int_settings.csam_multiplier = 1.0
|
|
152
|
-
scf_settings.int_settings.pair_overlap_threshold = 1e-9
|
|
153
|
-
elif mode == Mode.CAREFUL:
|
|
154
|
-
scf_settings.energy_threshold = 1e-6
|
|
155
|
-
scf_settings.rms_error_threshold = 1e-9
|
|
156
|
-
scf_settings.max_error_threshold = 1e-7
|
|
157
|
-
scf_settings.rebuild_frequency = 10
|
|
158
|
-
scf_settings.int_settings.eri_threshold = 1e-10
|
|
159
|
-
scf_settings.int_settings.csam_multiplier = 1.0
|
|
160
|
-
scf_settings.int_settings.pair_overlap_threshold = 1e-10
|
|
161
|
-
elif mode == Mode.METICULOUS:
|
|
162
|
-
scf_settings.energy_threshold = 1e-8
|
|
163
|
-
scf_settings.rms_error_threshold = 1e-9
|
|
164
|
-
scf_settings.max_error_threshold = 1e-7
|
|
165
|
-
scf_settings.rebuild_frequency = 5
|
|
166
|
-
scf_settings.int_settings.eri_threshold = 1e-12
|
|
167
|
-
scf_settings.int_settings.csam_multiplier = 1.0
|
|
168
|
-
scf_settings.int_settings.pair_overlap_threshold = 1e-12
|
|
169
|
-
elif mode == Mode.DEBUG:
|
|
170
|
-
scf_settings.energy_threshold = 1e-9
|
|
171
|
-
scf_settings.rms_error_threshold = 1e-10
|
|
172
|
-
scf_settings.max_error_threshold = 1e-9
|
|
173
|
-
scf_settings.rebuild_frequency = 1
|
|
174
|
-
scf_settings.int_settings.eri_threshold = 1e-14
|
|
175
|
-
scf_settings.int_settings.csam_multiplier = 1e10 # in other words, disable CSAM
|
|
176
|
-
scf_settings.int_settings.pair_overlap_threshold = 1e-14
|
|
177
|
-
else:
|
|
178
|
-
raise ValueError(f"Unknown mode ``{mode.value}``!")
|
|
179
|
-
|
|
180
|
-
opt_settings = settings.opt_settings
|
|
181
|
-
|
|
182
|
-
# constrained optimizations warrant loosening the settings a bit
|
|
183
|
-
has_constraints = len(opt_settings.constraints) > 0
|
|
184
|
-
|
|
185
|
-
# cf. DLFIND manual, and https://www.cup.uni-muenchen.de/ch/compchem/geom/basic.html
|
|
186
|
-
# and the discussion at https://geometric.readthedocs.io/en/latest/how-it-works.html
|
|
187
|
-
# in periodic systems, "normal" is 0.05 eV/Å ~= 2e-3 Hartree/Å, and "careful" is 0.01 ~= 4e-4
|
|
188
|
-
if mode == Mode.RECKLESS:
|
|
189
|
-
opt_settings.energy_threshold = 2e-5
|
|
190
|
-
opt_settings.max_gradient_threshold = 7e-3
|
|
191
|
-
opt_settings.rms_gradient_threshold = 6e-3
|
|
192
|
-
elif mode == Mode.RAPID or (mode == Mode.CAREFUL and has_constraints):
|
|
193
|
-
opt_settings.energy_threshold = 5e-5
|
|
194
|
-
opt_settings.max_gradient_threshold = 5e-3
|
|
195
|
-
opt_settings.rms_gradient_threshold = 3.5e-3
|
|
196
|
-
elif mode == Mode.CAREFUL or (mode == Mode.METICULOUS and has_constraints):
|
|
197
|
-
opt_settings.energy_threshold = 1e-6
|
|
198
|
-
opt_settings.max_gradient_threshold = 9e-4
|
|
199
|
-
opt_settings.rms_gradient_threshold = 6e-4
|
|
200
|
-
elif mode == Mode.METICULOUS:
|
|
201
|
-
opt_settings.energy_threshold = 1e-6
|
|
202
|
-
opt_settings.max_gradient_threshold = 3e-5
|
|
203
|
-
opt_settings.rms_gradient_threshold = 2e-5
|
|
204
|
-
elif mode == Mode.DEBUG:
|
|
205
|
-
opt_settings.energy_threshold = 1e-6
|
|
206
|
-
opt_settings.max_gradient_threshold = 4e-6
|
|
207
|
-
opt_settings.rms_gradient_threshold = 2e-6
|
|
208
|
-
else:
|
|
209
|
-
raise ValueError(f"Unknown mode ``{mode.value}``!")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|