westpa 2022.4__cp38-cp38-macosx_10_9_x86_64.whl → 2022.6__cp38-cp38-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 (65) hide show
  1. westpa/_version.py +4 -4
  2. westpa/cli/core/w_fork.py +1 -1
  3. westpa/cli/core/w_init.py +0 -1
  4. westpa/cli/core/w_run.py +0 -1
  5. westpa/cli/core/w_states.py +0 -2
  6. westpa/cli/core/w_succ.py +1 -1
  7. westpa/cli/core/w_truncate.py +11 -0
  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 +20 -3
  14. westpa/cli/tools/w_pdist.py +0 -1
  15. westpa/cli/tools/w_red.py +0 -1
  16. westpa/core/_rc.py +31 -26
  17. westpa/core/binning/_assign.cpython-38-darwin.so +0 -0
  18. westpa/core/binning/assign.py +2 -2
  19. westpa/core/binning/binless_driver.py +1 -1
  20. westpa/core/binning/binless_manager.py +25 -2
  21. westpa/core/binning/mab.py +26 -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 +12 -12
  25. westpa/core/h5io.py +1 -5
  26. westpa/core/kinetics/_kinetics.cpython-38-darwin.so +0 -0
  27. westpa/core/propagators/__init__.py +0 -1
  28. westpa/core/propagators/executable.py +2 -4
  29. westpa/core/reweight/_reweight.cpython-38-darwin.so +0 -0
  30. westpa/core/sim_manager.py +3 -4
  31. westpa/core/trajectory.py +9 -1
  32. westpa/core/we_driver.py +8 -8
  33. westpa/fasthist/_fasthist.cpython-38-darwin.so +0 -0
  34. westpa/mclib/_mclib.cpython-38-darwin.so +0 -0
  35. westpa/oldtools/aframe/binning.py +2 -2
  36. westpa/oldtools/aframe/data_reader.py +3 -4
  37. westpa/oldtools/aframe/kinetics.py +0 -1
  38. westpa/oldtools/aframe/trajwalker.py +1 -1
  39. westpa/oldtools/aframe/transitions.py +1 -3
  40. westpa/oldtools/cmds/w_ttimes.py +2 -4
  41. westpa/tools/binning.py +1 -4
  42. westpa/tools/kinetics_tool.py +0 -3
  43. westpa/tools/selected_segs.py +0 -1
  44. westpa/trajtree/_trajtree.cpython-38-darwin.so +0 -0
  45. westpa/trajtree/trajtree.py +0 -2
  46. westpa/westext/adaptvoronoi/adaptVor_driver.py +0 -2
  47. westpa/westext/hamsm_restarting/example_overrides.py +0 -1
  48. westpa/westext/hamsm_restarting/restart_driver.py +1 -18
  49. westpa/westext/stringmethod/string_driver.py +0 -1
  50. westpa/westext/stringmethod/string_method.py +0 -2
  51. westpa/westext/weed/weed_driver.py +2 -2
  52. westpa/westext/wess/ProbAdjust.py +0 -1
  53. westpa/westext/wess/wess_driver.py +2 -2
  54. westpa/work_managers/environment.py +0 -1
  55. westpa/work_managers/mpi.py +0 -7
  56. westpa/work_managers/zeromq/core.py +1 -5
  57. westpa/work_managers/zeromq/work_manager.py +1 -2
  58. westpa/work_managers/zeromq/worker.py +0 -1
  59. {westpa-2022.4.dist-info → westpa-2022.6.dist-info}/METADATA +19 -20
  60. {westpa-2022.4.dist-info → westpa-2022.6.dist-info}/RECORD +65 -65
  61. {westpa-2022.4.dist-info → westpa-2022.6.dist-info}/WHEEL +1 -1
  62. {westpa-2022.4.dist-info → westpa-2022.6.dist-info}/AUTHORS +0 -0
  63. {westpa-2022.4.dist-info → westpa-2022.6.dist-info}/LICENSE +0 -0
  64. {westpa-2022.4.dist-info → westpa-2022.6.dist-info}/entry_points.txt +0 -0
  65. {westpa-2022.4.dist-info → westpa-2022.6.dist-info}/top_level.txt +0 -0
westpa/_version.py CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # This file was generated by 'versioneer.py' (0.28) from
2
+ # This file was generated by 'versioneer.py' (0.29) from
3
3
  # revision-control system data, or from the parent directory name of an
4
4
  # unpacked source archive. Distribution tarballs contain a pre-generated copy
5
5
  # of this file.
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2023-02-01T14:01:18-0500",
11
+ "date": "2023-10-20T12:52:31-0400",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "c5ee2fcdb8b82ee3cbfd2894065a375157a6ba75",
15
- "version": "2022.04"
14
+ "full-revisionid": "ef5fbd3e0aeb4d08160fc56ee39cca6ba75e3217",
15
+ "version": "2022.06"
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]:
@@ -23,10 +23,21 @@ def entry_point():
23
23
  )
24
24
 
25
25
  westpa.rc.add_args(parser)
26
+ parser.add_argument(
27
+ '-W',
28
+ '--west-data',
29
+ dest='we_h5filename',
30
+ metavar='WEST_H5FILE',
31
+ help='''Take WEST data from WEST_H5FILE (default: read from the HDF5 file specified in west.cfg).''',
32
+ )
26
33
  parser.add_argument('-n', '--iter', dest='n_iter', type=int, help='Truncate this iteration and those following.')
34
+
27
35
  args = parser.parse_args()
28
36
  westpa.rc.process_args(args, config_required=False)
29
37
  dm = westpa.rc.get_data_manager()
38
+ if args.we_h5filename:
39
+ dm.we_h5filename = args.we_h5filename
40
+
30
41
  dm.open_backing()
31
42
  # max_iter = dm.current_iteration
32
43
  n_iter = args.n_iter if args.n_iter > 0 else dm.current_iteration
@@ -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):
@@ -74,11 +74,23 @@ def get_bin_mapper(we_h5file, hashval):
74
74
  raise KeyError('hash {} not found'.format(hashval))
75
75
 
76
76
 
77
+ def create_idtype_array(input_array):
78
+ '''Return a new array with the new istate_dtype while preserving old data.'''
79
+ new_array = np.zeros(input_array.shape, dtype=istate_dtype)
80
+ for j in input_array.dtype.names:
81
+ new_array[j] = input_array[j].copy()
82
+
83
+ # Need to turn 'basis_auxref' to empty bytestrings...
84
+ new_array['basis_auxref'] = b''
85
+
86
+ return new_array
87
+
88
+
77
89
  class WMultiWest(WESTMultiTool):
78
90
  prog = 'w_multi_west'
79
91
  description = '''\
80
92
  Tool designed to combine multiple WESTPA simulations while accounting for
81
- reweighting. Test code thus far.
93
+ reweighting.
82
94
  -----------------------------------------------------------------------------
83
95
  Command-line options
84
96
  -----------------------------------------------------------------------------
@@ -144,7 +156,7 @@ Command-line options
144
156
  # Sometimes, we're smaller or larger by one. Hm.
145
157
  try:
146
158
  self.total_walkers[:] += west['summary'][:-1]['n_particles']
147
- except (ValueError):
159
+ except ValueError:
148
160
  self.total_walkers[:] += west['summary'][:-1]['n_particles'][: len(self.total_walkers)]
149
161
 
150
162
  class Segment:
@@ -243,8 +255,13 @@ Command-line options
243
255
  if ifile == 0:
244
256
  final_istate_index = west['ibstates/0/istate_index']
245
257
  final_istate_pcoord = west['ibstates/0/istate_pcoord']
258
+ if final_istate_index.dtype != istate_dtype:
259
+ final_istate_index = create_idtype_array(final_istate_index)
246
260
  else:
247
- final_istate_index = np.append(final_istate_index, west['ibstates/0/istate_index'][:])
261
+ addition = west['ibstates/0/istate_index'][:]
262
+ if addition.dtype != istate_dtype:
263
+ addition = create_idtype_array(addition)
264
+ final_istate_index = np.append(final_istate_index, addition)
248
265
  final_istate_pcoord = np.append(final_istate_pcoord, west['ibstates/0/istate_pcoord'][:])
249
266
 
250
267
  # Saving them into self.output_file
@@ -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
@@ -14,7 +14,6 @@ import westpa
14
14
  import westpa.core.data_manager
15
15
  from westpa.core.binning.assign import BinMapper
16
16
  from westpa.core.binning import RectilinearBinMapper, RecursiveBinMapper, MABBinMapper, BinlessMapper
17
- from westpa.core.extloader import get_object
18
17
  from .yamlcfg import YAMLConfig
19
18
  from .yamlcfg import YAMLSystem
20
19
  from . import extloader
@@ -31,7 +30,7 @@ def bins_from_yaml_dict(bin_dict):
31
30
  mapper_type = getattr(sys.modules['westpa.core.binning'], typename)
32
31
  except AttributeError:
33
32
  try:
34
- mapper_type = get_object(typename)
33
+ mapper_type = extloader.get_object(typename)
35
34
  except AttributeError:
36
35
  raise KeyError('unknown bin mapper type {!r}'.format(typename))
37
36
 
@@ -161,7 +160,10 @@ class WESTRC:
161
160
  self.rcfile = os.environ.get(self.ENV_RUNTIME_CONFIG) or self.RC_DEFAULT_FILENAME
162
161
 
163
162
  self.config = YAMLConfig()
164
- self.process_name = os.path.splitext(os.path.basename(sys.argv[0]))[0]
163
+ try:
164
+ self.process_name = os.path.splitext(os.path.basename(sys.argv[0]))[0]
165
+ except (TypeError, IndexError):
166
+ self.process_name = "unknown"
165
167
 
166
168
  # Crucial simulation and analysis drivers
167
169
  self._system = None
@@ -340,21 +342,23 @@ class WESTRC:
340
342
 
341
343
  def new_sim_manager(self):
342
344
  drivername = self.config.get(['west', 'drivers', 'sim_manager'], 'default')
343
- use_mab = self.detect_mab_mapper()
344
- use_binless = self.detect_binless_mapper()
345
345
 
346
- if use_mab:
347
- from .binning.mab_manager import MABSimManager
346
+ if drivername.lower() == 'default':
347
+ use_mab = self.detect_mab_mapper()
348
+ use_binless = self.detect_binless_mapper()
349
+
350
+ if use_mab:
351
+ from .binning.mab_manager import MABSimManager
348
352
 
349
- sim_manager = MABSimManager(rc=self)
350
- elif use_binless:
351
- from .binning.binless_manager import BinlessSimManager
353
+ sim_manager = MABSimManager(rc=self)
354
+ elif use_binless:
355
+ from .binning.binless_manager import BinlessSimManager
352
356
 
353
- sim_manager = BinlessSimManager(rc=self)
354
- elif drivername.lower() == 'default':
355
- from .sim_manager import WESimManager
357
+ sim_manager = BinlessSimManager(rc=self)
358
+ else:
359
+ from .sim_manager import WESimManager
356
360
 
357
- sim_manager = WESimManager(rc=self)
361
+ sim_manager = WESimManager(rc=self)
358
362
  else:
359
363
  sim_manager = extloader.get_object(drivername)(rc=self)
360
364
 
@@ -386,23 +390,25 @@ class WESTRC:
386
390
  import westpa
387
391
 
388
392
  drivername = self.config.get(['west', 'drivers', 'we_driver'], 'default')
389
- use_mab = self.detect_mab_mapper()
390
- use_binless = self.detect_binless_mapper()
391
393
 
392
- if use_mab:
393
- from .binning.mab_driver import MABDriver
394
+ if drivername.lower() == 'default':
395
+ use_mab = self.detect_mab_mapper()
396
+ use_binless = self.detect_binless_mapper()
397
+ if use_mab:
398
+ from .binning.mab_driver import MABDriver
394
399
 
395
- we_driver = MABDriver()
396
- elif use_binless:
397
- from .binning.binless_driver import BinlessDriver
400
+ we_driver = MABDriver()
401
+ elif use_binless:
402
+ from .binning.binless_driver import BinlessDriver
398
403
 
399
- we_driver = BinlessDriver()
400
- elif drivername.lower() == 'default':
401
- from .we_driver import WEDriver
404
+ we_driver = BinlessDriver()
405
+ else:
406
+ from .we_driver import WEDriver
402
407
 
403
- we_driver = WEDriver()
408
+ we_driver = WEDriver()
404
409
  else:
405
410
  we_driver = extloader.get_object(drivername)(rc=self)
411
+
406
412
  log.debug('loaded WE algorithm driver: {!r}'.format(we_driver))
407
413
 
408
414
  subgroup_function = self.config.get(['west', 'drivers', 'subgroup_function'], 'default')
@@ -638,7 +644,6 @@ class WESTRC:
638
644
  return self.work_manager
639
645
 
640
646
  def clear_state(self):
641
-
642
647
  self._sim_manager = None
643
648
  self._system = None
644
649
  self._data_manager = None
@@ -429,7 +429,7 @@ class RecursiveBinMapper(BinMapper):
429
429
  # Which coordinates do we need to reassign, because they landed in
430
430
  # bins with embedded mappers?
431
431
  rmasks = {}
432
- for (rindex, mapper) in self._recursion_targets.items():
432
+ for rindex, mapper in self._recursion_targets.items():
433
433
  omask = output == rindex
434
434
  mmask |= omask
435
435
  rmasks[rindex] = omask
@@ -441,7 +441,7 @@ class RecursiveBinMapper(BinMapper):
441
441
  output_map(output, omap, mask & ~mmask)
442
442
 
443
443
  # do any recursive assignments necessary
444
- for (rindex, mapper) in self._recursion_targets.items():
444
+ for rindex, mapper in self._recursion_targets.items():
445
445
  mapper.assign(coords, mask & rmasks[rindex], output)
446
446
 
447
447
  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,11 +21,15 @@ 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):
25
28
  return output
26
29
 
30
+ if skip is None:
31
+ skip = [0] * ndim
32
+
27
33
  allcoords = np.copy(coords)
28
34
  allmask = np.copy(mask)
29
35
 
@@ -209,7 +215,6 @@ def map_mab(coords, mask, output, *args, **kwargs):
209
215
  # the following are for the "linear" portion
210
216
  if not special:
211
217
  for n in range(ndim):
212
-
213
218
  # if skipped, it's added to the same bin as the special walkers above
214
219
  if skip[n] != 0:
215
220
  holder = boundary_base + n
@@ -241,6 +246,18 @@ def map_mab(coords, mask, output, *args, **kwargs):
241
246
  # output is the main list that, for each segment, holds the bin assignment
242
247
  output[i] = holder
243
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
+
244
261
  return output
245
262
 
246
263
 
@@ -249,7 +266,7 @@ class MABBinMapper(FuncBinMapper):
249
266
  the progress coordinte. Extrema and bottleneck segments are assigned
250
267
  to their own bins.'''
251
268
 
252
- 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):
253
270
  # Verifying parameters
254
271
  if nbins is None:
255
272
  raise ValueError("nbins_per_dim is missing")
@@ -259,15 +276,17 @@ class MABBinMapper(FuncBinMapper):
259
276
  direction = [0] * ndim
260
277
  elif len(direction) != ndim:
261
278
  direction = [0] * ndim
262
- 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.")
263
280
 
264
281
  if skip is None:
265
282
  skip = [0] * ndim
266
283
  elif len(skip) != ndim:
267
284
  skip = [0] * ndim
268
- 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.")
269
286
 
270
- 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
+ )
271
290
  # the following is neccessary because functional bin mappers need to "reserve"
272
291
  # bins and tell the sim manager how many bins they will need to use, this is
273
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
@@ -401,7 +400,7 @@ class WESTDataManager:
401
400
  be propagated. A complete set is required, even if nominally appending to an existing set,
402
401
  which simplifies the mapping of IDs to the table.'''
403
402
 
404
- system = westpa.rc.get_system_driver()
403
+ system = self.system
405
404
 
406
405
  n_iter = n_iter or self.current_iteration
407
406
 
@@ -519,7 +518,7 @@ class WESTDataManager:
519
518
  master_index_row['group_ref'] = state_group.ref
520
519
 
521
520
  if basis_states:
522
- system = westpa.rc.get_system_driver()
521
+ system = self.system
523
522
  state_table = np.empty((len(basis_states),), dtype=bstate_dtype)
524
523
  state_pcoords = np.empty((len(basis_states), system.pcoord_ndim), dtype=system.pcoord_dtype)
525
524
  for i, state in enumerate(basis_states):
@@ -616,7 +615,7 @@ class WESTDataManager:
616
615
  '''Create storage for ``n_states`` initial states associated with iteration ``n_iter``, and
617
616
  return bare InitialState objects with only state_id set.'''
618
617
 
619
- system = westpa.rc.get_system_driver()
618
+ system = self.system
620
619
  with self.lock:
621
620
  n_iter = n_iter or self.current_iteration
622
621
  ibstate_group = self.find_ibstate_group(n_iter)
@@ -659,7 +658,7 @@ class WESTDataManager:
659
658
  def update_initial_states(self, initial_states, n_iter=None):
660
659
  '''Save the given initial states in the HDF5 file'''
661
660
 
662
- system = westpa.rc.get_system_driver()
661
+ system = self.system
663
662
  initial_states = sorted(initial_states, key=attrgetter('state_id'))
664
663
  if not initial_states:
665
664
  return
@@ -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]
@@ -1128,7 +1127,8 @@ class WESTDataManager:
1128
1127
  ds = None
1129
1128
 
1130
1129
  if ds is not None:
1131
- for (seg_id, segment) in enumerate(segments):
1130
+ for segment in segments:
1131
+ seg_id = segment.seg_id
1132
1132
  segment.data[dsname] = ds[seg_id]
1133
1133
 
1134
1134
  return segments
@@ -1286,7 +1286,7 @@ class WESTDataManager:
1286
1286
  if not new_weights:
1287
1287
  return
1288
1288
 
1289
- system = westpa.rc.get_system_driver()
1289
+ system = self.system
1290
1290
 
1291
1291
  index = np.empty(len(new_weights), dtype=nw_index_dtype)
1292
1292
  prev_init_pcoords = system.new_pcoord_array(len(new_weights))