rowan-python 3.1.8__py3-none-any.whl → 3.1.9__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.
rowan/__init__.py CHANGED
@@ -24,6 +24,7 @@ from stjames import (
24
24
  Mode,
25
25
  MSAFormat,
26
26
  MultiStageOptSettings,
27
+ NMR_SUPPORTED_SOLVENTS,
27
28
  OpenConfSettings,
28
29
  OptimizationSettings,
29
30
  PBCDFTSettings,
rowan/workflows/nmr.py CHANGED
@@ -1,6 +1,7 @@
1
1
  """NMR workflow - predict Nuclear Magnetic Resonance spectra."""
2
2
 
3
3
  from dataclasses import dataclass
4
+ from typing import Any
4
5
 
5
6
  import stjames
6
7
 
@@ -98,6 +99,32 @@ class NMRResult(WorkflowResult):
98
99
  return self._workflow.symmetry_equivalent_nuclei
99
100
 
100
101
 
102
+ def _nmr_multistage_opt_settings(solvent: SolventInput) -> stjames.MultiStageOptSettings:
103
+ """
104
+ Build NMR optimization settings, adding a solvated AIMNet2 singlepoint.
105
+
106
+ Optimization runs gas-phase (matching MagNet); the solvated singlepoint, whose solvent model
107
+ is looked up from stjames.NMR_SOLVENT_MODELS, reweights the conformer ensemble.
108
+
109
+ :param solvent: solvent for the prediction
110
+ :returns: multi-stage optimization settings
111
+ """
112
+ singlepoint_settings = stjames.Settings(
113
+ method=stjames.Method.AIMNET2_WB97MD3,
114
+ tasks=[stjames.Task.ENERGY],
115
+ solvent_settings=stjames.SolventSettings(
116
+ solvent=solvent, model=stjames.NMR_SOLVENT_MODELS[stjames.Solvent(solvent)]
117
+ ),
118
+ )
119
+
120
+ return stjames.MultiStageOptSettings(
121
+ optimization_settings=[
122
+ stjames.Settings(method=stjames.Method.AIMNET2_WB97MD3, tasks=[stjames.Task.OPTIMIZE])
123
+ ],
124
+ singlepoint_settings=singlepoint_settings,
125
+ )
126
+
127
+
101
128
  def submit_nmr_workflow(
102
129
  initial_molecule: StructureInput,
103
130
  solvent: SolventInput = "chloroform",
@@ -114,7 +141,10 @@ def submit_nmr_workflow(
114
141
  Submits a Nuclear Magnetic Resonance (NMR) prediction workflow to the API.
115
142
 
116
143
  :param initial_molecule: Molecule to predict NMR spectra for.
117
- :param solvent: Solvent for NMR calculation (default: chloroform).
144
+ :param solvent: Solvent for NMR calculation (default: chloroform). Must be an NMR-supported
145
+ solvent (see rowan.NMR_SUPPORTED_SOLVENTS); others raise ValueError. A solvated AIMNet2
146
+ singlepoint reweights the conformer ensemble, using CPCM-X where supported and
147
+ otherwise ALPB.
118
148
  :param do_csearch: Whether to perform a conformational search. Requires do_optimization.
119
149
  :param do_optimization: Whether to optimize conformer geometries.
120
150
  :param name: Name of the workflow.
@@ -127,6 +157,12 @@ def submit_nmr_workflow(
127
157
  :raises requests.HTTPError: if the request to the API fails.
128
158
  """
129
159
  require_coordinates(initial_molecule)
160
+ if stjames.Solvent(solvent) not in stjames.NMR_SUPPORTED_SOLVENTS:
161
+ supported = ", ".join(sorted(s.value for s in stjames.NMR_SUPPORTED_SOLVENTS))
162
+ raise ValueError(
163
+ f"{stjames.Solvent(solvent).value!r} is not an NMR-supported solvent. "
164
+ f"NMR-supported solvents: {supported}."
165
+ )
130
166
  if do_csearch and not do_optimization:
131
167
  raise ValueError(
132
168
  "`do_optimization` must be True when `do_csearch` is True; the conformers from "
@@ -138,13 +174,15 @@ def submit_nmr_workflow(
138
174
  folder_uuid = folder.uuid
139
175
  mol_dict = molecule_to_dict(initial_molecule)
140
176
 
141
- workflow_data = {"initial_molecule": mol_dict, "solvent": solvent}
177
+ workflow_data: dict[str, Any] = {"initial_molecule": mol_dict, "solvent": solvent}
142
178
 
143
179
  if not do_csearch:
144
180
  workflow_data["conf_gen_settings"] = None
145
181
 
146
182
  if not do_optimization:
147
183
  workflow_data["multistage_opt_settings"] = None
184
+ else:
185
+ workflow_data["multistage_opt_settings"] = _nmr_multistage_opt_settings(solvent)
148
186
 
149
187
  workflow = stjames.NMRSpectroscopyWorkflow.model_validate(workflow_data)
150
188
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rowan-python
3
- Version: 3.1.8
3
+ Version: 3.1.9
4
4
  Summary: Rowan Python Library
5
5
  Project-URL: Homepage, https://github.com/rowansci/rowan-client
6
6
  Project-URL: Bug Tracker, https://github.com/rowansci/rowan-client/issues
@@ -11,7 +11,7 @@ Requires-Dist: httpx
11
11
  Requires-Dist: nest-asyncio
12
12
  Requires-Dist: rdkit
13
13
  Requires-Dist: setuptools
14
- Requires-Dist: stjames>=0.0.228
14
+ Requires-Dist: stjames>=0.0.236
15
15
  Description-Content-Type: text/markdown
16
16
 
17
17
  # Rowan Python Library
@@ -1,4 +1,4 @@
1
- rowan/__init__.py,sha256=J1u---gqVAI_LMJatslW1LiYKAhQVGjyUrR7FH1B5as,1748
1
+ rowan/__init__.py,sha256=XMe16awgKPEe8rIrA4h6xq7bQ-Pz5cTyusIxw9rWF68,1776
2
2
  rowan/api_keys.py,sha256=TvG5l5MmQ3Qt8Z3Y7jCA_lcrwEHuI7xHy-KLbIdQ8_A,4793
3
3
  rowan/calculation.py,sha256=nuUtLTtn9D-FCM9TJl3h5euBgIYqa5fr5r_PSNBS7Xo,3809
4
4
  rowan/config.py,sha256=TejQKSxnzNKKTNL9-2bCLq6RvAh54oVA5Ivl1p_ZT8Q,20899
@@ -36,7 +36,7 @@ rowan/workflows/macropka.py,sha256=IxGwr9LziIwj_x6pXEhJN6SywS_KULziuYoETNqM370,5
36
36
  rowan/workflows/membrane_permeability.py,sha256=wHZ1IPlXwBB343uVAm7EuhedcMPd-Uy4jMqHfXRHwqY,4680
37
37
  rowan/workflows/msa.py,sha256=k_FlxxtdgvmxDN3LyLDEQeFfI8_lyBJz1KFtz3S4oNo,4816
38
38
  rowan/workflows/multistage_optimization.py,sha256=04kZPC3SmVOxqEQOwyBrS3DlelM-b8e531T_LuVt3tU,7385
39
- rowan/workflows/nmr.py,sha256=68be_Xgiy1AykGdIL4fR1pqKllD1nLm3IidsStzKtz4,5521
39
+ rowan/workflows/nmr.py,sha256=V0-vHEadlbHk5dUmOZg-DSqkDXm4sF-xNsUZRTk1arM,7209
40
40
  rowan/workflows/pka.py,sha256=NZ-3i-cH_b7YOHj2iq0roXEcZmC8SYapmzMOX6ObRqw,8546
41
41
  rowan/workflows/pocket_detection.py,sha256=aGHY0puxekp4c4nsNYHcvKCe1fsetygL04BcSvNFvE8,3864
42
42
  rowan/workflows/pose_analysis_md.py,sha256=5TRsCBFD0QObE5tpmCOxi137xsKMfQrRO6ef8TLrnkk,11767
@@ -52,7 +52,7 @@ rowan/workflows/solvent_dependent_conformers.py,sha256=Z2xESmcM8WcTsR2TSTUa--Rrh
52
52
  rowan/workflows/spin_states.py,sha256=rjkgie2-XVNIN7O6P93yn6EPv9Ogjy8iTj3ufZIsUgY,9331
53
53
  rowan/workflows/strain.py,sha256=kCW_BlX__sdQG1JVbFZuB-57rkpnxa_JCw3h4uKdGDk,6425
54
54
  rowan/workflows/tautomer_search.py,sha256=mbRl0ZJ7wibueRF8c8_idhXJ1rtwg7LBt--5QwQ_Cck,5767
55
- rowan_python-3.1.8.dist-info/METADATA,sha256=I21zA1ConlWw06jgs294uPgw5-L97vflydhXYQk1D3Q,2436
56
- rowan_python-3.1.8.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
57
- rowan_python-3.1.8.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
58
- rowan_python-3.1.8.dist-info/RECORD,,
55
+ rowan_python-3.1.9.dist-info/METADATA,sha256=DERGY6Uore4bP-ogOwngz2ZUlzLnv06a6_blp6l_h8I,2436
56
+ rowan_python-3.1.9.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
57
+ rowan_python-3.1.9.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
58
+ rowan_python-3.1.9.dist-info/RECORD,,