stjames 0.0.43__py3-none-any.whl → 0.0.44__py3-none-any.whl
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/molecule.py +2 -0
- stjames/settings.py +129 -122
- stjames/workflows/bde.py +14 -25
- stjames/workflows/molecular_dynamics.py +2 -0
- stjames/workflows/multistage_opt.py +10 -4
- stjames/workflows/spin_states.py +1 -13
- stjames/workflows/workflow.py +18 -22
- {stjames-0.0.43.dist-info → stjames-0.0.44.dist-info}/METADATA +1 -1
- {stjames-0.0.43.dist-info → stjames-0.0.44.dist-info}/RECORD +12 -12
- {stjames-0.0.43.dist-info → stjames-0.0.44.dist-info}/WHEEL +1 -1
- {stjames-0.0.43.dist-info → stjames-0.0.44.dist-info}/LICENSE +0 -0
- {stjames-0.0.43.dist-info → stjames-0.0.44.dist-info}/top_level.txt +0 -0
stjames/molecule.py
CHANGED
stjames/settings.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from typing import Any, Optional, TypeVar
|
|
1
|
+
from typing import Any, Optional, Self, TypeVar
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
from pydantic import computed_field, field_validator, model_validator
|
|
4
4
|
|
|
5
5
|
from .base import Base, UniqueList
|
|
6
6
|
from .basis_set import BasisSet
|
|
@@ -17,13 +17,13 @@ _T = TypeVar("_T")
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class Settings(Base):
|
|
20
|
+
mode: Mode = Mode.AUTO
|
|
21
|
+
|
|
20
22
|
method: Method = Method.HARTREE_FOCK
|
|
21
23
|
basis_set: Optional[BasisSet] = None
|
|
22
24
|
tasks: UniqueList[Task] = [Task.ENERGY, Task.CHARGE, Task.DIPOLE]
|
|
23
25
|
corrections: UniqueList[Correction] = []
|
|
24
26
|
|
|
25
|
-
mode: Mode = Mode.AUTO
|
|
26
|
-
|
|
27
27
|
solvent_settings: Optional[SolventSettings] = None
|
|
28
28
|
|
|
29
29
|
# scf/opt settings will be set automatically based on mode, but can be overridden manually
|
|
@@ -33,7 +33,7 @@ class Settings(Base):
|
|
|
33
33
|
|
|
34
34
|
# mypy has this dead wrong (https://docs.pydantic.dev/2.0/usage/computed_fields/)
|
|
35
35
|
# Python 3.12 narrows the reason for the ignore to prop-decorator
|
|
36
|
-
@
|
|
36
|
+
@computed_field # type: ignore[misc, prop-decorator, unused-ignore]
|
|
37
37
|
@property
|
|
38
38
|
def level_of_theory(self) -> str:
|
|
39
39
|
corrections = list(filter(lambda x: x not in (None, ""), self.corrections))
|
|
@@ -50,9 +50,26 @@ class Settings(Base):
|
|
|
50
50
|
|
|
51
51
|
return method
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
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
|
|
55
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:
|
|
56
73
|
# figure out `optimize_ts`
|
|
57
74
|
if Task.OPTIMIZE_TS in self.tasks:
|
|
58
75
|
self.tasks.pop(self.tasks.index(Task.OPTIMIZE_TS))
|
|
@@ -69,7 +86,7 @@ class Settings(Base):
|
|
|
69
86
|
elif self.method == Method.WB97X3C:
|
|
70
87
|
self.basis_set = BasisSet(name="vDZP")
|
|
71
88
|
|
|
72
|
-
@
|
|
89
|
+
@field_validator("basis_set", mode="before")
|
|
73
90
|
@classmethod
|
|
74
91
|
def parse_basis_set(cls, v: Any) -> BasisSet | dict[str, Any] | None:
|
|
75
92
|
"""Turn a string into a ``BasisSet`` object. (This is a little crude.)"""
|
|
@@ -87,123 +104,113 @@ class Settings(Base):
|
|
|
87
104
|
else:
|
|
88
105
|
raise ValueError(f"invalid value ``{v}`` for ``basis_set``")
|
|
89
106
|
|
|
90
|
-
@
|
|
107
|
+
@field_validator("corrections", mode="before")
|
|
91
108
|
@classmethod
|
|
92
109
|
def remove_empty_string(cls, v: list[_T]) -> list[_T]:
|
|
93
110
|
"""Remove empty string values."""
|
|
94
111
|
return [c for c in v if c] if v is not None else v
|
|
95
112
|
|
|
96
113
|
|
|
97
|
-
def
|
|
98
|
-
"""
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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}``!")
|
|
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
|
stjames/workflows/bde.py
CHANGED
|
@@ -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()
|
stjames/workflows/spin_states.py
CHANGED
|
@@ -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]:
|
stjames/workflows/workflow.py
CHANGED
|
@@ -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
|
|
@@ -12,12 +12,12 @@ stjames/int_settings.py,sha256=5HXp8opt5ZyY1UpmfaK7NVloWVLM5jkG0elEEqpVLUo,896
|
|
|
12
12
|
stjames/message.py,sha256=Rq6QqmHZKecWxYH8fVyXmuoCCPZv8YinvgykSeorXSU,216
|
|
13
13
|
stjames/method.py,sha256=xnfphxyiWZotxQcmgvpFMJDmGEM2B-_5cbPkgYZBIws,1245
|
|
14
14
|
stjames/mode.py,sha256=xw46Cc7f3eTS8i35qECi-8DocAlANhayK3w4akD4HBU,496
|
|
15
|
-
stjames/molecule.py,sha256=
|
|
15
|
+
stjames/molecule.py,sha256=QV_8vscvF48wadWtnt_no5S7j0kHgUbbFr7EnlDnzfk,10558
|
|
16
16
|
stjames/opt_settings.py,sha256=gxXGtjy9l-Q5Wen9eO6T6HHRCuS8rfOofdVQIJj0JcI,550
|
|
17
17
|
stjames/periodic_cell.py,sha256=JDCyynpamggTNi_HnTnnotRbeSMBfYc-srhD-IwUnrg,996
|
|
18
18
|
stjames/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
19
|
stjames/scf_settings.py,sha256=xMMCQ0hVB4nNFSiWesNQZUa_aLsozSZGYWweAPPDGBg,2356
|
|
20
|
-
stjames/settings.py,sha256
|
|
20
|
+
stjames/settings.py,sha256=tfgEYns6WdsheQ6wpR6uyI8O4s2iTqyH7YWtNQ36k74,8666
|
|
21
21
|
stjames/solvent.py,sha256=u037tmu-9oa21s-WEDZ7VC7nuNVjkqR2ML4JWjWSME4,1158
|
|
22
22
|
stjames/status.py,sha256=wTKNcNxStoEHrxxgr_zTyN90NITa3rxMQZzOgrCifEw,332
|
|
23
23
|
stjames/task.py,sha256=OLINRqe66o7t8arffilwmggrF_7TH0L79u6DhGruxV8,329
|
|
@@ -33,20 +33,20 @@ stjames/data/symbol_element.json,sha256=vl_buFusTqBd-muYQtMLtTDLy2OtBI6KkBeqkaWR
|
|
|
33
33
|
stjames/workflows/__init__.py,sha256=TQwTrX8hzUKBcCV4C05IvePjnEotsAWTbXv4-b8zDRk,331
|
|
34
34
|
stjames/workflows/admet.py,sha256=V8noO0Eb7h2bDFSnj6Pxv4ILm0lGxyVRCi13hE0zmEQ,149
|
|
35
35
|
stjames/workflows/basic_calculation.py,sha256=q48bpab7ZqmRTR4PsGC6bWkuxqkVdJRM8gysevTYXP0,212
|
|
36
|
-
stjames/workflows/bde.py,sha256=
|
|
36
|
+
stjames/workflows/bde.py,sha256=c_4gGDFSjHvw4CBW21i6ErSAK2Tpypvld2yair1KYXo,9568
|
|
37
37
|
stjames/workflows/conformer.py,sha256=YYwL3l7OaVeea4N9-ihghwa_ieKY6hia9LNbiTraMb0,2732
|
|
38
38
|
stjames/workflows/descriptors.py,sha256=jQ3RuMi7xk799JZ_AL1ARL3yQfWLG03L_VVsK4KIMeY,281
|
|
39
39
|
stjames/workflows/fukui.py,sha256=F5tw5jTqBimo_GiXuThhRpoxauZE5YadZjObLFDCba8,348
|
|
40
|
-
stjames/workflows/molecular_dynamics.py,sha256=
|
|
41
|
-
stjames/workflows/multistage_opt.py,sha256=
|
|
40
|
+
stjames/workflows/molecular_dynamics.py,sha256=YsDGkpI_FbB02sVkF1xiUK141cMQaHBjYyvTJarjBaU,1954
|
|
41
|
+
stjames/workflows/multistage_opt.py,sha256=aJGKqsTfVOyZk-dNsM9Z7IEOlpfYw7qvSmxo-u5IeEE,10252
|
|
42
42
|
stjames/workflows/pka.py,sha256=zpR90Yv2L-D56o2mGArM8027DWpnFFnay31UR9Xh5Nc,774
|
|
43
43
|
stjames/workflows/redox_potential.py,sha256=u6QThnqheJp6EDuWiJApJEh-fp0TKGfSyKfa8ykf85g,1211
|
|
44
44
|
stjames/workflows/scan.py,sha256=hL4Hco3Ns0dntjh2G2HhhWmED1mbt0gA_hsglPQ5Vjg,814
|
|
45
|
-
stjames/workflows/spin_states.py,sha256=
|
|
45
|
+
stjames/workflows/spin_states.py,sha256=hzxDG8pBlmae8EUEizl0sn6nsXYk4ClmeH-cFZ4bSIc,4606
|
|
46
46
|
stjames/workflows/tautomer.py,sha256=kZSCHo2Q7LzqtQjF_WyyxjECkndG49T9QOM12hsUkx8,421
|
|
47
|
-
stjames/workflows/workflow.py,sha256=
|
|
48
|
-
stjames-0.0.
|
|
49
|
-
stjames-0.0.
|
|
50
|
-
stjames-0.0.
|
|
51
|
-
stjames-0.0.
|
|
52
|
-
stjames-0.0.
|
|
47
|
+
stjames/workflows/workflow.py,sha256=tIu5naADYgYS7kdW8quvGEWHWosBcrIdcD7L86v-uMQ,976
|
|
48
|
+
stjames-0.0.44.dist-info/LICENSE,sha256=i7ehYBS-6gGmbTcgU4mgk28pyOx2kScJ0kcx8n7bWLM,1084
|
|
49
|
+
stjames-0.0.44.dist-info/METADATA,sha256=WxNrF-JxZt7kqljgnu2Ou8i-1lSWefeX3q2GNFDe6Io,1628
|
|
50
|
+
stjames-0.0.44.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
51
|
+
stjames-0.0.44.dist-info/top_level.txt,sha256=FYCwxl6quhYOAgG-mnPQcCK8vsVM7B8rIUrO-WrQ_PI,8
|
|
52
|
+
stjames-0.0.44.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|