rowan-python 1.1.2__py3-none-any.whl → 1.1.5__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/rowan_rdkit/__init__.py +2 -2
- rowan/rowan_rdkit/chem_utils.py +159 -34
- {rowan_python-1.1.2.dist-info → rowan_python-1.1.5.dist-info}/METADATA +1 -1
- {rowan_python-1.1.2.dist-info → rowan_python-1.1.5.dist-info}/RECORD +6 -6
- {rowan_python-1.1.2.dist-info → rowan_python-1.1.5.dist-info}/WHEEL +0 -0
- {rowan_python-1.1.2.dist-info → rowan_python-1.1.5.dist-info}/licenses/LICENSE +0 -0
rowan/rowan_rdkit/__init__.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from .chem_utils import (run_pka, run_tautomers, run_conformers, run_energy,
|
|
2
|
-
run_optimize,
|
|
2
|
+
run_optimize, batch_pka, batch_tautomers, batch_energy, batch_optimize, batch_conformers, run_charges, batch_charges)
|
|
3
3
|
|
|
4
4
|
__all__ = ["run_pka", "run_tautomers", "run_energy", "run_conformers", "run_optimize",
|
|
5
|
-
"
|
|
5
|
+
"batch_pka", "batch_tautomers", "batch_energy", "batch_optimize", "batch_conformers", "run_charges", "batch_charges"]
|
rowan/rowan_rdkit/chem_utils.py
CHANGED
|
@@ -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
|
|
@@ -91,7 +90,7 @@ def run_pka(mol: RdkitMol,
|
|
|
91
90
|
folder_uuid: Optional[stjames.UUID] = None)-> tuple[dict[int, float], dict[int, float]]:
|
|
92
91
|
return asyncio.run(_single_pka(mol, mode, timeout, name, pka_range, deprotonate_elements, protonate_elements, folder_uuid))
|
|
93
92
|
|
|
94
|
-
def
|
|
93
|
+
def batch_pka(mols: List[RdkitMol],
|
|
95
94
|
mode: pKaMode = "rapid",
|
|
96
95
|
timeout: int = 600,
|
|
97
96
|
name: str = "pKa API Workflow",
|
|
@@ -99,14 +98,14 @@ def run_batch_pka(mols: List[RdkitMol],
|
|
|
99
98
|
deprotonate_elements: list[int] = [7, 8, 16],
|
|
100
99
|
protonate_elements: list[int] = [7],
|
|
101
100
|
folder_uuid: Optional[stjames.UUID] = None)-> tuple[dict[int, float], dict[int, float]]:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return
|
|
101
|
+
async def _run():
|
|
102
|
+
tasks = [
|
|
103
|
+
_single_pka(mol, mode, timeout, name, pka_range,
|
|
104
|
+
deprotonate_elements, protonate_elements, folder_uuid)
|
|
105
|
+
for mol in mols
|
|
106
|
+
]
|
|
107
|
+
return await asyncio.gather(*tasks)
|
|
108
|
+
return asyncio.run(_run())
|
|
110
109
|
|
|
111
110
|
|
|
112
111
|
async def _single_pka(mol: RdkitMol,
|
|
@@ -180,7 +179,7 @@ def run_tautomers(mol: RdkitMol,
|
|
|
180
179
|
"""
|
|
181
180
|
return asyncio.run(_single_tautomers(mol, mode, timeout, name, folder_uuid))
|
|
182
181
|
|
|
183
|
-
def
|
|
182
|
+
def batch_tautomers(mols: List[RdkitMol],
|
|
184
183
|
mode: TautomerMode = "reckless",
|
|
185
184
|
timeout: int = 600,
|
|
186
185
|
name: str = "Tautomers API Workflow",
|
|
@@ -190,11 +189,13 @@ def run_batch_tautomers(mols: List[RdkitMol],
|
|
|
190
189
|
:param mol: RDKit molecule object
|
|
191
190
|
:return: A list of lists of tautomer dictionaries which include the RDKit molecule object, the relative energy, and the weight
|
|
192
191
|
"""
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
192
|
+
async def _run():
|
|
193
|
+
tasks = [
|
|
194
|
+
_single_tautomers(mol, mode, timeout, name, folder_uuid)
|
|
195
|
+
for mol in mols
|
|
196
|
+
]
|
|
197
|
+
return await asyncio.gather(*tasks)
|
|
198
|
+
return asyncio.run(_run())
|
|
198
199
|
|
|
199
200
|
|
|
200
201
|
async def _single_tautomers(mol: RdkitMol,
|
|
@@ -257,7 +258,7 @@ def run_energy(
|
|
|
257
258
|
"""
|
|
258
259
|
return asyncio.run(_single_energy(mol, method, engine, mode, timeout, name, folder_uuid))
|
|
259
260
|
|
|
260
|
-
def
|
|
261
|
+
def batch_energy(
|
|
261
262
|
mols: List[RdkitMol],
|
|
262
263
|
method: str = "aimnet2_wb97md3",
|
|
263
264
|
engine: str = "aimnet2",
|
|
@@ -274,11 +275,13 @@ def run_batch_energy(
|
|
|
274
275
|
:raises: MethodTooSlowError if the method is invalid
|
|
275
276
|
:returns: a list of dictionaries with the energy in Hartree and the conformer index
|
|
276
277
|
"""
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
278
|
+
async def _run():
|
|
279
|
+
tasks = [
|
|
280
|
+
_single_energy(mol, method, engine, mode, timeout, name, folder_uuid)
|
|
281
|
+
for mol in mols
|
|
282
|
+
]
|
|
283
|
+
return await asyncio.gather(*tasks)
|
|
284
|
+
return asyncio.run(_run())
|
|
282
285
|
|
|
283
286
|
async def _single_energy(
|
|
284
287
|
mol: RdkitMol,
|
|
@@ -373,7 +376,7 @@ def run_optimize(
|
|
|
373
376
|
"""
|
|
374
377
|
return asyncio.run(_single_optimize(mol, method, engine, mode, return_energies, timeout, name, folder_uuid))
|
|
375
378
|
|
|
376
|
-
def
|
|
379
|
+
def batch_optimize(
|
|
377
380
|
mols: List[RdkitMol],
|
|
378
381
|
method: str = "aimnet2_wb97md3",
|
|
379
382
|
engine: str = "aimnet2",
|
|
@@ -393,11 +396,13 @@ def run_batch_optimize(
|
|
|
393
396
|
:returns: a list of dictionaries with the molecule, with optimized conformers, and optionally a list of energies per conformer too
|
|
394
397
|
|
|
395
398
|
"""
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
399
|
+
async def _run():
|
|
400
|
+
tasks = [
|
|
401
|
+
_single_optimize(mol, method, engine, mode, return_energies, timeout, name, folder_uuid)
|
|
402
|
+
for mol in mols
|
|
403
|
+
]
|
|
404
|
+
return await asyncio.gather(*tasks)
|
|
405
|
+
return asyncio.run(_run())
|
|
401
406
|
|
|
402
407
|
async def _single_optimize(
|
|
403
408
|
mol: RdkitMol,
|
|
@@ -501,7 +506,7 @@ def run_conformers(mol: RdkitMol, num_conformers=10,
|
|
|
501
506
|
"""
|
|
502
507
|
return asyncio.run(_single_conformers(mol, num_conformers, method, mode, return_energies, timeout, name, folder_uuid))
|
|
503
508
|
|
|
504
|
-
def
|
|
509
|
+
def batch_conformers(mols: List[RdkitMol], num_conformers=10,
|
|
505
510
|
method: str = "aimnet2_wb97md3",
|
|
506
511
|
mode: str = "rapid",
|
|
507
512
|
return_energies: bool = False,
|
|
@@ -514,11 +519,13 @@ def run_batch_conformers(mols: List[RdkitMol], num_conformers=10,
|
|
|
514
519
|
:param num_conformers: Number of conformers to generate
|
|
515
520
|
:return: A list of dictonaries with the RDKit molecule with num_conformers lowest energy conformers and optional energies
|
|
516
521
|
"""
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
+
async def _run():
|
|
523
|
+
tasks = [
|
|
524
|
+
_single_conformers(mol, num_conformers, method, mode, return_energies, timeout, name, folder_uuid)
|
|
525
|
+
for mol in mols
|
|
526
|
+
]
|
|
527
|
+
return await asyncio.gather(*tasks)
|
|
528
|
+
return asyncio.run(_run())
|
|
522
529
|
|
|
523
530
|
|
|
524
531
|
async def _single_conformers(mol: RdkitMol, num_conformers=10,
|
|
@@ -608,3 +615,121 @@ async def _single_conformers(mol: RdkitMol, num_conformers=10,
|
|
|
608
615
|
return_dict["energies"] = lowest_energies
|
|
609
616
|
|
|
610
617
|
return return_dict
|
|
618
|
+
|
|
619
|
+
def run_charges(
|
|
620
|
+
mol: RdkitMol,
|
|
621
|
+
method: str = "aimnet2_wb97md3",
|
|
622
|
+
engine: str = "aimnet2",
|
|
623
|
+
mode: str = "auto",
|
|
624
|
+
timeout: int = 600,
|
|
625
|
+
name: str = "Charges API Workflow",
|
|
626
|
+
folder_uuid: Optional[stjames.UUID] = None
|
|
627
|
+
):
|
|
628
|
+
"""
|
|
629
|
+
Computes atom-centered charges for the given molecule.
|
|
630
|
+
|
|
631
|
+
:param mol: the input molecule
|
|
632
|
+
:param method: the method with which to compute the molecule's energy
|
|
633
|
+
:raises: MethodTooSlowError if the method is invalid
|
|
634
|
+
:returns: a dictionary with the charges and the conformer index
|
|
635
|
+
"""
|
|
636
|
+
return asyncio.run(_single_charges(mol, method, engine, mode, timeout, name, folder_uuid))
|
|
637
|
+
|
|
638
|
+
def batch_charges(
|
|
639
|
+
mols: List[RdkitMol],
|
|
640
|
+
method: str = "aimnet2_wb97md3",
|
|
641
|
+
engine: str = "aimnet2",
|
|
642
|
+
mode: str = "auto",
|
|
643
|
+
timeout: int = 600,
|
|
644
|
+
name: str = "Charges API Workflow",
|
|
645
|
+
folder_uuid: Optional[stjames.UUID] = None
|
|
646
|
+
):
|
|
647
|
+
"""
|
|
648
|
+
Computes the energy for the given molecule.
|
|
649
|
+
|
|
650
|
+
:param mol: the input molecule
|
|
651
|
+
:param method: the method with which to compute the molecule's energy
|
|
652
|
+
:raises: MethodTooSlowError if the method is invalid
|
|
653
|
+
:returns: a list of dictionaries with the charges and the conformer index
|
|
654
|
+
"""
|
|
655
|
+
async def _run():
|
|
656
|
+
tasks = [
|
|
657
|
+
_single_charges(mol, method, engine, mode, timeout, name, folder_uuid)
|
|
658
|
+
for mol in mols
|
|
659
|
+
]
|
|
660
|
+
return await asyncio.gather(*tasks)
|
|
661
|
+
return asyncio.run(_run())
|
|
662
|
+
|
|
663
|
+
async def _single_charges(
|
|
664
|
+
mol: RdkitMol,
|
|
665
|
+
method: str = "aimnet2_wb97md3",
|
|
666
|
+
engine: str = "aimnet2",
|
|
667
|
+
mode: str = "auto",
|
|
668
|
+
timeout: int = 600,
|
|
669
|
+
name: str = "Energy API Workflow",
|
|
670
|
+
folder_uuid: Optional[stjames.UUID] = None
|
|
671
|
+
):
|
|
672
|
+
"""
|
|
673
|
+
Computes the energy for the given molecule.
|
|
674
|
+
|
|
675
|
+
:param mol: the input molecule
|
|
676
|
+
:param method: the method with which to compute the molecule's energy
|
|
677
|
+
:param engine: the engine
|
|
678
|
+
:param mode:
|
|
679
|
+
:param timeout: the timeout in seconds
|
|
680
|
+
:raises: MethodTooSlowError if the method is invalid
|
|
681
|
+
:returns: a dictionary with the charges and the conformer index
|
|
682
|
+
"""
|
|
683
|
+
get_api_key()
|
|
684
|
+
|
|
685
|
+
method = stjames.Method(method)
|
|
686
|
+
|
|
687
|
+
if mol.GetNumConformers() == 0:
|
|
688
|
+
mol = _embed_rdkit_mol(mol)
|
|
689
|
+
if mol.GetNumConformers() == 0:
|
|
690
|
+
raise NoConformersError("This molecule has no conformers")
|
|
691
|
+
|
|
692
|
+
if method not in FAST_METHODS:
|
|
693
|
+
raise MethodTooSlowError(
|
|
694
|
+
"This method is too slow; try running this through our web interface."
|
|
695
|
+
)
|
|
696
|
+
|
|
697
|
+
workflow_uuids = []
|
|
698
|
+
for conformer in mol.GetConformers():
|
|
699
|
+
cid = conformer.GetId()
|
|
700
|
+
stjames_mol = _rdkit_to_stjames(mol, cid)
|
|
701
|
+
get_api_key()
|
|
702
|
+
post = rowan.Workflow.submit(
|
|
703
|
+
name=name,
|
|
704
|
+
workflow_type="basic_calculation",
|
|
705
|
+
initial_molecule=stjames_mol,
|
|
706
|
+
workflow_data={
|
|
707
|
+
"settings": {
|
|
708
|
+
"method": method.value,
|
|
709
|
+
"corrections": [],
|
|
710
|
+
"tasks": [
|
|
711
|
+
"charge"
|
|
712
|
+
],
|
|
713
|
+
"mode": mode,
|
|
714
|
+
"opt_settings": {
|
|
715
|
+
"constraints": []
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
"engine": engine
|
|
719
|
+
},
|
|
720
|
+
folder_uuid=folder_uuid
|
|
721
|
+
)
|
|
722
|
+
|
|
723
|
+
workflow_uuids.append(post["uuid"])
|
|
724
|
+
|
|
725
|
+
start = time.time()
|
|
726
|
+
while not all(rowan.Workflow.is_finished(uuid) for uuid in workflow_uuids):
|
|
727
|
+
await asyncio.sleep(5)
|
|
728
|
+
if time.time() - start > timeout:
|
|
729
|
+
raise TimeoutError("Workflow timed out")
|
|
730
|
+
|
|
731
|
+
workflow_results = [rowan.Workflow.retrieve(uuid) for uuid in workflow_uuids]
|
|
732
|
+
charges_list = [rowan.Calculation.retrieve(workflow["object_data"]["calculation_uuid"])["molecules"][-1]["mulliken_charges"] for workflow in workflow_results]
|
|
733
|
+
|
|
734
|
+
return [{"conformer_index": index, "charges": charges} for index, charges in enumerate(charges_list)]
|
|
735
|
+
|
|
@@ -5,9 +5,9 @@ rowan/constants.py,sha256=ZZvv3L0b2y3dMGlWGeaRmx40J5tBrpxNxvJgjP1TNjg,37
|
|
|
5
5
|
rowan/folder.py,sha256=W7-YnPxugqzIdw-t1sr-WjeSQa-x4IjZ2mV2DwIq3II,2965
|
|
6
6
|
rowan/utils.py,sha256=IMACnRJpjFns_DF-FZQDu8p8fbgu4C2dbDaxdGcSZQs,1405
|
|
7
7
|
rowan/workflow.py,sha256=An3CW9LlHxYByE4mRl1iYThYcIGry8TwTi5rgbAsEBc,4467
|
|
8
|
-
rowan/rowan_rdkit/__init__.py,sha256=
|
|
9
|
-
rowan/rowan_rdkit/chem_utils.py,sha256=
|
|
10
|
-
rowan_python-1.1.
|
|
11
|
-
rowan_python-1.1.
|
|
12
|
-
rowan_python-1.1.
|
|
13
|
-
rowan_python-1.1.
|
|
8
|
+
rowan/rowan_rdkit/__init__.py,sha256=AGoN4fbsSbKGfeke4bPvEfgeBAM4PaasAPIILonIeBU,415
|
|
9
|
+
rowan/rowan_rdkit/chem_utils.py,sha256=nbvOAEKfCStiaSi-NpxqU5C9BQrLwTMNWtd7v9DpkYw,26360
|
|
10
|
+
rowan_python-1.1.5.dist-info/METADATA,sha256=2GNrC93mhprXn0HipCO_3k5lbdsmbLFwYTM8uga_X0I,1030
|
|
11
|
+
rowan_python-1.1.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
12
|
+
rowan_python-1.1.5.dist-info/licenses/LICENSE,sha256=i7ehYBS-6gGmbTcgU4mgk28pyOx2kScJ0kcx8n7bWLM,1084
|
|
13
|
+
rowan_python-1.1.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|