rowan-python 1.1.1__tar.gz → 1.1.4__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.
- {rowan_python-1.1.1 → rowan_python-1.1.4}/PKG-INFO +1 -1
- {rowan_python-1.1.1 → rowan_python-1.1.4}/pixi.lock +23 -19
- {rowan_python-1.1.1 → rowan_python-1.1.4}/pyproject.toml +1 -1
- rowan_python-1.1.4/rowan/rowan_rdkit/__init__.py +5 -0
- {rowan_python-1.1.1 → rowan_python-1.1.4}/rowan/rowan_rdkit/chem_utils.py +136 -21
- rowan_python-1.1.1/rowan/rowan_rdkit/__init__.py +0 -3
- {rowan_python-1.1.1 → rowan_python-1.1.4}/.github/workflows/python-publish.yml +0 -0
- {rowan_python-1.1.1 → rowan_python-1.1.4}/.gitignore +0 -0
- {rowan_python-1.1.1 → rowan_python-1.1.4}/LICENSE +0 -0
- {rowan_python-1.1.1 → rowan_python-1.1.4}/README.md +0 -0
- {rowan_python-1.1.1 → rowan_python-1.1.4}/examples/run.py +0 -0
- {rowan_python-1.1.1 → rowan_python-1.1.4}/rowan/__init__.py +0 -0
- {rowan_python-1.1.1 → rowan_python-1.1.4}/rowan/calculation.py +0 -0
- {rowan_python-1.1.1 → rowan_python-1.1.4}/rowan/client.py +0 -0
- {rowan_python-1.1.1 → rowan_python-1.1.4}/rowan/constants.py +0 -0
- {rowan_python-1.1.1 → rowan_python-1.1.4}/rowan/folder.py +0 -0
- {rowan_python-1.1.1 → rowan_python-1.1.4}/rowan/utils.py +0 -0
- {rowan_python-1.1.1 → rowan_python-1.1.4}/rowan/workflow.py +0 -0
|
@@ -44,7 +44,7 @@ environments:
|
|
|
44
44
|
- conda: https://conda.anaconda.org/conda-forge/noarch/hyperframe-6.0.1-pyhd8ed1ab_1.conda
|
|
45
45
|
- conda: https://conda.anaconda.org/conda-forge/linux-64/icu-75.1-he02047a_0.conda
|
|
46
46
|
- conda: https://conda.anaconda.org/conda-forge/noarch/idna-3.10-pyhd8ed1ab_1.conda
|
|
47
|
-
- conda: https://conda.anaconda.org/conda-forge/noarch/importlib_resources-6.
|
|
47
|
+
- conda: https://conda.anaconda.org/conda-forge/noarch/importlib_resources-6.5.2-pyhd8ed1ab_0.conda
|
|
48
48
|
- conda: https://conda.anaconda.org/conda-forge/noarch/jsonschema-4.23.0-pyhd8ed1ab_1.conda
|
|
49
49
|
- conda: https://conda.anaconda.org/conda-forge/noarch/jsonschema-specifications-2024.10.1-pyhd8ed1ab_1.conda
|
|
50
50
|
- conda: https://conda.anaconda.org/conda-forge/linux-64/keyutils-1.6.1-h166bdaf_0.tar.bz2
|
|
@@ -145,7 +145,7 @@ environments:
|
|
|
145
145
|
- pypi: https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl
|
|
146
146
|
- pypi: https://files.pythonhosted.org/packages/f3/26/3e1bbe954fde7ee22a6e7d31582c642aad9e84ffe4b5fb61e63b87cd326f/pydantic-2.10.4-py3-none-any.whl
|
|
147
147
|
- pypi: https://files.pythonhosted.org/packages/8d/f0/49129b27c43396581a635d8710dae54a791b17dfc50c70164866bbf865e3/pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
|
|
148
|
-
- pypi: https://files.pythonhosted.org/packages/
|
|
148
|
+
- pypi: https://files.pythonhosted.org/packages/cd/4c/d2bec5035d0c101ec8a703c778e9c15a3cf7b6bb905b7c719a7911ecd6aa/stjames-0.0.47-py3-none-any.whl
|
|
149
149
|
- pypi: .
|
|
150
150
|
osx-arm64:
|
|
151
151
|
- conda: https://conda.anaconda.org/conda-forge/noarch/anyio-4.8.0-pyhd8ed1ab_0.conda
|
|
@@ -183,7 +183,7 @@ environments:
|
|
|
183
183
|
- conda: https://conda.anaconda.org/conda-forge/noarch/hyperframe-6.0.1-pyhd8ed1ab_1.conda
|
|
184
184
|
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/icu-75.1-hfee45f7_0.conda
|
|
185
185
|
- conda: https://conda.anaconda.org/conda-forge/noarch/idna-3.10-pyhd8ed1ab_1.conda
|
|
186
|
-
- conda: https://conda.anaconda.org/conda-forge/noarch/importlib_resources-6.
|
|
186
|
+
- conda: https://conda.anaconda.org/conda-forge/noarch/importlib_resources-6.5.2-pyhd8ed1ab_0.conda
|
|
187
187
|
- conda: https://conda.anaconda.org/conda-forge/noarch/jsonschema-4.23.0-pyhd8ed1ab_1.conda
|
|
188
188
|
- conda: https://conda.anaconda.org/conda-forge/noarch/jsonschema-specifications-2024.10.1-pyhd8ed1ab_1.conda
|
|
189
189
|
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/kiwisolver-1.4.7-py312h6142ec9_0.conda
|
|
@@ -272,7 +272,7 @@ environments:
|
|
|
272
272
|
- pypi: https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl
|
|
273
273
|
- pypi: https://files.pythonhosted.org/packages/f3/26/3e1bbe954fde7ee22a6e7d31582c642aad9e84ffe4b5fb61e63b87cd326f/pydantic-2.10.4-py3-none-any.whl
|
|
274
274
|
- pypi: https://files.pythonhosted.org/packages/d3/f3/c97e80721735868313c58b89d2de85fa80fe8dfeeed84dc51598b92a135e/pydantic_core-2.27.2-cp312-cp312-macosx_11_0_arm64.whl
|
|
275
|
-
- pypi: https://files.pythonhosted.org/packages/
|
|
275
|
+
- pypi: https://files.pythonhosted.org/packages/cd/4c/d2bec5035d0c101ec8a703c778e9c15a3cf7b6bb905b7c719a7911ecd6aa/stjames-0.0.47-py3-none-any.whl
|
|
276
276
|
- pypi: .
|
|
277
277
|
packages:
|
|
278
278
|
- kind: conda
|
|
@@ -1219,25 +1219,23 @@ packages:
|
|
|
1219
1219
|
timestamp: 1733211921194
|
|
1220
1220
|
- kind: conda
|
|
1221
1221
|
name: importlib_resources
|
|
1222
|
-
version: 6.
|
|
1223
|
-
build:
|
|
1224
|
-
build_number: 1
|
|
1222
|
+
version: 6.5.2
|
|
1223
|
+
build: pyhd8ed1ab_0
|
|
1225
1224
|
subdir: noarch
|
|
1226
1225
|
noarch: python
|
|
1227
|
-
url: https://conda.anaconda.org/conda-forge/noarch/importlib_resources-6.
|
|
1228
|
-
sha256:
|
|
1229
|
-
md5:
|
|
1226
|
+
url: https://conda.anaconda.org/conda-forge/noarch/importlib_resources-6.5.2-pyhd8ed1ab_0.conda
|
|
1227
|
+
sha256: acc1d991837c0afb67c75b77fdc72b4bf022aac71fedd8b9ea45918ac9b08a80
|
|
1228
|
+
md5: c85c76dc67d75619a92f51dfbce06992
|
|
1230
1229
|
depends:
|
|
1231
1230
|
- python >=3.9
|
|
1232
1231
|
- zipp >=3.1.0
|
|
1233
1232
|
constrains:
|
|
1234
|
-
- importlib-resources >=6.
|
|
1233
|
+
- importlib-resources >=6.5.2,<6.5.3.0a0
|
|
1235
1234
|
license: Apache-2.0
|
|
1236
|
-
license_family: APACHE
|
|
1237
1235
|
purls:
|
|
1238
1236
|
- pkg:pypi/importlib-resources?source=hash-mapping
|
|
1239
|
-
size:
|
|
1240
|
-
timestamp:
|
|
1237
|
+
size: 33781
|
|
1238
|
+
timestamp: 1736252433366
|
|
1241
1239
|
- kind: conda
|
|
1242
1240
|
name: jsonschema
|
|
1243
1241
|
version: 4.23.0
|
|
@@ -1797,6 +1795,7 @@ packages:
|
|
|
1797
1795
|
- libgcc >=13
|
|
1798
1796
|
- ncurses >=6.5,<7.0a0
|
|
1799
1797
|
license: BSD-2-Clause
|
|
1798
|
+
license_family: BSD
|
|
1800
1799
|
purls: []
|
|
1801
1800
|
size: 134657
|
|
1802
1801
|
timestamp: 1736191912705
|
|
@@ -1813,6 +1812,7 @@ packages:
|
|
|
1813
1812
|
- __osx >=11.0
|
|
1814
1813
|
- ncurses >=6.5,<7.0a0
|
|
1815
1814
|
license: BSD-2-Clause
|
|
1815
|
+
license_family: BSD
|
|
1816
1816
|
purls: []
|
|
1817
1817
|
size: 107634
|
|
1818
1818
|
timestamp: 1736192034117
|
|
@@ -2364,6 +2364,7 @@ packages:
|
|
|
2364
2364
|
- libgcc >=13
|
|
2365
2365
|
- libstdcxx >=13
|
|
2366
2366
|
license: BSD-3-Clause
|
|
2367
|
+
license_family: BSD
|
|
2367
2368
|
purls: []
|
|
2368
2369
|
size: 8581512
|
|
2369
2370
|
timestamp: 1736096097093
|
|
@@ -2382,6 +2383,7 @@ packages:
|
|
|
2382
2383
|
- libboost >=1.86.0,<1.87.0a0
|
|
2383
2384
|
- libcxx >=18
|
|
2384
2385
|
license: BSD-3-Clause
|
|
2386
|
+
license_family: BSD
|
|
2385
2387
|
purls: []
|
|
2386
2388
|
size: 6394406
|
|
2387
2389
|
timestamp: 1736096289303
|
|
@@ -3563,6 +3565,7 @@ packages:
|
|
|
3563
3565
|
- reportlab
|
|
3564
3566
|
- sqlalchemy
|
|
3565
3567
|
license: BSD-3-Clause
|
|
3568
|
+
license_family: BSD
|
|
3566
3569
|
purls:
|
|
3567
3570
|
- pkg:pypi/rdkit?source=hash-mapping
|
|
3568
3571
|
size: 19836609
|
|
@@ -3595,6 +3598,7 @@ packages:
|
|
|
3595
3598
|
- reportlab
|
|
3596
3599
|
- sqlalchemy
|
|
3597
3600
|
license: BSD-3-Clause
|
|
3601
|
+
license_family: BSD
|
|
3598
3602
|
purls:
|
|
3599
3603
|
- pkg:pypi/rdkit?source=hash-mapping
|
|
3600
3604
|
size: 18523747
|
|
@@ -3757,9 +3761,9 @@ packages:
|
|
|
3757
3761
|
timestamp: 1687519707123
|
|
3758
3762
|
- kind: pypi
|
|
3759
3763
|
name: rowan-python
|
|
3760
|
-
version: 1.1.
|
|
3764
|
+
version: 1.1.2
|
|
3761
3765
|
path: .
|
|
3762
|
-
sha256:
|
|
3766
|
+
sha256: 93e92c09a03fcce0fdad13ed38af8fc022695d9e093c292a0618470c024e0cb5
|
|
3763
3767
|
requires_python: '>=3.8'
|
|
3764
3768
|
editable: true
|
|
3765
3769
|
- kind: conda
|
|
@@ -3956,9 +3960,9 @@ packages:
|
|
|
3956
3960
|
timestamp: 1729066546472
|
|
3957
3961
|
- kind: pypi
|
|
3958
3962
|
name: stjames
|
|
3959
|
-
version: 0.0.
|
|
3960
|
-
url: https://files.pythonhosted.org/packages/
|
|
3961
|
-
sha256:
|
|
3963
|
+
version: 0.0.47
|
|
3964
|
+
url: https://files.pythonhosted.org/packages/cd/4c/d2bec5035d0c101ec8a703c778e9c15a3cf7b6bb905b7c719a7911ecd6aa/stjames-0.0.47-py3-none-any.whl
|
|
3965
|
+
sha256: dc15a6fbe7a676d7f5678012be62e94a0cf7c63f05d297181f0aba582744ae15
|
|
3962
3966
|
requires_dist:
|
|
3963
3967
|
- pydantic>=2.4
|
|
3964
3968
|
- numpy
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
from .chem_utils import (run_pka, run_tautomers, run_conformers, run_energy,
|
|
2
|
+
run_optimize, batch_pka, batch_tautomers, batch_energy, batch_optimize, batch_conformers, run_charges, batch_charges)
|
|
3
|
+
|
|
4
|
+
__all__ = ["run_pka", "run_tautomers", "run_energy", "run_conformers", "run_optimize",
|
|
5
|
+
"batch_pka", "batch_tautomers", "batch_energy", "batch_optimize", "batch_conformers", "run_charges", "batch_charges"]
|
|
@@ -5,7 +5,6 @@ import rowan
|
|
|
5
5
|
import copy
|
|
6
6
|
import asyncio
|
|
7
7
|
import logging
|
|
8
|
-
import math
|
|
9
8
|
from rowan.utils import get_api_key
|
|
10
9
|
import stjames
|
|
11
10
|
import time
|
|
@@ -36,7 +35,7 @@ def _get_rdkit_mol_from_uuid(calculation_uuid: str) -> RdkitMol:
|
|
|
36
35
|
rdkm = Chem.MolFromXYZBlock(stjames_mol.to_xyz())
|
|
37
36
|
return rdkm
|
|
38
37
|
|
|
39
|
-
def
|
|
38
|
+
def _embed_rdkit_mol(rdkm: RdkitMol):
|
|
40
39
|
try:
|
|
41
40
|
AllChem.SanitizeMol(rdkm)
|
|
42
41
|
except Exception as e:
|
|
@@ -58,9 +57,9 @@ def embed_rdkit_mol(rdkm: RdkitMol):
|
|
|
58
57
|
|
|
59
58
|
return rdkm
|
|
60
59
|
|
|
61
|
-
def
|
|
60
|
+
def _rdkit_to_cctk(rdkm: RdkitMol, cid: int = 0) -> cctk.Molecule:
|
|
62
61
|
if len(rdkm.GetConformers()) == 0:
|
|
63
|
-
rdkm =
|
|
62
|
+
rdkm = _embed_rdkit_mol(rdkm)
|
|
64
63
|
try:
|
|
65
64
|
nums = [atom.GetAtomicNum() for atom in rdkm.GetAtoms()]
|
|
66
65
|
geom = rdkm.GetConformers()[cid].GetPositions()
|
|
@@ -68,7 +67,7 @@ def rdkit_to_cctk(rdkm: RdkitMol, cid: int = 0) -> cctk.Molecule:
|
|
|
68
67
|
except IndexError as e:
|
|
69
68
|
raise ConversionError("RDKit molecule does not have a conformer with the given ID") from e
|
|
70
69
|
|
|
71
|
-
def
|
|
70
|
+
def _cctk_to_stjames(cmol: cctk.Molecule) -> stjames.Molecule:
|
|
72
71
|
atomic_numbers = cmol.atomic_numbers.view(np.ndarray)
|
|
73
72
|
geometry = cmol.geometry.view(np.ndarray)
|
|
74
73
|
atoms = []
|
|
@@ -77,11 +76,11 @@ def cctk_to_stjames(cmol: cctk.Molecule) -> stjames.Molecule:
|
|
|
77
76
|
|
|
78
77
|
return stjames.Molecule(atoms=atoms, charge=cmol.charge, multiplicity=cmol.multiplicity)
|
|
79
78
|
|
|
80
|
-
def
|
|
81
|
-
cmol =
|
|
82
|
-
return
|
|
79
|
+
def _rdkit_to_stjames(rdkm: RdkitMol, cid: int = 0) -> stjames.Molecule:
|
|
80
|
+
cmol = _rdkit_to_cctk(rdkm, cid)
|
|
81
|
+
return _cctk_to_stjames(cmol)
|
|
83
82
|
|
|
84
|
-
def
|
|
83
|
+
def run_pka(mol: RdkitMol,
|
|
85
84
|
mode: pKaMode = "rapid",
|
|
86
85
|
timeout: int = 600,
|
|
87
86
|
name: str = "pKa API Workflow",
|
|
@@ -126,7 +125,7 @@ async def _single_pka(mol: RdkitMol,
|
|
|
126
125
|
post = rowan.Workflow.submit(
|
|
127
126
|
name=name,
|
|
128
127
|
workflow_type="pka",
|
|
129
|
-
initial_molecule=
|
|
128
|
+
initial_molecule=_rdkit_to_stjames(mol),
|
|
130
129
|
workflow_data={
|
|
131
130
|
"pka_range": pka_range,
|
|
132
131
|
"deprotonate_elements": deprotonate_elements,
|
|
@@ -168,7 +167,7 @@ async def _single_pka(mol: RdkitMol,
|
|
|
168
167
|
return {"acidic_pkas": acidic_pkas, "basic_pkas": basic_pkas}
|
|
169
168
|
|
|
170
169
|
|
|
171
|
-
def
|
|
170
|
+
def run_tautomers(mol: RdkitMol,
|
|
172
171
|
mode: TautomerMode = "reckless",
|
|
173
172
|
timeout: int = 600,
|
|
174
173
|
name: str = "Tautomers API Workflow",
|
|
@@ -211,7 +210,7 @@ async def _single_tautomers(mol: RdkitMol,
|
|
|
211
210
|
post = rowan.Workflow.submit(
|
|
212
211
|
name=name,
|
|
213
212
|
workflow_type="tautomers",
|
|
214
|
-
initial_molecule=
|
|
213
|
+
initial_molecule=_rdkit_to_stjames(mol),
|
|
215
214
|
workflow_data={
|
|
216
215
|
"mode": mode,
|
|
217
216
|
},
|
|
@@ -238,7 +237,7 @@ async def _single_tautomers(mol: RdkitMol,
|
|
|
238
237
|
#return relative weights too
|
|
239
238
|
return tautomers
|
|
240
239
|
|
|
241
|
-
def
|
|
240
|
+
def run_energy(
|
|
242
241
|
mol: RdkitMol,
|
|
243
242
|
method: str = "aimnet2_wb97md3",
|
|
244
243
|
engine: str = "aimnet2",
|
|
@@ -302,7 +301,7 @@ async def _single_energy(
|
|
|
302
301
|
method = stjames.Method(method)
|
|
303
302
|
|
|
304
303
|
if mol.GetNumConformers() == 0:
|
|
305
|
-
mol =
|
|
304
|
+
mol = _embed_rdkit_mol(mol)
|
|
306
305
|
if mol.GetNumConformers() == 0:
|
|
307
306
|
raise NoConformersError("This molecule has no conformers")
|
|
308
307
|
|
|
@@ -314,7 +313,7 @@ async def _single_energy(
|
|
|
314
313
|
workflow_uuids = []
|
|
315
314
|
for conformer in mol.GetConformers():
|
|
316
315
|
cid = conformer.GetId()
|
|
317
|
-
stjames_mol =
|
|
316
|
+
stjames_mol = _rdkit_to_stjames(mol, cid)
|
|
318
317
|
get_api_key()
|
|
319
318
|
post = rowan.Workflow.submit(
|
|
320
319
|
name=name,
|
|
@@ -351,7 +350,7 @@ async def _single_energy(
|
|
|
351
350
|
return [{"conformer_index": index, "energy": energy} for index, energy in enumerate(energies)]
|
|
352
351
|
|
|
353
352
|
|
|
354
|
-
def
|
|
353
|
+
def run_optimize(
|
|
355
354
|
mol: RdkitMol,
|
|
356
355
|
method: str = "aimnet2_wb97md3",
|
|
357
356
|
engine: str = "aimnet2",
|
|
@@ -424,7 +423,7 @@ async def _single_optimize(
|
|
|
424
423
|
method = stjames.Method(method)
|
|
425
424
|
|
|
426
425
|
if mol.GetNumConformers() == 0:
|
|
427
|
-
mol =
|
|
426
|
+
mol = _embed_rdkit_mol(mol)
|
|
428
427
|
if mol.GetNumConformers() == 0:
|
|
429
428
|
raise NoConformersError("This molecule has no conformers")
|
|
430
429
|
|
|
@@ -438,7 +437,7 @@ async def _single_optimize(
|
|
|
438
437
|
workflow_uuids = []
|
|
439
438
|
for conformer in mol.GetConformers():
|
|
440
439
|
cid = conformer.GetId()
|
|
441
|
-
stjames_mol =
|
|
440
|
+
stjames_mol = _rdkit_to_stjames(mol, cid)
|
|
442
441
|
get_api_key()
|
|
443
442
|
post = rowan.Workflow.submit(
|
|
444
443
|
name=name,
|
|
@@ -486,7 +485,7 @@ async def _single_optimize(
|
|
|
486
485
|
|
|
487
486
|
return return_dict
|
|
488
487
|
|
|
489
|
-
def
|
|
488
|
+
def run_conformers(mol: RdkitMol, num_conformers=10,
|
|
490
489
|
method: str = "aimnet2_wb97md3",
|
|
491
490
|
mode: str = "rapid",
|
|
492
491
|
return_energies: bool = False,
|
|
@@ -540,7 +539,7 @@ async def _single_conformers(mol: RdkitMol, num_conformers=10,
|
|
|
540
539
|
method = stjames.Method(method)
|
|
541
540
|
|
|
542
541
|
if mol.GetNumConformers() == 0:
|
|
543
|
-
mol =
|
|
542
|
+
mol = _embed_rdkit_mol(mol)
|
|
544
543
|
if mol.GetNumConformers() == 0:
|
|
545
544
|
raise NoConformersError("This molecule has no conformers")
|
|
546
545
|
|
|
@@ -552,7 +551,7 @@ async def _single_conformers(mol: RdkitMol, num_conformers=10,
|
|
|
552
551
|
post = rowan.Workflow.submit(
|
|
553
552
|
name=name,
|
|
554
553
|
workflow_type="conformer_search",
|
|
555
|
-
initial_molecule=
|
|
554
|
+
initial_molecule=_rdkit_to_stjames(mol),
|
|
556
555
|
workflow_data={
|
|
557
556
|
"conf_gen_mode": "rapid",
|
|
558
557
|
"mode": mode,
|
|
@@ -608,3 +607,119 @@ async def _single_conformers(mol: RdkitMol, num_conformers=10,
|
|
|
608
607
|
return_dict["energies"] = lowest_energies
|
|
609
608
|
|
|
610
609
|
return return_dict
|
|
610
|
+
|
|
611
|
+
def run_charges(
|
|
612
|
+
mol: RdkitMol,
|
|
613
|
+
method: str = "aimnet2_wb97md3",
|
|
614
|
+
engine: str = "aimnet2",
|
|
615
|
+
mode: str = "auto",
|
|
616
|
+
timeout: int = 600,
|
|
617
|
+
name: str = "Charges API Workflow",
|
|
618
|
+
folder_uuid: Optional[stjames.UUID] = None
|
|
619
|
+
):
|
|
620
|
+
"""
|
|
621
|
+
Computes atom-centered charges for the given molecule.
|
|
622
|
+
|
|
623
|
+
:param mol: the input molecule
|
|
624
|
+
:param method: the method with which to compute the molecule's energy
|
|
625
|
+
:raises: MethodTooSlowError if the method is invalid
|
|
626
|
+
:returns: a dictionary with the charges and the conformer index
|
|
627
|
+
"""
|
|
628
|
+
return asyncio.run(_single_charges(mol, method, engine, mode, timeout, name, folder_uuid))
|
|
629
|
+
|
|
630
|
+
def batch_charges(
|
|
631
|
+
mols: List[RdkitMol],
|
|
632
|
+
method: str = "aimnet2_wb97md3",
|
|
633
|
+
engine: str = "aimnet2",
|
|
634
|
+
mode: str = "auto",
|
|
635
|
+
timeout: int = 600,
|
|
636
|
+
name: str = "Charges API Workflow",
|
|
637
|
+
folder_uuid: Optional[stjames.UUID] = None
|
|
638
|
+
):
|
|
639
|
+
"""
|
|
640
|
+
Computes the energy for the given molecule.
|
|
641
|
+
|
|
642
|
+
:param mol: the input molecule
|
|
643
|
+
:param method: the method with which to compute the molecule's energy
|
|
644
|
+
:raises: MethodTooSlowError if the method is invalid
|
|
645
|
+
:returns: a list of dictionaries with the charges and the conformer index
|
|
646
|
+
"""
|
|
647
|
+
loop = asyncio.new_event_loop()
|
|
648
|
+
asyncio.set_event_loop(loop)
|
|
649
|
+
tasks = [_single_charges(mol, method, engine, mode, timeout, name, folder_uuid) for mol in mols]
|
|
650
|
+
results = loop.run_until_complete(asyncio.gather(*tasks))
|
|
651
|
+
return results
|
|
652
|
+
|
|
653
|
+
async def _single_charges(
|
|
654
|
+
mol: RdkitMol,
|
|
655
|
+
method: str = "aimnet2_wb97md3",
|
|
656
|
+
engine: str = "aimnet2",
|
|
657
|
+
mode: str = "auto",
|
|
658
|
+
timeout: int = 600,
|
|
659
|
+
name: str = "Energy API Workflow",
|
|
660
|
+
folder_uuid: Optional[stjames.UUID] = None
|
|
661
|
+
):
|
|
662
|
+
"""
|
|
663
|
+
Computes the energy for the given molecule.
|
|
664
|
+
|
|
665
|
+
:param mol: the input molecule
|
|
666
|
+
:param method: the method with which to compute the molecule's energy
|
|
667
|
+
:param engine: the engine
|
|
668
|
+
:param mode:
|
|
669
|
+
:param timeout: the timeout in seconds
|
|
670
|
+
:raises: MethodTooSlowError if the method is invalid
|
|
671
|
+
:returns: a dictionary with the charges and the conformer index
|
|
672
|
+
"""
|
|
673
|
+
get_api_key()
|
|
674
|
+
|
|
675
|
+
method = stjames.Method(method)
|
|
676
|
+
|
|
677
|
+
if mol.GetNumConformers() == 0:
|
|
678
|
+
mol = _embed_rdkit_mol(mol)
|
|
679
|
+
if mol.GetNumConformers() == 0:
|
|
680
|
+
raise NoConformersError("This molecule has no conformers")
|
|
681
|
+
|
|
682
|
+
if method not in FAST_METHODS:
|
|
683
|
+
raise MethodTooSlowError(
|
|
684
|
+
"This method is too slow; try running this through our web interface."
|
|
685
|
+
)
|
|
686
|
+
|
|
687
|
+
workflow_uuids = []
|
|
688
|
+
for conformer in mol.GetConformers():
|
|
689
|
+
cid = conformer.GetId()
|
|
690
|
+
stjames_mol = _rdkit_to_stjames(mol, cid)
|
|
691
|
+
get_api_key()
|
|
692
|
+
post = rowan.Workflow.submit(
|
|
693
|
+
name=name,
|
|
694
|
+
workflow_type="basic_calculation",
|
|
695
|
+
initial_molecule=stjames_mol,
|
|
696
|
+
workflow_data={
|
|
697
|
+
"settings": {
|
|
698
|
+
"method": method.value,
|
|
699
|
+
"corrections": [],
|
|
700
|
+
"tasks": [
|
|
701
|
+
"charge"
|
|
702
|
+
],
|
|
703
|
+
"mode": mode,
|
|
704
|
+
"opt_settings": {
|
|
705
|
+
"constraints": []
|
|
706
|
+
}
|
|
707
|
+
},
|
|
708
|
+
"engine": engine
|
|
709
|
+
},
|
|
710
|
+
folder_uuid=folder_uuid
|
|
711
|
+
)
|
|
712
|
+
|
|
713
|
+
workflow_uuids.append(post["uuid"])
|
|
714
|
+
|
|
715
|
+
start = time.time()
|
|
716
|
+
while not all(rowan.Workflow.is_finished(uuid) for uuid in workflow_uuids):
|
|
717
|
+
await asyncio.sleep(5)
|
|
718
|
+
if time.time() - start > timeout:
|
|
719
|
+
raise TimeoutError("Workflow timed out")
|
|
720
|
+
|
|
721
|
+
workflow_results = [rowan.Workflow.retrieve(uuid) for uuid in workflow_uuids]
|
|
722
|
+
charges_list = [rowan.Calculation.retrieve(workflow["object_data"]["calculation_uuid"])["molecules"][-1]["mulliken_charges"] for workflow in workflow_results]
|
|
723
|
+
|
|
724
|
+
return [{"conformer_index": index, "charges": charges} for index, charges in enumerate(charges_list)]
|
|
725
|
+
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
from .chem_utils import pka, tautomers, conformers, energy, optimize, batch_pka, batch_tautomers, batch_energy, batch_optimize, batch_conformers
|
|
2
|
-
|
|
3
|
-
__all__ = ["pka", "tautomers", "energy", "conformers", "optimize", "batch_pka", "batch_tautomers", "batch_energy", "batch_optimize", "batch_conformers"]
|
|
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
|