westpa 2022.12__cp312-cp312-macosx_10_13_x86_64.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.
Potentially problematic release.
This version of westpa might be problematic. Click here for more details.
- westpa/__init__.py +14 -0
- westpa/_version.py +21 -0
- westpa/analysis/__init__.py +5 -0
- westpa/analysis/core.py +746 -0
- westpa/analysis/statistics.py +27 -0
- westpa/analysis/trajectories.py +360 -0
- westpa/cli/__init__.py +0 -0
- westpa/cli/core/__init__.py +0 -0
- westpa/cli/core/w_fork.py +152 -0
- westpa/cli/core/w_init.py +230 -0
- westpa/cli/core/w_run.py +77 -0
- westpa/cli/core/w_states.py +212 -0
- westpa/cli/core/w_succ.py +99 -0
- westpa/cli/core/w_truncate.py +68 -0
- westpa/cli/tools/__init__.py +0 -0
- westpa/cli/tools/ploterr.py +506 -0
- westpa/cli/tools/plothist.py +706 -0
- westpa/cli/tools/w_assign.py +596 -0
- westpa/cli/tools/w_bins.py +166 -0
- westpa/cli/tools/w_crawl.py +119 -0
- westpa/cli/tools/w_direct.py +547 -0
- westpa/cli/tools/w_dumpsegs.py +94 -0
- westpa/cli/tools/w_eddist.py +506 -0
- westpa/cli/tools/w_fluxanl.py +376 -0
- westpa/cli/tools/w_ipa.py +833 -0
- westpa/cli/tools/w_kinavg.py +127 -0
- westpa/cli/tools/w_kinetics.py +96 -0
- westpa/cli/tools/w_multi_west.py +414 -0
- westpa/cli/tools/w_ntop.py +213 -0
- westpa/cli/tools/w_pdist.py +515 -0
- westpa/cli/tools/w_postanalysis_matrix.py +82 -0
- westpa/cli/tools/w_postanalysis_reweight.py +53 -0
- westpa/cli/tools/w_red.py +491 -0
- westpa/cli/tools/w_reweight.py +780 -0
- westpa/cli/tools/w_select.py +226 -0
- westpa/cli/tools/w_stateprobs.py +111 -0
- westpa/cli/tools/w_trace.py +599 -0
- westpa/core/__init__.py +0 -0
- westpa/core/_rc.py +673 -0
- westpa/core/binning/__init__.py +55 -0
- westpa/core/binning/_assign.cpython-312-darwin.so +0 -0
- westpa/core/binning/assign.py +455 -0
- westpa/core/binning/binless.py +96 -0
- westpa/core/binning/binless_driver.py +54 -0
- westpa/core/binning/binless_manager.py +190 -0
- westpa/core/binning/bins.py +47 -0
- westpa/core/binning/mab.py +506 -0
- westpa/core/binning/mab_driver.py +54 -0
- westpa/core/binning/mab_manager.py +198 -0
- westpa/core/data_manager.py +1694 -0
- westpa/core/extloader.py +74 -0
- westpa/core/h5io.py +995 -0
- westpa/core/kinetics/__init__.py +24 -0
- westpa/core/kinetics/_kinetics.cpython-312-darwin.so +0 -0
- westpa/core/kinetics/events.py +147 -0
- westpa/core/kinetics/matrates.py +156 -0
- westpa/core/kinetics/rate_averaging.py +266 -0
- westpa/core/progress.py +218 -0
- westpa/core/propagators/__init__.py +54 -0
- westpa/core/propagators/executable.py +719 -0
- westpa/core/reweight/__init__.py +14 -0
- westpa/core/reweight/_reweight.cpython-312-darwin.so +0 -0
- westpa/core/reweight/matrix.py +126 -0
- westpa/core/segment.py +119 -0
- westpa/core/sim_manager.py +835 -0
- westpa/core/states.py +359 -0
- westpa/core/systems.py +93 -0
- westpa/core/textio.py +74 -0
- westpa/core/trajectory.py +330 -0
- westpa/core/we_driver.py +910 -0
- westpa/core/wm_ops.py +43 -0
- westpa/core/yamlcfg.py +391 -0
- westpa/fasthist/__init__.py +34 -0
- westpa/fasthist/_fasthist.cpython-312-darwin.so +0 -0
- westpa/mclib/__init__.py +271 -0
- westpa/mclib/__main__.py +28 -0
- westpa/mclib/_mclib.cpython-312-darwin.so +0 -0
- westpa/oldtools/__init__.py +4 -0
- westpa/oldtools/aframe/__init__.py +35 -0
- westpa/oldtools/aframe/atool.py +75 -0
- westpa/oldtools/aframe/base_mixin.py +26 -0
- westpa/oldtools/aframe/binning.py +178 -0
- westpa/oldtools/aframe/data_reader.py +560 -0
- westpa/oldtools/aframe/iter_range.py +200 -0
- westpa/oldtools/aframe/kinetics.py +117 -0
- westpa/oldtools/aframe/mcbs.py +153 -0
- westpa/oldtools/aframe/output.py +39 -0
- westpa/oldtools/aframe/plotting.py +90 -0
- westpa/oldtools/aframe/trajwalker.py +126 -0
- westpa/oldtools/aframe/transitions.py +469 -0
- westpa/oldtools/cmds/__init__.py +0 -0
- westpa/oldtools/cmds/w_ttimes.py +361 -0
- westpa/oldtools/files.py +34 -0
- westpa/oldtools/miscfn.py +23 -0
- westpa/oldtools/stats/__init__.py +4 -0
- westpa/oldtools/stats/accumulator.py +35 -0
- westpa/oldtools/stats/edfs.py +129 -0
- westpa/oldtools/stats/mcbs.py +96 -0
- westpa/tools/__init__.py +33 -0
- westpa/tools/binning.py +472 -0
- westpa/tools/core.py +340 -0
- westpa/tools/data_reader.py +159 -0
- westpa/tools/dtypes.py +31 -0
- westpa/tools/iter_range.py +198 -0
- westpa/tools/kinetics_tool.py +340 -0
- westpa/tools/plot.py +283 -0
- westpa/tools/progress.py +17 -0
- westpa/tools/selected_segs.py +154 -0
- westpa/tools/wipi.py +751 -0
- westpa/trajtree/__init__.py +4 -0
- westpa/trajtree/_trajtree.cpython-312-darwin.so +0 -0
- westpa/trajtree/trajtree.py +117 -0
- westpa/westext/__init__.py +0 -0
- westpa/westext/adaptvoronoi/__init__.py +3 -0
- westpa/westext/adaptvoronoi/adaptVor_driver.py +214 -0
- westpa/westext/hamsm_restarting/__init__.py +3 -0
- westpa/westext/hamsm_restarting/example_overrides.py +35 -0
- westpa/westext/hamsm_restarting/restart_driver.py +1165 -0
- westpa/westext/stringmethod/__init__.py +11 -0
- westpa/westext/stringmethod/fourier_fitting.py +69 -0
- westpa/westext/stringmethod/string_driver.py +253 -0
- westpa/westext/stringmethod/string_method.py +306 -0
- westpa/westext/weed/BinCluster.py +180 -0
- westpa/westext/weed/ProbAdjustEquil.py +100 -0
- westpa/westext/weed/UncertMath.py +247 -0
- westpa/westext/weed/__init__.py +10 -0
- westpa/westext/weed/weed_driver.py +192 -0
- westpa/westext/wess/ProbAdjust.py +101 -0
- westpa/westext/wess/__init__.py +6 -0
- westpa/westext/wess/wess_driver.py +217 -0
- westpa/work_managers/__init__.py +57 -0
- westpa/work_managers/core.py +396 -0
- westpa/work_managers/environment.py +134 -0
- westpa/work_managers/mpi.py +318 -0
- westpa/work_managers/processes.py +187 -0
- westpa/work_managers/serial.py +28 -0
- westpa/work_managers/threads.py +79 -0
- westpa/work_managers/zeromq/__init__.py +20 -0
- westpa/work_managers/zeromq/core.py +641 -0
- westpa/work_managers/zeromq/node.py +131 -0
- westpa/work_managers/zeromq/work_manager.py +526 -0
- westpa/work_managers/zeromq/worker.py +320 -0
- westpa-2022.12.dist-info/AUTHORS +22 -0
- westpa-2022.12.dist-info/LICENSE +21 -0
- westpa-2022.12.dist-info/METADATA +193 -0
- westpa-2022.12.dist-info/RECORD +149 -0
- westpa-2022.12.dist-info/WHEEL +6 -0
- westpa-2022.12.dist-info/entry_points.txt +29 -0
- westpa-2022.12.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
from westpa.core.binning.mab import MABBinMapper
|
|
4
|
+
from westpa.core.sim_manager import WESimManager, grouper
|
|
5
|
+
from westpa.core.states import InitialState, pare_basis_initial_states
|
|
6
|
+
from westpa.core import wm_ops
|
|
7
|
+
from westpa.core.segment import Segment
|
|
8
|
+
import numpy as np
|
|
9
|
+
|
|
10
|
+
log = logging.getLogger(__name__)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class MABSimManager(WESimManager):
|
|
14
|
+
'''Subclass of WESimManager, modifying it so bin assignments will be done after all segments are done propagating.'''
|
|
15
|
+
|
|
16
|
+
def initialize_simulation(self, basis_states, target_states, start_states, segs_per_state=1, suppress_we=False):
|
|
17
|
+
'''Making sure that that the MABBinMapper is not the outer bin.'''
|
|
18
|
+
if len(target_states) > 0:
|
|
19
|
+
if isinstance(self.system.bin_mapper, MABBinMapper):
|
|
20
|
+
log.error("MABBinMapper cannot be an outer binning scheme with a target state\n")
|
|
21
|
+
|
|
22
|
+
super().initialize_simulation(
|
|
23
|
+
basis_states, target_states, start_states, segs_per_state=segs_per_state, suppress_we=suppress_we
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
def propagate(self):
|
|
27
|
+
log.debug("MABSimManager in use")
|
|
28
|
+
segments = list(self.incomplete_segments.values())
|
|
29
|
+
log.debug('iteration {:d}: propagating {:d} segments'.format(self.n_iter, len(segments)))
|
|
30
|
+
|
|
31
|
+
# all futures dispatched for this iteration
|
|
32
|
+
futures = set()
|
|
33
|
+
segment_futures = set()
|
|
34
|
+
|
|
35
|
+
# Immediately dispatch any necessary initial state generation
|
|
36
|
+
istate_gen_futures = self.get_istate_futures()
|
|
37
|
+
futures.update(istate_gen_futures)
|
|
38
|
+
|
|
39
|
+
# Dispatch propagation tasks using work manager
|
|
40
|
+
for segment_block in grouper(self.propagator_block_size, segments):
|
|
41
|
+
segment_block = [_f for _f in segment_block if _f]
|
|
42
|
+
pbstates, pistates = pare_basis_initial_states(
|
|
43
|
+
self.current_iter_bstates, list(self.current_iter_istates.values()), segment_block
|
|
44
|
+
)
|
|
45
|
+
future = self.work_manager.submit(wm_ops.propagate, args=(pbstates, pistates, segment_block))
|
|
46
|
+
futures.add(future)
|
|
47
|
+
segment_futures.add(future)
|
|
48
|
+
|
|
49
|
+
while futures:
|
|
50
|
+
# TODO: add capacity for timeout or SIGINT here
|
|
51
|
+
future = self.work_manager.wait_any(futures)
|
|
52
|
+
futures.remove(future)
|
|
53
|
+
|
|
54
|
+
if future in segment_futures:
|
|
55
|
+
segment_futures.remove(future)
|
|
56
|
+
incoming = future.get_result()
|
|
57
|
+
self.n_propagated += 1
|
|
58
|
+
|
|
59
|
+
self.segments.update({segment.seg_id: segment for segment in incoming})
|
|
60
|
+
self.completed_segments.update({segment.seg_id: segment for segment in incoming})
|
|
61
|
+
|
|
62
|
+
new_istate_futures = self.get_istate_futures()
|
|
63
|
+
istate_gen_futures.update(new_istate_futures)
|
|
64
|
+
futures.update(new_istate_futures)
|
|
65
|
+
|
|
66
|
+
with self.data_manager.expiring_flushing_lock():
|
|
67
|
+
self.data_manager.update_segments(self.n_iter, incoming)
|
|
68
|
+
|
|
69
|
+
elif future in istate_gen_futures:
|
|
70
|
+
istate_gen_futures.remove(future)
|
|
71
|
+
_basis_state, initial_state = future.get_result()
|
|
72
|
+
log.debug('received newly-prepared initial state {!r}'.format(initial_state))
|
|
73
|
+
initial_state.istate_status = InitialState.ISTATE_STATUS_PREPARED
|
|
74
|
+
with self.data_manager.expiring_flushing_lock():
|
|
75
|
+
self.data_manager.update_initial_states([initial_state], n_iter=self.n_iter + 1)
|
|
76
|
+
self.we_driver.avail_initial_states[initial_state.state_id] = initial_state
|
|
77
|
+
else:
|
|
78
|
+
log.error('unknown future {!r} received from work manager'.format(future))
|
|
79
|
+
raise AssertionError('untracked future {!r}'.format(future))
|
|
80
|
+
|
|
81
|
+
# Collectively assign all segments to their bins...
|
|
82
|
+
self.we_driver.assign(self.segments.values())
|
|
83
|
+
|
|
84
|
+
# For cases where we need even more istates for recycled trajectories
|
|
85
|
+
# futures should be empty at this point.
|
|
86
|
+
istate_gen_futures = self.get_istate_futures()
|
|
87
|
+
futures.update(istate_gen_futures)
|
|
88
|
+
|
|
89
|
+
# Wait for istate_gen_futures and catch untracked futures.
|
|
90
|
+
while futures:
|
|
91
|
+
future = self.work_manager.wait_any(futures)
|
|
92
|
+
futures.remove(future)
|
|
93
|
+
|
|
94
|
+
if future in istate_gen_futures:
|
|
95
|
+
istate_gen_futures.remove(future)
|
|
96
|
+
_basis_state, initial_state = future.get_result()
|
|
97
|
+
log.debug('received newly-prepared initial state {!r}'.format(initial_state))
|
|
98
|
+
initial_state.istate_status = InitialState.ISTATE_STATUS_PREPARED
|
|
99
|
+
with self.data_manager.expiring_flushing_lock():
|
|
100
|
+
self.data_manager.update_initial_states([initial_state], n_iter=self.n_iter + 1)
|
|
101
|
+
self.we_driver.avail_initial_states[initial_state.state_id] = initial_state
|
|
102
|
+
else:
|
|
103
|
+
log.error('unknown future {!r} received from work manager'.format(future))
|
|
104
|
+
raise AssertionError('untracked future {!r}'.format(future))
|
|
105
|
+
|
|
106
|
+
log.debug('done with propagation')
|
|
107
|
+
self.save_bin_data()
|
|
108
|
+
self.data_manager.flush_backing()
|
|
109
|
+
|
|
110
|
+
def prepare_iteration(self):
|
|
111
|
+
log.debug('beginning iteration {:d}'.format(self.n_iter))
|
|
112
|
+
|
|
113
|
+
# the WE driver needs a list of all target states for this iteration
|
|
114
|
+
# along with information about any new weights introduced (e.g. by recycling)
|
|
115
|
+
target_states = self.data_manager.get_target_states(self.n_iter)
|
|
116
|
+
new_weights = self.data_manager.get_new_weight_data(self.n_iter)
|
|
117
|
+
|
|
118
|
+
self.we_driver.new_iteration(target_states=target_states, new_weights=new_weights)
|
|
119
|
+
|
|
120
|
+
# Get basis states used in this iteration
|
|
121
|
+
self.current_iter_bstates = self.data_manager.get_basis_states(self.n_iter)
|
|
122
|
+
|
|
123
|
+
# Get the segments for this iteration and separate into complete and incomplete
|
|
124
|
+
if self.segments is None:
|
|
125
|
+
segments = self.segments = {segment.seg_id: segment for segment in self.data_manager.get_segments()}
|
|
126
|
+
log.debug('loaded {:d} segments'.format(len(segments)))
|
|
127
|
+
else:
|
|
128
|
+
segments = self.segments
|
|
129
|
+
log.debug('using {:d} pre-existing segments'.format(len(segments)))
|
|
130
|
+
|
|
131
|
+
completed_segments = self.completed_segments = {}
|
|
132
|
+
incomplete_segments = self.incomplete_segments = {}
|
|
133
|
+
for segment in segments.values():
|
|
134
|
+
if segment.status == Segment.SEG_STATUS_COMPLETE:
|
|
135
|
+
completed_segments[segment.seg_id] = segment
|
|
136
|
+
else:
|
|
137
|
+
incomplete_segments[segment.seg_id] = segment
|
|
138
|
+
log.debug('{:d} segments are complete; {:d} are incomplete'.format(len(completed_segments), len(incomplete_segments)))
|
|
139
|
+
|
|
140
|
+
if len(incomplete_segments) == len(segments):
|
|
141
|
+
# Starting a new iteration
|
|
142
|
+
self.rc.pstatus('Beginning iteration {:d}'.format(self.n_iter))
|
|
143
|
+
elif incomplete_segments:
|
|
144
|
+
self.rc.pstatus('Continuing iteration {:d}'.format(self.n_iter))
|
|
145
|
+
self.rc.pstatus(
|
|
146
|
+
'{:d} segments remain in iteration {:d} ({:d} total)'.format(len(incomplete_segments), self.n_iter, len(segments))
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
# Get the initial states active for this iteration (so that the propagator has them if necessary)
|
|
150
|
+
self.current_iter_istates = {
|
|
151
|
+
state.state_id: state for state in self.data_manager.get_segment_initial_states(list(segments.values()))
|
|
152
|
+
}
|
|
153
|
+
log.debug('This iteration uses {:d} initial states'.format(len(self.current_iter_istates)))
|
|
154
|
+
|
|
155
|
+
n_segments = len(segments)
|
|
156
|
+
pcoords_with_weights = np.empty((n_segments, self.system.pcoord_ndim + 2), dtype=self.system.pcoord_dtype)
|
|
157
|
+
|
|
158
|
+
for iseg, segment in enumerate(segments.values()):
|
|
159
|
+
pcoords_with_weights[iseg] = np.append(segment.pcoord[0, :], [segment.weight, 1.0])
|
|
160
|
+
|
|
161
|
+
# Assign this iteration's segments' initial points to bins and report on bin population
|
|
162
|
+
initial_binning = self.system.bin_mapper.construct_bins()
|
|
163
|
+
initial_assignments = self.system.bin_mapper.assign(pcoords_with_weights)
|
|
164
|
+
for segment, assignment in zip(iter(segments.values()), initial_assignments):
|
|
165
|
+
initial_binning[assignment].add(segment)
|
|
166
|
+
self.report_bin_statistics(initial_binning, [], save_summary=True)
|
|
167
|
+
del pcoords_with_weights, initial_binning
|
|
168
|
+
|
|
169
|
+
self.rc.pstatus("MAB binning in use")
|
|
170
|
+
|
|
171
|
+
self.rc.pstatus("Bottleneck bin occupancy may not be accurately reported")
|
|
172
|
+
|
|
173
|
+
self.rc.pstatus("Waiting for segments to complete...")
|
|
174
|
+
|
|
175
|
+
# Let the WE driver assign completed segments
|
|
176
|
+
if completed_segments and len(incomplete_segments) == 0:
|
|
177
|
+
self.we_driver.assign(list(completed_segments.values()))
|
|
178
|
+
|
|
179
|
+
# load restart data
|
|
180
|
+
self.data_manager.prepare_segment_restarts(
|
|
181
|
+
incomplete_segments.values(), self.current_iter_bstates, self.current_iter_istates
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
# Get the basis states and initial states for the next iteration, necessary for doing on-the-fly recycling
|
|
185
|
+
self.next_iter_bstates = self.data_manager.get_basis_states(self.n_iter + 1)
|
|
186
|
+
self.next_iter_bstate_cprobs = np.add.accumulate([bstate.probability for bstate in self.next_iter_bstates])
|
|
187
|
+
|
|
188
|
+
self.we_driver.avail_initial_states = {
|
|
189
|
+
istate.state_id: istate for istate in self.data_manager.get_unused_initial_states(n_iter=self.n_iter + 1)
|
|
190
|
+
}
|
|
191
|
+
log.debug('{:d} unused initial states found'.format(len(self.we_driver.avail_initial_states)))
|
|
192
|
+
|
|
193
|
+
# Invoke callbacks
|
|
194
|
+
self.invoke_callbacks(self.prepare_iteration)
|
|
195
|
+
|
|
196
|
+
# dispatch and immediately wait on result for prep_iter
|
|
197
|
+
log.debug('dispatching propagator prep_iter to work manager')
|
|
198
|
+
self.work_manager.submit(wm_ops.prep_iter, args=(self.n_iter, segments)).get_result()
|