rdworks 0.50.1__tar.gz → 0.51.1__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.
Files changed (85) hide show
  1. {rdworks-0.50.1 → rdworks-0.51.1}/PKG-INFO +1 -1
  2. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/__init__.py +1 -1
  3. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/conf.py +56 -0
  4. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/mol.py +42 -0
  5. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks.egg-info/PKG-INFO +1 -1
  6. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks.egg-info/SOURCES.txt +1 -0
  7. rdworks-0.51.1/tests/test_qupkake.py +19 -0
  8. rdworks-0.51.1/tests/test_xtb.py +76 -0
  9. rdworks-0.50.1/tests/test_xtb.py +0 -160
  10. {rdworks-0.50.1 → rdworks-0.51.1}/LICENSE +0 -0
  11. {rdworks-0.50.1 → rdworks-0.51.1}/README.md +0 -0
  12. {rdworks-0.50.1 → rdworks-0.51.1}/pyproject.toml +0 -0
  13. {rdworks-0.50.1 → rdworks-0.51.1}/setup.cfg +0 -0
  14. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/autograph/__init__.py +0 -0
  15. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/autograph/autograph.py +0 -0
  16. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/autograph/centroid.py +0 -0
  17. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/autograph/dynamictreecut.py +0 -0
  18. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/autograph/nmrclust.py +0 -0
  19. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/autograph/rckmeans.py +0 -0
  20. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/bitqt/__init__.py +0 -0
  21. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/bitqt/bitqt.py +0 -0
  22. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/descriptor.py +0 -0
  23. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/display.py +0 -0
  24. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/ionized.py +0 -0
  25. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/matchedseries.py +0 -0
  26. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/mollibr.py +0 -0
  27. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/pka.py +0 -0
  28. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Asinex_fragment.xml +0 -0
  29. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Astex_RO3.xml +0 -0
  30. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Baell2010_PAINS/Baell2010A.xml +0 -0
  31. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Baell2010_PAINS/Baell2010B.xml +0 -0
  32. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Baell2010_PAINS/Baell2010C.xml +0 -0
  33. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Baell2010_PAINS/PAINS-less-than-015-hits.xml +0 -0
  34. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Baell2010_PAINS/PAINS-less-than-150-hits.xml +0 -0
  35. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Baell2010_PAINS/PAINS-more-than-150-hits.xml +0 -0
  36. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Baell2010_PAINS/makexml.py +0 -0
  37. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Brenk2008_Dundee/makexml.py +0 -0
  38. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/CNS.xml +0 -0
  39. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/ChEMBL_Walters/BMS.xml +0 -0
  40. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/ChEMBL_Walters/Dundee.xml +0 -0
  41. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/ChEMBL_Walters/Glaxo.xml +0 -0
  42. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/ChEMBL_Walters/Inpharmatica.xml +0 -0
  43. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/ChEMBL_Walters/LINT.xml +0 -0
  44. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/ChEMBL_Walters/MLSMR.xml +0 -0
  45. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/ChEMBL_Walters/PAINS.xml +0 -0
  46. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/ChEMBL_Walters/SureChEMBL.xml +0 -0
  47. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/ChEMBL_Walters/makexml.py +0 -0
  48. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999.xml +0 -0
  49. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999Acid.xml +0 -0
  50. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999Base.xml +0 -0
  51. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999ElPh.xml +0 -0
  52. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999NuPh.xml +0 -0
  53. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Hann1999_Glaxo/makexml.py +0 -0
  54. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Kazius2005/Kazius2005.xml +0 -0
  55. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/Kazius2005/makexml.py +0 -0
  56. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/ZINC_druglike.xml +0 -0
  57. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/ZINC_fragment.xml +0 -0
  58. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/ZINC_leadlike.xml +0 -0
  59. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/fragment.xml +0 -0
  60. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/ionized/simple_smarts_pattern.csv +0 -0
  61. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/ionized/smarts_pattern.csv +0 -0
  62. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/misc/makexml.py +0 -0
  63. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/misc/reactive-part-2.xml +0 -0
  64. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/misc/reactive-part-3.xml +0 -0
  65. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/predefined/misc/reactive.xml +0 -0
  66. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/readin.py +0 -0
  67. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/rgroup.py +0 -0
  68. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/scaffold.py +0 -0
  69. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/std.py +0 -0
  70. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/stereoisomers.py +0 -0
  71. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/tautomers.py +0 -0
  72. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/testdata.py +0 -0
  73. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/torsion.py +0 -0
  74. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/units.py +0 -0
  75. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/utils.py +0 -0
  76. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/xml.py +0 -0
  77. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/xtb/__init__.py +0 -0
  78. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks/xtb/wrapper.py +0 -0
  79. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks.egg-info/dependency_links.txt +0 -0
  80. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks.egg-info/requires.txt +0 -0
  81. {rdworks-0.50.1 → rdworks-0.51.1}/src/rdworks.egg-info/top_level.txt +0 -0
  82. {rdworks-0.50.1 → rdworks-0.51.1}/tests/test_basics.py +0 -0
  83. {rdworks-0.50.1 → rdworks-0.51.1}/tests/test_ionized.py +0 -0
  84. {rdworks-0.50.1 → rdworks-0.51.1}/tests/test_round.py +0 -0
  85. {rdworks-0.50.1 → rdworks-0.51.1}/tests/test_torsion.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rdworks
3
- Version: 0.50.1
3
+ Version: 0.51.1
4
4
  Summary: Routine tasks built on RDKit and other tools
5
5
  Author-email: Sung-Hun Bae <sunghun.bae@gmail.com>
6
6
  Maintainer-email: Sung-Hun Bae <sunghun.bae@gmail.com>
@@ -1,4 +1,4 @@
1
- __version__ = '0.50.1'
1
+ __version__ = '0.51.1'
2
2
 
3
3
  from rdworks.conf import Conf
4
4
  from rdworks.mol import Mol
@@ -270,6 +270,62 @@ class Conf:
270
270
  return self.sync(ase_atoms.get_positions())
271
271
 
272
272
 
273
+ def protonate(self, atom_indices: list[int]) -> Self:
274
+ """Protonate given non-hydrogen atoms.
275
+
276
+ Args:
277
+ atom_indices (list[int]): atom indices of non-hydrogen atoms to protonate.
278
+
279
+ Returns:
280
+ Self: self.
281
+ """
282
+ for idx in atom_indices:
283
+ atom = self.rdmol.GetAtomWithIdx(idx)
284
+ h = atom.GetNumExplicitHs()
285
+ c = atom.GetFormalCharge()
286
+ atom.SetNumExplicitHs(h+1)
287
+ atom.SetFormalCharge(c+1)
288
+ Chem.SanitizeMol(self.rdmol)
289
+ self.rdmol = Chem.AddHs(self.rdmol, addCoords=True)
290
+ # The Chem.AddHs function in RDKit returns a new Mol object with hydrogens added to the molecule.
291
+ # It modifies the input molecule by adding hydrogens,
292
+ # but the original molecule remains unchanged.
293
+
294
+ return self
295
+
296
+
297
+ def deprotonate(self, atom_indices: list[int]) -> Self:
298
+ """Deprotonate given non-hydrogen atoms.
299
+
300
+ Args:
301
+ atom_indices (list[int]): atom indices of non-hydrogen atoms to deprotonate.
302
+
303
+ Returns:
304
+ Self: self.
305
+ """
306
+ for idx in atom_indices:
307
+ bonded_H_idx = None
308
+ atom = self.rdmol.GetAtomWithIdx(idx)
309
+ h = atom.GetNumExplicitHs()
310
+ if h-1 >= 0 :
311
+ atom.SetNumExplicitHs(h-1) # (h-1) must be unsigned int
312
+ c = atom.GetFormalCharge()
313
+ atom.SetFormalCharge(c-1)
314
+ neighbors = atom.GetNeighbors()
315
+
316
+ for neighbor in neighbors:
317
+ if neighbor.GetAtomicNum() == 1:
318
+ bonded_H_idx = neighbor.GetIdx()
319
+ break
320
+
321
+ if bonded_H_idx is not None:
322
+ edit_mol = Chem.EditableMol(self.rdmol)
323
+ edit_mol.RemoveAtom(bonded_H_idx)
324
+ self.rdmol = edit_mol.GetMol()
325
+ Chem.SanitizeMol(self.rdmol)
326
+
327
+ return self
328
+
273
329
 
274
330
  ##################################################
275
331
  ### Endpoint methods
@@ -1619,4 +1619,46 @@ class Mol:
1619
1619
  self.props = data['props']
1620
1620
  self.confs = [Conf().deserialize(_) for _ in data['confs']] # for 3D conformers (iterable)
1621
1621
 
1622
+ return self
1623
+
1624
+ def from_molblock(self, molblock: str) -> Self:
1625
+ """Initialize a new Mol object from MolBlock.
1626
+
1627
+ Args:
1628
+ molblock (str): MolBlock string
1629
+
1630
+ Raises:
1631
+ ValueError: invalid MolBlock
1632
+
1633
+ Returns:
1634
+ Self: self.
1635
+ """
1636
+ molecule = Chem.MolFromMolBlock(molblock)
1637
+ try:
1638
+ self.rdmol, _ = clean_2d(molecule, reset_isotope=True, remove_H=True)
1639
+ self.smiles = Chem.MolToSmiles(self.rdmol)
1640
+ self.confs = [Conf(x) for x in _]
1641
+ except:
1642
+ raise ValueError(f'Mol() Error: invalid MolBlock string')
1643
+
1644
+ assert self.smiles and self.rdmol, "Mol() Error: invalid molecule"
1645
+
1646
+ name = self.rdmol.GetProp('_Name')
1647
+
1648
+ rdDepictor.Compute2DCoords(self.rdmol)
1649
+
1650
+ try:
1651
+ self.name = str(name)
1652
+ except:
1653
+ self.name = 'untitled'
1654
+
1655
+ self.rdmol.SetProp('_Name', self.name) # _Name can't be None
1656
+ self.InChIKey = generate_inchi_key(self.rdmol)
1657
+ self.props.update({
1658
+ 'aka' : [], # <-- to be set by MolLibr.unique()
1659
+ 'atoms' : self.rdmol.GetNumAtoms(), # hydrogens not excluded?
1660
+ 'charge': rdmolops.GetFormalCharge(self.rdmol),
1661
+ "nrb" : Descriptors.NumRotatableBonds(self.rdmol),
1662
+ })
1663
+
1622
1664
  return self
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rdworks
3
- Version: 0.50.1
3
+ Version: 0.51.1
4
4
  Summary: Routine tasks built on RDKit and other tools
5
5
  Author-email: Sung-Hun Bae <sunghun.bae@gmail.com>
6
6
  Maintainer-email: Sung-Hun Bae <sunghun.bae@gmail.com>
@@ -76,6 +76,7 @@ src/rdworks/xtb/__init__.py
76
76
  src/rdworks/xtb/wrapper.py
77
77
  tests/test_basics.py
78
78
  tests/test_ionized.py
79
+ tests/test_qupkake.py
79
80
  tests/test_round.py
80
81
  tests/test_torsion.py
81
82
  tests/test_xtb.py
@@ -0,0 +1,19 @@
1
+ import rdworks
2
+
3
+ def test_readin_qupkake_output():
4
+ libr = rdworks.read_sdf('qupkake/output/qupkake_output.sdf', confs=True)
5
+ # libr contains one molecule because of confs=True
6
+ assert libr.count() == 1
7
+ for m in libr:
8
+ assert m.count() == 4
9
+ print(m.props)
10
+ print()
11
+ for c in m:
12
+ print(c.props)
13
+ print()
14
+
15
+ print(m.serialize(compressed=True))
16
+
17
+
18
+ if __name__ == '__main__':
19
+ test_readin_qupkake_output()
@@ -0,0 +1,76 @@
1
+ from rdworks import Mol
2
+ from rdworks.xtb.wrapper import GFN2xTB
3
+ from rdworks.testdata import drugs
4
+
5
+ from pathlib import Path
6
+
7
+
8
+ # In ASE, the default energy unit is eV (electron volt).
9
+ # It will be converted to kcal/mol
10
+ # CODATA 2018 energy conversion factor
11
+ hartree2ev = 27.211386245988
12
+ hartree2kcalpermol = 627.50947337481
13
+ ev2kcalpermol = 23.060547830619026
14
+
15
+
16
+ datadir = Path(__file__).parent.resolve() / "data"
17
+ workdir = Path(__file__).parent.resolve() / "outfiles"
18
+
19
+ workdir.mkdir(exist_ok=True)
20
+
21
+ name = 'Atorvastatin'
22
+ testmol = Mol(drugs[name], name).make_confs(n=50).optimize_confs()
23
+ testmol = testmol.drop_confs(similar=True, verbose=True).sort_confs()
24
+
25
+
26
+ def test_xtb_wrapper():
27
+ from rdworks.xtb.wrapper import GFN2xTB
28
+ assert GFN2xTB.is_xtb_ready() == True
29
+ assert GFN2xTB.is_cpx_ready() == True
30
+ assert GFN2xTB.is_cpcmx_ready() == True
31
+ assert GFN2xTB.is_ready() == True
32
+ assert GFN2xTB.version() is not None
33
+
34
+
35
+ def test_singlepoint():
36
+ mol = testmol.copy()
37
+
38
+ print("number of conformers=", mol.count())
39
+ print("number of atoms=", mol.confs[0].natoms)
40
+
41
+ gfn2xtb = GFN2xTB(mol.confs[0].rdmol)
42
+
43
+ print("GFN2xTB.singlepoint()")
44
+ outdict = gfn2xtb.singlepoint()
45
+ print(outdict)
46
+ print()
47
+
48
+ print("GFN2xTB.singlepoint(water='gbsa')")
49
+ outdict = gfn2xtb.singlepoint(water='gbsa')
50
+ print(outdict)
51
+ print()
52
+
53
+ print("GFN2xTB.singlepoint(water='alpb')")
54
+ outdict = gfn2xtb.singlepoint(water='alpb')
55
+ print(outdict)
56
+ print()
57
+
58
+ print("GFN2xTB.singlepoint(water='cpcmx')")
59
+ outdict = gfn2xtb.singlepoint(water='cpcmx')
60
+ print(outdict)
61
+ print()
62
+
63
+
64
+ def test_optimize():
65
+ mol = testmol.copy()
66
+ print("number of conformers=", mol.count())
67
+ print("GFN2xTB.optimize()")
68
+ outdict = GFN2xTB(mol.confs[0].rdmol).optimize(verbose=True)
69
+ print(outdict)
70
+ print()
71
+
72
+
73
+ if __name__ == '__main__':
74
+ test_xtb_wrapper()
75
+ test_singlepoint()
76
+ test_optimize()
@@ -1,160 +0,0 @@
1
- from rdworks import Mol
2
- from rdworks.xtb.wrapper import GFN2xTB
3
- from rdworks.testdata import drugs
4
-
5
- from pathlib import Path
6
-
7
-
8
- # In ASE, the default energy unit is eV (electron volt).
9
- # It will be converted to kcal/mol
10
- # CODATA 2018 energy conversion factor
11
- hartree2ev = 27.211386245988
12
- hartree2kcalpermol = 627.50947337481
13
- ev2kcalpermol = 23.060547830619026
14
-
15
-
16
- datadir = Path(__file__).parent.resolve() / "data"
17
- workdir = Path(__file__).parent.resolve() / "outfiles"
18
-
19
- workdir.mkdir(exist_ok=True)
20
-
21
- name = 'Atorvastatin'
22
- testmol = Mol(drugs[name], name).make_confs(n=50).optimize_confs()
23
- testmol = testmol.drop_confs(similar=True, verbose=True).sort_confs()
24
-
25
-
26
- def test_xtb_wrapper():
27
- from rdworks.xtb.wrapper import GFN2xTB
28
- assert GFN2xTB.is_xtb_ready() == True
29
- assert GFN2xTB.is_cpx_ready() == True
30
- assert GFN2xTB.is_cpcmx_ready() == True
31
- assert GFN2xTB.is_ready() == True
32
- assert GFN2xTB.version() is not None
33
-
34
-
35
- def test_singlepoint():
36
- mol = testmol.copy()
37
-
38
- print("number of conformers=", mol.count())
39
- print("number of atoms=", mol.confs[0].natoms)
40
-
41
- gfn2xtb = GFN2xTB(mol.confs[0].rdmol)
42
-
43
- print("GFN2xTB.singlepoint()")
44
- outdict = gfn2xtb.singlepoint()
45
- print(outdict)
46
- print()
47
-
48
- print("GFN2xTB.singlepoint(water='gbsa')")
49
- outdict = gfn2xtb.singlepoint(water='gbsa')
50
- print(outdict)
51
- print()
52
-
53
- print("GFN2xTB.singlepoint(water='alpb')")
54
- outdict = gfn2xtb.singlepoint(water='alpb')
55
- print(outdict)
56
- print()
57
-
58
- print("GFN2xTB.singlepoint(water='cpcmx')")
59
- outdict = gfn2xtb.singlepoint(water='cpcmx')
60
- print(outdict)
61
- print()
62
-
63
-
64
- def test_optimize():
65
- mol = testmol.copy()
66
- print("number of conformers=", mol.count())
67
- print("GFN2xTB.optimize()")
68
- outdict = GFN2xTB(mol.confs[0].rdmol).optimize(verbose=True)
69
- print(outdict)
70
- print()
71
-
72
-
73
- def test_state_generate():
74
- import rdworks
75
- import numpy as np
76
- import os
77
-
78
- task_queue = 'xtb'
79
-
80
- kT = 0.001987 * 300.0 # (kcal/mol K)
81
-
82
- smiles = 'CCCCNC(=O)[C@@H]1CCCN1[C@@H](CC)c1nnc(Cc2ccc(C)cc2)o1'
83
- n = 50
84
- method = 'ETKDG'
85
-
86
- standardized = rdworks.Mol(smiles)
87
- libr = rdworks.complete_tautomers(standardized)
88
-
89
- PE = []
90
- for mol in libr:
91
- mol = mol.make_confs(n=n, method=method, verbose=True)
92
- mol = mol.optimize_confs(calculator='MMFF94', verbose=True)
93
- mol = mol.drop_confs(similar=True, similar_rmsd=0.3, verbose=True)
94
- mol = mol.sort_confs(calculator='xTB', verbose=True)
95
- mol = mol.drop_confs(k=10, window=15.0, verbose=True) # enforcing both conditions
96
- _PE = []
97
- for conf in mol.confs:
98
- conf = conf.optimize(calculator='xTB', verbose=True)
99
- # GFN2xTB requires 3D coordinates
100
- xtb = GFN2xTB(conf.rdmol).singlepoint(water='cpcmx', verbose=True)
101
- _PE.append(xtb.PE)
102
- # SimpleNamespace(
103
- # PE = datadict['total energy'] * hartree2kcalpermol,
104
- # Gsolv = Gsolv,
105
- # charges = datadict['partial charges'],
106
- # wbo = Wiberg_bond_orders,
107
- # )
108
- PE.append(_PE)
109
- print(_PE)
110
-
111
- # calculate population
112
- PE = np.array(PE)
113
- PE = PE - np.min(PE)
114
- Boltzmann_factors = np.exp(-PE/kT)
115
- # partition function
116
- Z = np.sum(Boltzmann_factors)
117
- # population
118
- p = np.sum(Boltzmann_factors/Z, axis=1)
119
-
120
- sorted_indices = sorted(list(enumerate(p)), key=lambda x: x[1], reverse=True) # [(0,p0), (1,p1), ...]
121
-
122
- molecular_states = []
123
- for idx, population in sorted_indices:
124
- if population < 0.05:
125
- continue
126
-
127
- # state.keys() = ['rdmol','smiles','charge','population','pKa', 'qikprop']
128
-
129
- state_mol = libr[idx].rename(f'state.{idx+1}').qed(
130
- properties=['QED', 'MolWt', 'LogP', 'TPSA', 'HBD', 'HBA'])
131
-
132
- basic_properties = {
133
- 'QED' : round(state_mol.props['QED'], 2),
134
- 'MolWt' : round(state_mol.props['MolWt'], 2),
135
- 'LogP' : round(state_mol.props['LogP'], 2),
136
- 'TPSA' : round(state_mol.props['TPSA'], 2),
137
- 'HBD' : state_mol.props['HBD'],
138
- 'HBA' : state_mol.props['HBA'],
139
- }
140
-
141
- state_props = {
142
- 'method': task_queue,
143
- 'PE(kcal/mol)': state_mol.confs[0].props['E_tot(kcal/mol)'],
144
- 'population' : round(float(population), 3),
145
- 'basic_properties': basic_properties,
146
- 'rdkit_version': rdworks.__rdkit_version__,
147
- 'rdworks_version': rdworks.__version__,
148
- }
149
-
150
- molecular_states.append((state_mol.serialize(compressed=True), state_props))
151
-
152
- print(molecular_states)
153
-
154
-
155
-
156
- if __name__ == '__main__':
157
- test_xtb_wrapper()
158
- test_singlepoint()
159
- test_optimize()
160
- test_state_generate()
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
File without changes
File without changes
File without changes