westpa 2022.5__cp39-cp39-macosx_10_9_x86_64.whl → 2022.7__cp39-cp39-macosx_10_9_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.

Files changed (69) hide show
  1. westpa/__init__.py +0 -4
  2. westpa/_version.py +3 -3
  3. westpa/cli/core/w_fork.py +1 -1
  4. westpa/cli/core/w_init.py +0 -1
  5. westpa/cli/core/w_run.py +0 -1
  6. westpa/cli/core/w_states.py +0 -2
  7. westpa/cli/core/w_succ.py +1 -1
  8. westpa/cli/tools/w_assign.py +0 -1
  9. westpa/cli/tools/w_bins.py +0 -1
  10. westpa/cli/tools/w_dumpsegs.py +1 -1
  11. westpa/cli/tools/w_eddist.py +0 -4
  12. westpa/cli/tools/w_ipa.py +0 -1
  13. westpa/cli/tools/w_multi_west.py +16 -11
  14. westpa/cli/tools/w_pdist.py +0 -1
  15. westpa/cli/tools/w_red.py +0 -1
  16. westpa/core/_rc.py +0 -1
  17. westpa/core/binning/_assign.cpython-39-darwin.so +0 -0
  18. westpa/core/binning/assign.py +5 -3
  19. westpa/core/binning/binless_driver.py +1 -1
  20. westpa/core/binning/binless_manager.py +25 -2
  21. westpa/core/binning/mab.py +23 -7
  22. westpa/core/binning/mab_driver.py +1 -1
  23. westpa/core/binning/mab_manager.py +25 -2
  24. westpa/core/data_manager.py +5 -6
  25. westpa/core/h5io.py +1 -5
  26. westpa/core/kinetics/_kinetics.cpython-39-darwin.so +0 -0
  27. westpa/core/propagators/__init__.py +0 -1
  28. westpa/core/propagators/executable.py +10 -10
  29. westpa/core/reweight/_reweight.cpython-39-darwin.so +0 -0
  30. westpa/core/sim_manager.py +3 -4
  31. westpa/core/states.py +19 -3
  32. westpa/core/trajectory.py +9 -1
  33. westpa/core/we_driver.py +7 -7
  34. westpa/core/yamlcfg.py +1 -0
  35. westpa/fasthist/_fasthist.cpython-39-darwin.so +0 -0
  36. westpa/mclib/_mclib.cpython-39-darwin.so +0 -0
  37. westpa/oldtools/aframe/binning.py +2 -2
  38. westpa/oldtools/aframe/data_reader.py +3 -4
  39. westpa/oldtools/aframe/kinetics.py +0 -1
  40. westpa/oldtools/aframe/trajwalker.py +1 -1
  41. westpa/oldtools/aframe/transitions.py +1 -3
  42. westpa/oldtools/cmds/w_ttimes.py +2 -4
  43. westpa/tools/__init__.py +1 -0
  44. westpa/tools/binning.py +1 -4
  45. westpa/tools/kinetics_tool.py +0 -3
  46. westpa/tools/selected_segs.py +0 -1
  47. westpa/trajtree/_trajtree.cpython-39-darwin.so +0 -0
  48. westpa/trajtree/trajtree.py +0 -2
  49. westpa/westext/adaptvoronoi/adaptVor_driver.py +0 -2
  50. westpa/westext/hamsm_restarting/example_overrides.py +0 -1
  51. westpa/westext/hamsm_restarting/restart_driver.py +1 -18
  52. westpa/westext/stringmethod/string_driver.py +0 -1
  53. westpa/westext/stringmethod/string_method.py +0 -2
  54. westpa/westext/weed/weed_driver.py +2 -2
  55. westpa/westext/wess/ProbAdjust.py +0 -1
  56. westpa/westext/wess/wess_driver.py +2 -2
  57. westpa/work_managers/environment.py +0 -2
  58. westpa/work_managers/mpi.py +0 -7
  59. westpa/work_managers/zeromq/core.py +1 -5
  60. westpa/work_managers/zeromq/node.py +0 -1
  61. westpa/work_managers/zeromq/work_manager.py +1 -2
  62. westpa/work_managers/zeromq/worker.py +0 -1
  63. {westpa-2022.5.dist-info → westpa-2022.7.dist-info}/METADATA +9 -7
  64. {westpa-2022.5.dist-info → westpa-2022.7.dist-info}/RECORD +69 -69
  65. {westpa-2022.5.dist-info → westpa-2022.7.dist-info}/WHEEL +1 -1
  66. {westpa-2022.5.dist-info → westpa-2022.7.dist-info}/AUTHORS +0 -0
  67. {westpa-2022.5.dist-info → westpa-2022.7.dist-info}/LICENSE +0 -0
  68. {westpa-2022.5.dist-info → westpa-2022.7.dist-info}/entry_points.txt +0 -0
  69. {westpa-2022.5.dist-info → westpa-2022.7.dist-info}/top_level.txt +0 -0
westpa/__init__.py CHANGED
@@ -12,7 +12,3 @@ rc = _rc.WESTRC()
12
12
  __version__ = get_versions()["version"]
13
13
 
14
14
  del get_versions
15
-
16
- from . import _version
17
-
18
- __version__ = _version.get_versions()['version']
westpa/_version.py CHANGED
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2023-07-26T13:13:47-0400",
11
+ "date": "2024-04-02T11:29:16-0400",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "e022c31147cf74334878926977dfc28a6dbf3bfc",
15
- "version": "2022.05"
14
+ "full-revisionid": "d48640fc3fff59f2f8470d6e7170a73f72fff5c6",
15
+ "version": "2022.07"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
westpa/cli/core/w_fork.py CHANGED
@@ -101,7 +101,7 @@ def entry_point():
101
101
  state_map = np.empty((n_segments,), dtype=state_map_dtype)
102
102
  state_map['old_n_iter'] = n_iter
103
103
 
104
- for (iseg, (index_row, pcoord)) in enumerate(zip(old_index, old_final_pcoords)):
104
+ for iseg, (index_row, pcoord) in enumerate(zip(old_index, old_final_pcoords)):
105
105
  istate = istates[iseg]
106
106
  istate.iter_created = 0
107
107
  istate.iter_used = 1
westpa/cli/core/w_init.py CHANGED
@@ -18,7 +18,6 @@ EPS = np.finfo(np.float64).eps
18
18
 
19
19
 
20
20
  def entry_point():
21
-
22
21
  parser = argparse.ArgumentParser(
23
22
  'w_init',
24
23
  description='''\
westpa/cli/core/w_run.py CHANGED
@@ -30,7 +30,6 @@ def entry_point():
30
30
 
31
31
 
32
32
  def run_simulation():
33
-
34
33
  work_manager = westpa.rc.work_manager = make_work_manager()
35
34
 
36
35
  # Load the sim manager and other drivers
@@ -102,7 +102,6 @@ def entry_point():
102
102
 
103
103
  # TODO: This would benefit from a refactor to set default args to None, and replace some of those "if <argument>" clauses
104
104
  def initialize(mode, bstates, _bstate_file, tstates, _tstate_file):
105
-
106
105
  work_manager = make_work_manager()
107
106
 
108
107
  system = westpa.rc.get_system_driver()
@@ -116,7 +115,6 @@ def initialize(mode, bstates, _bstate_file, tstates, _tstate_file):
116
115
 
117
116
  assert mode in ('show', 'replace', 'append')
118
117
  if mode == 'show':
119
-
120
118
  basis_states = data_manager.get_basis_states(n_iter)
121
119
  if basis_states:
122
120
  bstate_file = sys.stdout if not _bstate_file else open(_bstate_file, 'wt')
westpa/cli/core/w_succ.py CHANGED
@@ -57,7 +57,7 @@ class WSucc(CommonOutputMixin, WESTDataReaderMixin, WESTAnalysisTool):
57
57
  # The above HDF5 selection always returns a vector; we want a 2-d array
58
58
  final_pcoords.shape = (len(recycled_seg_ids), pcoord_ndim)
59
59
 
60
- for (ipc, seg_id) in enumerate(recycled_seg_ids):
60
+ for ipc, seg_id in enumerate(recycled_seg_ids):
61
61
  self.output_file.write('%8d %8d %20.14g' % (n_iter, seg_id, seg_index[seg_id]['weight']))
62
62
  fields = ['']
63
63
  for field in final_pcoords[ipc]:
@@ -33,7 +33,6 @@ def parse_pcoord_value(pc_str):
33
33
  def _assign_label_pop(
34
34
  n_iter, lb, ub, mapper, nstates, state_map, last_labels, parent_id_dsspec, weight_dsspec, pcoord_dsspec, subsample
35
35
  ):
36
-
37
36
  nbins = len(state_map) - 1
38
37
  parent_ids = parent_id_dsspec.get_iter_data(n_iter, index_exp[lb:ub])
39
38
  weights = weight_dsspec.get_iter_data(n_iter, index_exp[lb:ub])
@@ -68,7 +68,6 @@ modify the binning for the current iteration of a WEST simulation.
68
68
  rebin_parser.set_defaults(func=self.cmd_rebin)
69
69
 
70
70
  def process_args(self, args):
71
-
72
71
  self.data_reader.process_args(args)
73
72
  self.data_reader.open(mode='r+')
74
73
  self.n_iter = getattr(args, 'n_iter', None) or self.data_reader.current_iteration
@@ -64,7 +64,7 @@ significant analysis tasks).
64
64
  + '\n'
65
65
  )
66
66
  pcoord_lines = ' pcoord[0] = {init_pcoord}\n pcoord[-1] = {final_pcoord}' + '\n'
67
- for (_seg_id, segment) in enumerate(segments):
67
+ for _seg_id, segment in enumerate(segments):
68
68
  parents_str = '[' + ', '.join(map(str, sorted(segment.wtg_parent_ids))) + ']'
69
69
  init_pcoord_str = '[' + ', '.join('{pcval:<12.6g}'.format(pcval=float(pce)) for pce in segment.pcoord[0]) + ']'
70
70
  final_pcoord_str = '[' + ', '.join('{pcval:<12.6g}'.format(pcval=float(pce)) for pce in segment.pcoord[-1]) + ']'
@@ -68,7 +68,6 @@ def _remote_min_max(ndim, dset_dtype, n_iter, dsspec):
68
68
 
69
69
 
70
70
  def _remote_bin_iter(iiter, n_iter, dsspec, wt_dsspec, initpoint, binbounds, ignore_out_of_range):
71
-
72
71
  iter_hist_shape = tuple(len(bounds) - 1 for bounds in binbounds)
73
72
  iter_hist = np.zeros(iter_hist_shape, dtype=np.float64)
74
73
 
@@ -220,7 +219,6 @@ Command-line options
220
219
  self.compress_output = False
221
220
 
222
221
  def add_args(self, parser):
223
-
224
222
  parser.add_argument(
225
223
  '-b',
226
224
  '--bins',
@@ -300,7 +298,6 @@ Command-line options
300
298
  self.compress_output = args.compress or False
301
299
 
302
300
  def go(self):
303
-
304
301
  pi = self.progress.indicator
305
302
  pi.operation = 'Initializing'
306
303
  with pi:
@@ -334,7 +331,6 @@ Command-line options
334
331
 
335
332
  @staticmethod
336
333
  def parse_binspec(binspec):
337
-
338
334
  namespace = {'numpy': np, 'np': np, 'inf': float('inf')}
339
335
 
340
336
  try:
westpa/cli/tools/w_ipa.py CHANGED
@@ -641,7 +641,6 @@ class WIPI(WESTParallelTool):
641
641
  return self._future
642
642
 
643
643
  class Future(WIPIDataset):
644
-
645
644
  # This isn't a real fancy one.
646
645
  def __getitem__(self, value):
647
646
  if isinstance(value, str):
@@ -156,16 +156,9 @@ Command-line options
156
156
  # Sometimes, we're smaller or larger by one. Hm.
157
157
  try:
158
158
  self.total_walkers[:] += west['summary'][:-1]['n_particles']
159
- except (ValueError):
159
+ except ValueError:
160
160
  self.total_walkers[:] += west['summary'][:-1]['n_particles'][: len(self.total_walkers)]
161
161
 
162
- class Segment:
163
- def __init__(self, weight=0, iteration=0, simid=0, recycled_in=0):
164
- self.weight = weight
165
- self.iteration = iteration
166
- self.simid = simid
167
- self.recycled_in = recycled_in
168
-
169
162
  def go(self):
170
163
  pi = self.progress.indicator
171
164
  self.istates = True # Assume serendipitously istates is same between runs...
@@ -174,7 +167,11 @@ Command-line options
174
167
  self.open_files()
175
168
  self.total_number_of_walkers()
176
169
  if self.auxall is True:
177
- self.aux = list(self.westH5[1]['iterations/iter_00000001/auxdata'].keys())
170
+ try:
171
+ self.aux = list(self.westH5[1]['iterations/iter_00000001/auxdata'].keys())
172
+ except KeyError:
173
+ self.aux = None
174
+ log.warning('No auxdata. Proceeding forward without merging auxdata.')
178
175
  # Create a giant WEST.h5 file, separating the individual walkers, and renormalizing the weights.
179
176
  # It should then be compatible with existing toolsets.
180
177
  # Isn't really going to start with auxdata, but we'll add it in.
@@ -240,7 +237,7 @@ Command-line options
240
237
  self.futr_iter[i] = []
241
238
  self.past_rm[i] = []
242
239
  self.futr_rm[i] = []
243
- print(pi.new_operation('Recreating...', self.niters))
240
+ pi.new_operation('Recreating...', self.niters)
244
241
  # tracker = SummaryTracker()
245
242
  # self.output_file.close()
246
243
 
@@ -262,12 +259,20 @@ Command-line options
262
259
  if addition.dtype != istate_dtype:
263
260
  addition = create_idtype_array(addition)
264
261
  final_istate_index = np.append(final_istate_index, addition)
265
- final_istate_pcoord = np.append(final_istate_pcoord, west['ibstates/0/istate_pcoord'][:])
262
+ final_istate_pcoord = np.append(final_istate_pcoord, west['ibstates/0/istate_pcoord'][:], axis=0)
266
263
 
267
264
  # Saving them into self.output_file
268
265
  self.output_file['ibstates/0'].create_dataset('istate_index', data=final_istate_index, dtype=istate_dtype)
269
266
  self.output_file['ibstates/0'].create_dataset('istate_pcoord', data=final_istate_pcoord)
270
267
 
268
+ # Remaking the ibstates index link
269
+ master_index_row = self.output_file['ibstates/index'][0]
270
+ master_index_row['iter_valid'] = 0
271
+ master_index_row['n_bstates'] = len(self.output_file['ibstates/0/bstate_index'])
272
+ master_index_row['group_ref'] = self.output_file['ibstates/0'].ref
273
+
274
+ self.output_file['ibstates/index'][0] = master_index_row
275
+
271
276
  for iter in range(self.niters):
272
277
  # We have the following datasets in each iteration:
273
278
  # ibstates, which can now be combined with --ibstates
@@ -51,7 +51,6 @@ def _remote_min_max(ndim, dset_dtype, n_iter, dsspec):
51
51
 
52
52
 
53
53
  def _remote_bin_iter(iiter, n_iter, dsspec, wt_dsspec, initpoint, binbounds, ignore_out_of_range):
54
-
55
54
  iter_hist_shape = tuple(len(bounds) - 1 for bounds in binbounds)
56
55
  iter_hist = np.zeros(iter_hist_shape, dtype=np.float64)
57
56
 
westpa/cli/tools/w_red.py CHANGED
@@ -333,7 +333,6 @@ class RateCalculator:
333
333
  return self._dc
334
334
 
335
335
  def calc_rate(self, i_iter=None, red=False, **kwargs):
336
-
337
336
  if i_iter is None:
338
337
  i_iter = self.n_iters
339
338
 
westpa/core/_rc.py CHANGED
@@ -644,7 +644,6 @@ class WESTRC:
644
644
  return self.work_manager
645
645
 
646
646
  def clear_state(self):
647
-
648
647
  self._sim_manager = None
649
648
  self._system = None
650
649
  self._data_manager = None
@@ -40,7 +40,6 @@ the total number of bins within the mapper.
40
40
 
41
41
  '''
42
42
 
43
-
44
43
  import hashlib
45
44
  import logging
46
45
  import pickle
@@ -410,6 +409,9 @@ class RecursiveBinMapper(BinMapper):
410
409
 
411
410
  # we have updated our list of recursed bins, so set our own start index to trigger a recursive
412
411
  # reassignment of mappers' output values
412
+ # Note that we're reordering the recursion targets based on outer bin numbers (dict keys) first,
413
+ # so the order the mappers were added no longer matters...
414
+ self._recursion_targets = {k: self._recursion_targets[k] for k in sorted(self._recursion_targets)}
413
415
  self.start_index = self.start_index
414
416
 
415
417
  def assign(self, coords, mask=None, output=None):
@@ -429,7 +431,7 @@ class RecursiveBinMapper(BinMapper):
429
431
  # Which coordinates do we need to reassign, because they landed in
430
432
  # bins with embedded mappers?
431
433
  rmasks = {}
432
- for (rindex, mapper) in self._recursion_targets.items():
434
+ for rindex, mapper in self._recursion_targets.items():
433
435
  omask = output == rindex
434
436
  mmask |= omask
435
437
  rmasks[rindex] = omask
@@ -441,7 +443,7 @@ class RecursiveBinMapper(BinMapper):
441
443
  output_map(output, omap, mask & ~mmask)
442
444
 
443
445
  # do any recursive assignments necessary
444
- for (rindex, mapper) in self._recursion_targets.items():
446
+ for rindex, mapper in self._recursion_targets.items():
445
447
  mapper.assign(coords, mask & rmasks[rindex], output)
446
448
 
447
449
  return output
@@ -33,7 +33,7 @@ class BinlessDriver(WEDriver):
33
33
  final_binning = self.final_binning
34
34
  flux_matrix = self.flux_matrix
35
35
  transition_matrix = self.transition_matrix
36
- for (segment, iidx, fidx) in zip(segments, initial_assignments, final_assignments):
36
+ for segment, iidx, fidx in zip(segments, initial_assignments, final_assignments):
37
37
  initial_binning[iidx].add(segment)
38
38
  final_binning[fidx].add(segment)
39
39
  flux_matrix[iidx, fidx] += segment.weight
@@ -75,8 +75,31 @@ class BinlessSimManager(WESimManager):
75
75
  log.error('unknown future {!r} received from work manager'.format(future))
76
76
  raise AssertionError('untracked future {!r}'.format(future))
77
77
 
78
+ # Collectively assign all segments to their bins...
78
79
  self.we_driver.assign(self.segments.values())
79
- self.get_istate_futures()
80
+
81
+ # For cases where we need even more istates for recycled trajectories
82
+ # futures should be empty at this point.
83
+ istate_gen_futures = self.get_istate_futures()
84
+ futures.update(istate_gen_futures)
85
+
86
+ # Wait for istate_gen_futures and catch untracked futures.
87
+ while futures:
88
+ future = self.work_manager.wait_any(futures)
89
+ futures.remove(future)
90
+
91
+ if future in istate_gen_futures:
92
+ istate_gen_futures.remove(future)
93
+ _basis_state, initial_state = future.get_result()
94
+ log.debug('received newly-prepared initial state {!r}'.format(initial_state))
95
+ initial_state.istate_status = InitialState.ISTATE_STATUS_PREPARED
96
+ with self.data_manager.expiring_flushing_lock():
97
+ self.data_manager.update_initial_states([initial_state], n_iter=self.n_iter + 1)
98
+ self.we_driver.avail_initial_states[initial_state.state_id] = initial_state
99
+ else:
100
+ log.error('unknown future {!r} received from work manager'.format(future))
101
+ raise AssertionError('untracked future {!r}'.format(future))
102
+
80
103
  log.debug('done with propagation')
81
104
  self.save_bin_data()
82
105
  self.data_manager.flush_backing()
@@ -132,7 +155,7 @@ class BinlessSimManager(WESimManager):
132
155
  for iseg, segment in enumerate(segments.values()):
133
156
  initial_pcoords[iseg] = segment.pcoord[0]
134
157
  initial_assignments = self.system.bin_mapper.assign(initial_pcoords)
135
- for (segment, assignment) in zip(iter(segments.values()), initial_assignments):
158
+ for segment, assignment in zip(iter(segments.values()), initial_assignments):
136
159
  initial_binning[assignment].add(segment)
137
160
  self.report_bin_statistics(initial_binning, [], save_summary=True)
138
161
  del initial_pcoords, initial_binning
@@ -1,7 +1,9 @@
1
- import numpy as np
2
- from westpa.core.binning import FuncBinMapper
3
1
  import logging
2
+ import numpy as np
4
3
  import westpa
4
+ from westpa.core.binning import FuncBinMapper
5
+ from os.path import expandvars
6
+
5
7
 
6
8
  log = logging.getLogger(__name__)
7
9
 
@@ -19,6 +21,7 @@ def map_mab(coords, mask, output, *args, **kwargs):
19
21
  skip = kwargs.get("skip")
20
22
  nbins_per_dim = kwargs.get("nbins_per_dim")
21
23
  mab_log = kwargs.get("mab_log")
24
+ bin_log = kwargs.get("bin_log")
22
25
  ndim = len(nbins_per_dim)
23
26
 
24
27
  if not np.any(mask):
@@ -212,7 +215,6 @@ def map_mab(coords, mask, output, *args, **kwargs):
212
215
  # the following are for the "linear" portion
213
216
  if not special:
214
217
  for n in range(ndim):
215
-
216
218
  # if skipped, it's added to the same bin as the special walkers above
217
219
  if skip[n] != 0:
218
220
  holder = boundary_base + n
@@ -244,6 +246,18 @@ def map_mab(coords, mask, output, *args, **kwargs):
244
246
  # output is the main list that, for each segment, holds the bin assignment
245
247
  output[i] = holder
246
248
 
249
+ if bin_log and report:
250
+ if westpa.rc.sim_manager.n_iter:
251
+ with open(expandvars("$WEST_SIM_ROOT/binbounds.log"), 'a') as bb_file:
252
+ bb_file.write(f'{westpa.rc.sim_manager.n_iter}\n') # Iteration Number
253
+ for n in range(ndim):
254
+ bb_file.write(f'{np.linspace(minlist[n], maxlist[n], nbins_per_dim[n] + 1)}\t') # Write binbounds per dim
255
+ bb_file.write(f'\n{minlist} {maxlist}\n') # Min/Max pcoord
256
+ if bottleneck_base > boundary_base:
257
+ bb_file.write(f'{flipdifflist} {difflist}\n\n') # Bottlenecks
258
+ else:
259
+ bb_file.write('\n')
260
+
247
261
  return output
248
262
 
249
263
 
@@ -252,7 +266,7 @@ class MABBinMapper(FuncBinMapper):
252
266
  the progress coordinte. Extrema and bottleneck segments are assigned
253
267
  to their own bins.'''
254
268
 
255
- def __init__(self, nbins, direction=None, skip=None, bottleneck=True, pca=False, mab_log=False):
269
+ def __init__(self, nbins, direction=None, skip=None, bottleneck=True, pca=False, mab_log=False, bin_log=False):
256
270
  # Verifying parameters
257
271
  if nbins is None:
258
272
  raise ValueError("nbins_per_dim is missing")
@@ -262,15 +276,17 @@ class MABBinMapper(FuncBinMapper):
262
276
  direction = [0] * ndim
263
277
  elif len(direction) != ndim:
264
278
  direction = [0] * ndim
265
- log.warn("Direction list is not the correct dimensions, setting to defaults.")
279
+ log.warning("Direction list is not the correct dimensions, setting to defaults.")
266
280
 
267
281
  if skip is None:
268
282
  skip = [0] * ndim
269
283
  elif len(skip) != ndim:
270
284
  skip = [0] * ndim
271
- log.warn("Skip list is not the correct dimensions, setting to defaults.")
285
+ log.warning("Skip list is not the correct dimensions, setting to defaults.")
272
286
 
273
- kwargs = dict(nbins_per_dim=nbins, direction=direction, skip=skip, bottleneck=bottleneck, pca=pca, mab_log=mab_log)
287
+ kwargs = dict(
288
+ nbins_per_dim=nbins, direction=direction, skip=skip, bottleneck=bottleneck, pca=pca, mab_log=mab_log, bin_log=bin_log
289
+ )
274
290
  # the following is neccessary because functional bin mappers need to "reserve"
275
291
  # bins and tell the sim manager how many bins they will need to use, this is
276
292
  # determined by taking all direction/skipping info into account
@@ -33,7 +33,7 @@ class MABDriver(WEDriver):
33
33
  final_binning = self.final_binning
34
34
  flux_matrix = self.flux_matrix
35
35
  transition_matrix = self.transition_matrix
36
- for (segment, iidx, fidx) in zip(segments, initial_assignments, final_assignments):
36
+ for segment, iidx, fidx in zip(segments, initial_assignments, final_assignments):
37
37
  initial_binning[iidx].add(segment)
38
38
  final_binning[fidx].add(segment)
39
39
  flux_matrix[iidx, fidx] += segment.weight
@@ -75,8 +75,31 @@ class MABSimManager(WESimManager):
75
75
  log.error('unknown future {!r} received from work manager'.format(future))
76
76
  raise AssertionError('untracked future {!r}'.format(future))
77
77
 
78
+ # Collectively assign all segments to their bins...
78
79
  self.we_driver.assign(self.segments.values())
79
- self.get_istate_futures()
80
+
81
+ # For cases where we need even more istates for recycled trajectories
82
+ # futures should be empty at this point.
83
+ istate_gen_futures = self.get_istate_futures()
84
+ futures.update(istate_gen_futures)
85
+
86
+ # Wait for istate_gen_futures and catch untracked futures.
87
+ while futures:
88
+ future = self.work_manager.wait_any(futures)
89
+ futures.remove(future)
90
+
91
+ if future in istate_gen_futures:
92
+ istate_gen_futures.remove(future)
93
+ _basis_state, initial_state = future.get_result()
94
+ log.debug('received newly-prepared initial state {!r}'.format(initial_state))
95
+ initial_state.istate_status = InitialState.ISTATE_STATUS_PREPARED
96
+ with self.data_manager.expiring_flushing_lock():
97
+ self.data_manager.update_initial_states([initial_state], n_iter=self.n_iter + 1)
98
+ self.we_driver.avail_initial_states[initial_state.state_id] = initial_state
99
+ else:
100
+ log.error('unknown future {!r} received from work manager'.format(future))
101
+ raise AssertionError('untracked future {!r}'.format(future))
102
+
80
103
  log.debug('done with propagation')
81
104
  self.save_bin_data()
82
105
  self.data_manager.flush_backing()
@@ -135,7 +158,7 @@ class MABSimManager(WESimManager):
135
158
  # Assign this iteration's segments' initial points to bins and report on bin population
136
159
  initial_binning = self.system.bin_mapper.construct_bins()
137
160
  initial_assignments = self.system.bin_mapper.assign(pcoords_with_weights)
138
- for (segment, assignment) in zip(iter(segments.values()), initial_assignments):
161
+ for segment, assignment in zip(iter(segments.values()), initial_assignments):
139
162
  initial_binning[assignment].add(segment)
140
163
  self.report_bin_statistics(initial_binning, [], save_summary=True)
141
164
  del pcoords_with_weights, initial_binning
@@ -231,7 +231,7 @@ class WESTDataManager:
231
231
  def process_config(self):
232
232
  config = self.rc.config
233
233
 
234
- for (entry, type_) in [('iter_prec', int)]:
234
+ for entry, type_ in [('iter_prec', int)]:
235
235
  config.require_type_if_present(['west', 'data', entry], type_)
236
236
 
237
237
  self.we_h5filename = config.get_path(['west', 'data', 'west_data_file'], default=self.default_we_h5filename)
@@ -263,7 +263,6 @@ class WESTDataManager:
263
263
  raise ValueError('cannot override pcoord storage location')
264
264
 
265
265
  def __init__(self, rc=None):
266
-
267
266
  self.rc = rc or westpa.rc
268
267
 
269
268
  self.we_h5filename = self.default_we_h5filename
@@ -854,7 +853,7 @@ class WESTDataManager:
854
853
  pcoord = np.empty((n_particles, pcoord_len, pcoord_ndim), pcoord_dtype)
855
854
 
856
855
  total_parents = 0
857
- for (seg_id, segment) in enumerate(segments):
856
+ for seg_id, segment in enumerate(segments):
858
857
  if segment.seg_id is not None:
859
858
  assert segment.seg_id == seg_id
860
859
  else:
@@ -895,7 +894,7 @@ class WESTDataManager:
895
894
  wtgraph_ds = iter_group.create_dataset('wtgraph', (total_parents,), seg_id_dtype, compression='gzip', shuffle=True)
896
895
  parents = np.empty((total_parents,), seg_id_dtype)
897
896
 
898
- for (seg_id, segment) in enumerate(segments):
897
+ for seg_id, segment in enumerate(segments):
899
898
  offset = seg_index_table[seg_id]['wtg_offset']
900
899
  extent = seg_index_table[seg_id]['wtg_n_parents']
901
900
  parent_list = list(segment.wtg_parent_ids)
@@ -986,7 +985,7 @@ class WESTDataManager:
986
985
  # read summary data so that we have valud parent and weight transfer information
987
986
  si_dsid.read(si_msel, si_fsel, seg_index_entries)
988
987
 
989
- for (iseg, (segment, ientry)) in enumerate(zip(segments, seg_index_entries)):
988
+ for iseg, (segment, ientry) in enumerate(zip(segments, seg_index_entries)):
990
989
  ientry['status'] = segment.status
991
990
  ientry['endpoint_type'] = segment.endpoint_type or Segment.SEG_ENDPOINT_UNSET
992
991
  ientry['cputime'] = segment.cputime
@@ -1021,7 +1020,7 @@ class WESTDataManager:
1021
1020
 
1022
1021
  # Then we iterate over data sets and store data
1023
1022
  if dsets:
1024
- for (dsname, (shape, dtype)) in dsets.items():
1023
+ for dsname, (shape, dtype) in dsets.items():
1025
1024
  # dset = self._require_aux_dataset(iter_group, dsname, n_total_segments, shape, dtype)
1026
1025
  try:
1027
1026
  dsopts = self.dataset_options[dsname]
westpa/core/h5io.py CHANGED
@@ -101,7 +101,6 @@ def tostr(b):
101
101
 
102
102
 
103
103
  def is_within_directory(directory, target):
104
-
105
104
  abs_directory = os.path.abspath(directory)
106
105
  abs_target = os.path.abspath(target)
107
106
 
@@ -111,7 +110,6 @@ def is_within_directory(directory, target):
111
110
 
112
111
 
113
112
  def safe_extract(tar, path=".", members=None, *, numeric_owner=False):
114
-
115
113
  for member in tar.getmembers():
116
114
  member_path = os.path.join(path, member.name)
117
115
  if not is_within_directory(path, member_path):
@@ -220,7 +218,7 @@ def load_west(filename):
220
218
 
221
219
  raw_pcoord = iter_group['pcoord'][:]
222
220
  if raw_pcoord.ndim != 3:
223
- log.warn('pcoord is expected to be a 3-d ndarray instead of {}-d'.format(raw_pcoord.ndim))
221
+ log.warning('pcoord is expected to be a 3-d ndarray instead of {}-d'.format(raw_pcoord.ndim))
224
222
  continue
225
223
  # ignore the first frame of each segment
226
224
  if raw_pcoord.shape[1] == traj.n_frames + 1:
@@ -374,7 +372,6 @@ class WESTPAH5File(h5py.File):
374
372
  _this_fileformat_version = 8
375
373
 
376
374
  def __init__(self, *args, **kwargs):
377
-
378
375
  # These values are used for creating files or reading files where this
379
376
  # data is not stored. Otherwise, values stored as attributes on the root
380
377
  # group are used instead.
@@ -919,7 +916,6 @@ class MultiDSSpec(DSSpec):
919
916
  class IterBlockedDataset:
920
917
  @classmethod
921
918
  def empty_like(cls, blocked_dataset):
922
-
923
919
  source = blocked_dataset.data if blocked_dataset.data is not None else blocked_dataset.dataset
924
920
 
925
921
  newbds = cls(
@@ -10,7 +10,6 @@ def blocked_iter(blocksize, iterable, fillvalue=None):
10
10
 
11
11
  class WESTPropagator:
12
12
  def __init__(self, rc=None):
13
-
14
13
  # For maximum flexibility, the basis states and initial states valid
15
14
  # at the point in the simulation when the propgator is used must be
16
15
  # available in several routines, and it is inconvenient to pass them
@@ -91,7 +91,7 @@ def trajectory_loader(fieldname, coord_folder, segment, single_point):
91
91
  data = load_trajectory(coord_folder)
92
92
  segment.data['iterh5/trajectory'] = data
93
93
  except Exception as e:
94
- log.warning('could not read any data for {}: {}'.format(fieldname, str(e)))
94
+ log.warning('could not read any {} data for HDF5 Framework: {}'.format(fieldname, str(e)))
95
95
 
96
96
 
97
97
  def restart_loader(fieldname, restart_folder, segment, single_point):
@@ -105,7 +105,7 @@ def restart_loader(fieldname, restart_folder, segment, single_point):
105
105
 
106
106
  segment.data['iterh5/restart'] = d.getvalue() + b'\x01' # add tail protection
107
107
  except Exception as e:
108
- log.warning('could not read any data for {}: {}'.format(fieldname, str(e)))
108
+ log.warning('could not read any {} data for HDF5 Framework: {}'.format(fieldname, str(e)))
109
109
  finally:
110
110
  d.close()
111
111
 
@@ -123,7 +123,7 @@ def restart_writer(path, segment):
123
123
  safe_extract(t, path=path)
124
124
 
125
125
  except ValueError as e:
126
- log.warning('could not write restart data for {}: {}'.format(str(segment), str(e)))
126
+ log.warning('could not write HDF5 Framework restart data for {}: {}'.format(str(segment), str(e)))
127
127
  d = BytesIO()
128
128
  if segment.n_iter == 1:
129
129
  log.warning(
@@ -132,7 +132,7 @@ def restart_writer(path, segment):
132
132
  )
133
133
  )
134
134
  except Exception as e:
135
- log.warning('could not write restart data for {}: {}'.format(str(segment), str(e)))
135
+ log.warning('could not write HDF5 Framework restart data for {}: {}'.format(str(segment), str(e)))
136
136
  finally:
137
137
  d.close()
138
138
 
@@ -372,7 +372,7 @@ class ExecutablePropagator(WESTPropagator):
372
372
  return (rc, rusage)
373
373
 
374
374
  def exec_child_from_child_info(self, child_info, template_args, environ):
375
- for (key, value) in child_info.get('environ', {}).items():
375
+ for key, value in child_info.get('environ', {}).items():
376
376
  environ[key] = self.makepath(value)
377
377
  return self.exec_child(
378
378
  executable=self.makepath(child_info['executable'], template_args),
@@ -443,7 +443,6 @@ class ExecutablePropagator(WESTPropagator):
443
443
  initial_state = self.initial_states[segment.initial_state_id]
444
444
 
445
445
  if initial_state.istate_type == InitialState.ISTATE_TYPE_START:
446
-
447
446
  basis_state = BasisState(
448
447
  label=f"sstate_{initial_state.state_id}", pcoord=initial_state.pcoord, probability=0.0, auxref=""
449
448
  )
@@ -465,7 +464,6 @@ class ExecutablePropagator(WESTPropagator):
465
464
  environ[self.ENV_PARENT_DATA_REF] = environ[self.ENV_BSTATE_DATA_REF]
466
465
 
467
466
  elif initial_state.istate_type == InitialState.ISTATE_TYPE_START:
468
-
469
467
  # This points to the start-state PDB
470
468
  environ[self.ENV_PARENT_DATA_REF] = environ[self.ENV_BSTATE_DATA_REF] + '/' + initial_state.basis_auxref
471
469
  else: # initial_state.type == InitialState.ISTATE_TYPE_GENERATED
@@ -586,7 +584,7 @@ class ExecutablePropagator(WESTPropagator):
586
584
  try:
587
585
  loader(dataset, filename, segment, single_point=single_point)
588
586
  except Exception as e:
589
- log.error('could not read {} from {!r}: {!r}'.format(dataset, filename, e))
587
+ log.error('could not read {} for segment {} from {!r}: {!r}'.format(dataset, segment.seg_id, filename, e))
590
588
  segment.status = Segment.SEG_STATUS_FAILED
591
589
  break
592
590
  else:
@@ -597,9 +595,11 @@ class ExecutablePropagator(WESTPropagator):
597
595
  else:
598
596
  shutil.rmtree(filename)
599
597
  except Exception as e:
600
- log.warning('could not delete {} file {!r}: {!r}'.format(dataset, filename, e))
598
+ log.warning(
599
+ 'could not delete {} file {!r} for segment {}: {!r}'.format(dataset, filename, segment.seg_id, e)
600
+ )
601
601
  else:
602
- log.debug('deleted {} file {!r}'.format(dataset, filename))
602
+ log.debug('deleted {} file {!r} for segment {}'.format(dataset, filename, segment.seg_id))
603
603
 
604
604
  # Specific functions required by the WEST framework
605
605
  def get_pcoord(self, state):