rowan-python 1.1.2__py3-none-any.whl → 1.1.4__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 +121 -6
- {rowan_python-1.1.2.dist-info → rowan_python-1.1.4.dist-info}/METADATA +1 -1
- {rowan_python-1.1.2.dist-info → rowan_python-1.1.4.dist-info}/RECORD +6 -6
- {rowan_python-1.1.2.dist-info → rowan_python-1.1.4.dist-info}/WHEEL +0 -0
- {rowan_python-1.1.2.dist-info → rowan_python-1.1.4.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",
|
|
@@ -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",
|
|
@@ -257,7 +256,7 @@ def run_energy(
|
|
|
257
256
|
"""
|
|
258
257
|
return asyncio.run(_single_energy(mol, method, engine, mode, timeout, name, folder_uuid))
|
|
259
258
|
|
|
260
|
-
def
|
|
259
|
+
def batch_energy(
|
|
261
260
|
mols: List[RdkitMol],
|
|
262
261
|
method: str = "aimnet2_wb97md3",
|
|
263
262
|
engine: str = "aimnet2",
|
|
@@ -373,7 +372,7 @@ def run_optimize(
|
|
|
373
372
|
"""
|
|
374
373
|
return asyncio.run(_single_optimize(mol, method, engine, mode, return_energies, timeout, name, folder_uuid))
|
|
375
374
|
|
|
376
|
-
def
|
|
375
|
+
def batch_optimize(
|
|
377
376
|
mols: List[RdkitMol],
|
|
378
377
|
method: str = "aimnet2_wb97md3",
|
|
379
378
|
engine: str = "aimnet2",
|
|
@@ -501,7 +500,7 @@ def run_conformers(mol: RdkitMol, num_conformers=10,
|
|
|
501
500
|
"""
|
|
502
501
|
return asyncio.run(_single_conformers(mol, num_conformers, method, mode, return_energies, timeout, name, folder_uuid))
|
|
503
502
|
|
|
504
|
-
def
|
|
503
|
+
def batch_conformers(mols: List[RdkitMol], num_conformers=10,
|
|
505
504
|
method: str = "aimnet2_wb97md3",
|
|
506
505
|
mode: str = "rapid",
|
|
507
506
|
return_energies: bool = False,
|
|
@@ -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
|
+
|
|
@@ -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=mAjS163CjmrOmLnDCOdH3vQWi9FtbuXE089chAu0j2Q,26447
|
|
10
|
+
rowan_python-1.1.4.dist-info/METADATA,sha256=Vkzc7AWEZGi34RdjBxk9jufLpFdui4E64iYORWk6pEs,1030
|
|
11
|
+
rowan_python-1.1.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
12
|
+
rowan_python-1.1.4.dist-info/licenses/LICENSE,sha256=i7ehYBS-6gGmbTcgU4mgk28pyOx2kScJ0kcx8n7bWLM,1084
|
|
13
|
+
rowan_python-1.1.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|