rdworks 0.53.1__py3-none-any.whl → 0.54.2__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.
- rdworks/__init__.py +1 -1
- rdworks/microstates.py +23 -15
- rdworks/xtb/wrapper.py +7 -6
- {rdworks-0.53.1.dist-info → rdworks-0.54.2.dist-info}/METADATA +1 -1
- {rdworks-0.53.1.dist-info → rdworks-0.54.2.dist-info}/RECORD +8 -8
- {rdworks-0.53.1.dist-info → rdworks-0.54.2.dist-info}/WHEEL +0 -0
- {rdworks-0.53.1.dist-info → rdworks-0.54.2.dist-info}/licenses/LICENSE +0 -0
- {rdworks-0.53.1.dist-info → rdworks-0.54.2.dist-info}/top_level.txt +0 -0
rdworks/__init__.py
CHANGED
rdworks/microstates.py
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
import numpy as np
|
2
2
|
import math
|
3
3
|
import itertools
|
4
|
+
import logging
|
4
5
|
|
5
6
|
from types import SimpleNamespace
|
6
7
|
from rdworks import Conf, Mol
|
7
8
|
from rdworks.xtb.wrapper import GFN2xTB
|
8
9
|
|
9
10
|
|
11
|
+
logger = logging.getLogger(__name__)
|
12
|
+
|
13
|
+
|
10
14
|
kT = 0.001987 * 298.0 # (kcal/mol K), standard condition
|
11
15
|
C = math.log(10) * kT
|
12
16
|
|
@@ -23,9 +27,10 @@ class Microstates():
|
|
23
27
|
self.mols = []
|
24
28
|
self.reference = None
|
25
29
|
|
26
|
-
|
30
|
+
|
31
|
+
def enumerate(self) -> None:
|
32
|
+
# Qu pKake results must be stored at .confs
|
27
33
|
for conf in self.origin:
|
28
|
-
print(conf.props)
|
29
34
|
pka = conf.props.get('pka', None)
|
30
35
|
if pka is None:
|
31
36
|
# no protonation/deprotonation sites
|
@@ -49,7 +54,7 @@ class Microstates():
|
|
49
54
|
|
50
55
|
for (p, d) in PD:
|
51
56
|
conf = self.origin.confs[0].copy()
|
52
|
-
conf = conf.protonate(p).deprotonate(d).optimize(calculator=calculator)
|
57
|
+
conf = conf.protonate(p).deprotonate(d).optimize(calculator=self.calculator)
|
53
58
|
charge = len(p) - len(d)
|
54
59
|
self.states.append(SimpleNamespace(
|
55
60
|
charge=charge,
|
@@ -83,7 +88,7 @@ class Microstates():
|
|
83
88
|
return float(np.dot(p, pe_array))
|
84
89
|
|
85
90
|
|
86
|
-
def
|
91
|
+
def populate(self) -> None:
|
87
92
|
for microstate in self.states:
|
88
93
|
mol = Mol(microstate.conf).make_confs(n=4).optimize_confs()
|
89
94
|
# mol = mol.drop_confs(similar=True, similar_rmsd=0.3, verbose=True)
|
@@ -94,23 +99,21 @@ class Microstates():
|
|
94
99
|
conf = conf.optimize(calculator=self.calculator, verbose=True)
|
95
100
|
# GFN2xTB requires 3D coordinates
|
96
101
|
# xtb = GFN2xTB(conf.rdmol).singlepoint(water='cpcmx', verbose=True)
|
97
|
-
|
98
|
-
|
102
|
+
PE.append(conf.potential_energy(calculator=self.calculator))
|
103
|
+
# xtb = GFN2xTB(conf.rdmol).singlepoint(verbose=True)
|
99
104
|
# SimpleNamespace(
|
100
105
|
# PE = datadict['total energy'] * hartree2kcalpermol,
|
101
106
|
# Gsolv = Gsolv,
|
102
107
|
# charges = datadict['partial charges'],
|
103
108
|
# wbo = Wiberg_bond_orders,
|
104
109
|
# )
|
105
|
-
print("PE=", PE)
|
106
110
|
microstate.PE = self.Boltzmann_weighted_average(PE)
|
107
|
-
|
108
|
-
|
111
|
+
logger.info(f"PE= {PE}")
|
112
|
+
logger.info(f"Boltzmann weighted= {microstate.PE}")
|
109
113
|
self.mols.append(mol)
|
110
|
-
print("microstate.energy", microstate)
|
111
114
|
|
112
115
|
|
113
|
-
def
|
116
|
+
def get_populations(self, pH: float) -> list[tuple]:
|
114
117
|
# set the lowest dG as the reference
|
115
118
|
self.reference = self.states[np.argmin([microstate.PE for microstate in self.states])]
|
116
119
|
for microstate in self.states:
|
@@ -120,7 +123,7 @@ class Microstates():
|
|
120
123
|
dG.append((microstate.PE - self.reference.PE) + microstate.delta_m * C * pH)
|
121
124
|
dG = np.array(dG)
|
122
125
|
|
123
|
-
|
126
|
+
logger.info(f"dG= {dG}")
|
124
127
|
Boltzmann_factors = np.exp(-dG/kT)
|
125
128
|
Z = np.sum(Boltzmann_factors)
|
126
129
|
p = Boltzmann_factors/Z
|
@@ -128,11 +131,16 @@ class Microstates():
|
|
128
131
|
# [(0, p0), (1, p1), ...]
|
129
132
|
|
130
133
|
return idx_p
|
134
|
+
|
135
|
+
|
136
|
+
def get_ensemble(self) -> list[Mol]:
|
137
|
+
return self.mols
|
138
|
+
|
139
|
+
|
140
|
+
def get_mol(self, idx: int) -> Mol:
|
141
|
+
return self.mols[idx]
|
131
142
|
|
132
143
|
|
133
144
|
def count(self) -> int:
|
134
145
|
return len(self.states)
|
135
146
|
|
136
|
-
|
137
|
-
def get_mol(self, idx: int) -> Mol:
|
138
|
-
return self.mols[idx]
|
rdworks/xtb/wrapper.py
CHANGED
@@ -79,7 +79,8 @@ class GFN2xTB:
|
|
79
79
|
proc = subprocess.run(['xtb', test_geometry, '--opt'],
|
80
80
|
cwd=temp_dir,
|
81
81
|
capture_output=True,
|
82
|
-
text=True
|
82
|
+
text=True,
|
83
|
+
encoding='utf-8')
|
83
84
|
assert proc.returncode == 0
|
84
85
|
|
85
86
|
return True
|
@@ -122,7 +123,7 @@ $ cp -r xtb-dist/share /usr/local/ """)
|
|
122
123
|
if GFN2xTB.is_xtb_ready():
|
123
124
|
with tempfile.TemporaryDirectory() as temp_dir: # tmpdir is a string
|
124
125
|
cmd = ['xtb', '--cpcmx']
|
125
|
-
proc = subprocess.run(cmd, cwd=temp_dir, capture_output=True, text=True)
|
126
|
+
proc = subprocess.run(cmd, cwd=temp_dir, capture_output=True, text=True, encoding='utf-8')
|
126
127
|
# we are expecting an error because no input file is given
|
127
128
|
assert proc.returncode != 0
|
128
129
|
for line in proc.stdout.split('\n'):
|
@@ -156,7 +157,7 @@ $ cp -r xtb-dist/share /usr/local/ """)
|
|
156
157
|
if GFN2xTB.is_xtb_ready():
|
157
158
|
with tempfile.TemporaryDirectory() as temp_dir: # tmpdir is a string
|
158
159
|
cmd = ['xtb', '--version']
|
159
|
-
proc = subprocess.run(cmd, cwd=temp_dir, capture_output=True, text=True)
|
160
|
+
proc = subprocess.run(cmd, cwd=temp_dir, capture_output=True, text=True, encoding='utf-8')
|
160
161
|
assert proc.returncode == 0, "GFN2xTB() Error: xtb not available"
|
161
162
|
match = re.search('xtb\s+version\s+(?P<version>[\d.]+)', proc.stdout)
|
162
163
|
if match:
|
@@ -358,7 +359,7 @@ $ cp -r xtb-dist/share /usr/local/ """)
|
|
358
359
|
|
359
360
|
# 'xtbout.json', 'xtbrestart', 'xtbtopo.mol', 'charges', and 'wbo' files will be
|
360
361
|
# created in the current working directory.
|
361
|
-
proc = subprocess.run(cmd + options, cwd=temp_dir, capture_output=True, text=True)
|
362
|
+
proc = subprocess.run(cmd + options, cwd=temp_dir, capture_output=True, text=True, encoding='utf-8')
|
362
363
|
# if proc.returncode == 0:
|
363
364
|
# print("Standard Output:")
|
364
365
|
# print(proc.stdout)
|
@@ -461,7 +462,7 @@ $ cp -r xtb-dist/share /usr/local/ """)
|
|
461
462
|
if verbose:
|
462
463
|
logger.info(f"optimize() {' '.join(cmd+options)}")
|
463
464
|
|
464
|
-
proc = subprocess.run(cmd + options, cwd=temp_dir, capture_output=True, text=True)
|
465
|
+
proc = subprocess.run(cmd + options, cwd=temp_dir, capture_output=True, text=True, encoding='utf-8')
|
465
466
|
|
466
467
|
if proc.returncode == 0 and xtbout_path.is_file():
|
467
468
|
with open(xtbout_path, 'r') as f:
|
@@ -527,7 +528,7 @@ $ cp -r xtb-dist/share /usr/local/ """)
|
|
527
528
|
elif water == 'alpb':
|
528
529
|
options += ['--alpb', 'water']
|
529
530
|
|
530
|
-
proc = subprocess.run(cmd + options, cwd=temp_dir, capture_output=True, text=True)
|
531
|
+
proc = subprocess.run(cmd + options, cwd=temp_dir, capture_output=True, text=True, encoding='utf-8')
|
531
532
|
# output files: xtb_esp.cosmo, xtb_esp.dat, xtb_esp_profile.dat
|
532
533
|
|
533
534
|
if proc.returncode == 0 and xtb_esp_dat.is_file():
|
@@ -1,10 +1,10 @@
|
|
1
|
-
rdworks/__init__.py,sha256=
|
1
|
+
rdworks/__init__.py,sha256=wn52g1WQn_aTo2WLF-sBenvSluTfnH2dgZRIB3cjDVI,1358
|
2
2
|
rdworks/conf.py,sha256=eH_a3ywmmJiPtnvgk86ykurYOx879AHg80-Dn8z1X70,36379
|
3
3
|
rdworks/descriptor.py,sha256=34T_dQ6g8v3u-ym8TLKbQtxIIV5TEo-d3pdedq3o-cg,2106
|
4
4
|
rdworks/display.py,sha256=JR0gR26UpH-JCxVOaqXZCUj2MiGZSrx9Me87FncspVI,13469
|
5
5
|
rdworks/ionized.py,sha256=_t-Ajssv1rytV4Y_KsSbxfnsBKqy-EusbhNUtaWcV6o,7681
|
6
6
|
rdworks/matchedseries.py,sha256=A3ON4CUpQV159mu9VqgNiJ8uoQ9ePOry9d3ra4NCAgc,10377
|
7
|
-
rdworks/microstates.py,sha256=
|
7
|
+
rdworks/microstates.py,sha256=V1xhMPxAB06_WrB71NEMJjKHI9pPMUuZVswpSmdnSBM,5285
|
8
8
|
rdworks/mol.py,sha256=4gNjs_ryNNWThMekV794uwjjBE-JLGGWcdyMaS9-xP8,71369
|
9
9
|
rdworks/mollibr.py,sha256=X4UBO6Ga-QmNS7RwUiaDYAx0Q5hnWs71yTkEpH02Qb4,37696
|
10
10
|
rdworks/pka.py,sha256=NVJVfpcNEMlX5QRyLBgUM7GIT7VMjO-llAR4LWc8J2c,1656
|
@@ -66,9 +66,9 @@ rdworks/predefined/misc/reactive-part-2.xml,sha256=0vNTMwWrrQmxBpbgbyRHx8sVs83cq
|
|
66
66
|
rdworks/predefined/misc/reactive-part-3.xml,sha256=LgWHSEbRTVmgBoIO45xbTo1xQJs0Xu51j3JnIapRYo4,3094
|
67
67
|
rdworks/predefined/misc/reactive.xml,sha256=syedoQ6VYUfRLnxy99ObuDniJ_a_WhrWAJbTKFfJ6VY,11248
|
68
68
|
rdworks/xtb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
69
|
-
rdworks/xtb/wrapper.py,sha256=
|
70
|
-
rdworks-0.
|
71
|
-
rdworks-0.
|
72
|
-
rdworks-0.
|
73
|
-
rdworks-0.
|
74
|
-
rdworks-0.
|
69
|
+
rdworks/xtb/wrapper.py,sha256=YpZY8SJ9Lrp3I3_GAVawSb_4_Zc8hcJtF5l7-I-Wbys,22048
|
70
|
+
rdworks-0.54.2.dist-info/licenses/LICENSE,sha256=UOkJSBqYyQUvtCp7a-vdCANeEcLE2dnTie_eB1By5SY,1074
|
71
|
+
rdworks-0.54.2.dist-info/METADATA,sha256=qwcHC-qMQQQwes5UKUJtbwpFRUr9aEr5wdBuCJ5HWOQ,1967
|
72
|
+
rdworks-0.54.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
73
|
+
rdworks-0.54.2.dist-info/top_level.txt,sha256=05C98HbvBK2axUBogC_hAT_CdpOeQYGnQ6vRAgawr8s,8
|
74
|
+
rdworks-0.54.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|