westpa.core.propagators package

westpa.core.propagators module

westpa.core.propagators.blocked_iter(blocksize, iterable, fillvalue=None)
class westpa.core.propagators.WESTPropagator(rc=None)

Bases: object

prepare_iteration(n_iter, segments)

Perform any necessary per-iteration preparation. This is run by the work manager.

finalize_iteration(n_iter, segments)

Perform any necessary post-iteration cleanup. This is run by the work manager.

get_pcoord(state)

Get the progress coordinate of the given basis or initial state.

gen_istate(basis_state, initial_state)

Generate a new initial state from the given basis state.

propagate(segments)

Propagate one or more segments, including any necessary per-iteration setup and teardown for this propagator.

clear_basis_initial_states()
update_basis_initial_states(basis_states, initial_states)

westpa.core.propagators.executable module

class westpa.core.propagators.executable.ExecutablePropagator(rc=None)

Bases: WESTPropagator

ENV_CURRENT_ITER = 'WEST_CURRENT_ITER'
ENV_CURRENT_SEG_ID = 'WEST_CURRENT_SEG_ID'
ENV_CURRENT_SEG_DATA_REF = 'WEST_CURRENT_SEG_DATA_REF'
ENV_CURRENT_SEG_INITPOINT = 'WEST_CURRENT_SEG_INITPOINT_TYPE'
ENV_PARENT_SEG_ID = 'WEST_PARENT_ID'
ENV_PARENT_DATA_REF = 'WEST_PARENT_DATA_REF'
ENV_BSTATE_ID = 'WEST_BSTATE_ID'
ENV_BSTATE_DATA_REF = 'WEST_BSTATE_DATA_REF'
ENV_ISTATE_ID = 'WEST_ISTATE_ID'
ENV_ISTATE_DATA_REF = 'WEST_ISTATE_DATA_REF'
ENV_STRUCT_DATA_REF = 'WEST_STRUCT_DATA_REF'
ENV_RAND16 = 'WEST_RAND16'
ENV_RAND32 = 'WEST_RAND32'
ENV_RAND64 = 'WEST_RAND64'
ENV_RAND128 = 'WEST_RAND128'
ENV_RANDFLOAT = 'WEST_RANDFLOAT'
static makepath(template, template_args=None, expanduser=True, expandvars=True, abspath=False, realpath=False)

Function for manipulating paths. Used in ExecutablePropagator as well.

random_val_env_vars()

Return a set of environment variables containing random seeds. These are returned as a dictionary, suitable for use in os.environ.update() or as the env argument to subprocess.Popen(). Every child process executed by exec_child() gets these.

exec_child(executable, environ=None, stdin=None, stdout=None, stderr=None, cwd=None)

Execute a child process with the environment set from the current environment, the values of self.addtl_child_environ, the random numbers returned by self.random_val_env_vars, and the given environ (applied in that order). stdin/stdout/stderr are optionally redirected.

This function waits on the child process to finish, then returns (rc, rusage), where rc is the child’s return code and rusage is the resource usage tuple from os.wait4()

exec_child_from_child_info(child_info, template_args, environ)
update_args_env_basis_state(template_args, environ, basis_state)
update_args_env_initial_state(template_args, environ, initial_state)
update_args_env_iter(template_args, environ, n_iter)
update_args_env_segment(template_args, environ, segment)
template_args_for_segment(segment)
exec_for_segment(child_info, segment, addtl_env=None)

Execute a child process with environment and template expansion from the given segment.

exec_for_iteration(child_info, n_iter, addtl_env=None)

Execute a child process with environment and template expansion from the given iteration number.

exec_for_basis_state(child_info, basis_state, addtl_env=None)

Execute a child process with environment and template expansion from the given basis state

exec_for_initial_state(child_info, initial_state, addtl_env=None)

Execute a child process with environment and template expansion from the given initial state.

prepare_file_system(segment, environ)
setup_dataset_return(segment=None, subset_keys=None)

Set up temporary files and environment variables that point to them for segment runners to return data. segment is the Segment object that the return data is associated with. subset_keys specifies the names of a subset of data to be returned.

retrieve_dataset_return(state, return_files, del_return_files, single_point)

Retrieve returned data from the temporary locations directed by the environment variables. state is a Segment, BasisState , or InitialState``object that the return data is associated with. ``return_files is a dict where the keys are the dataset names and the values are the paths to the temporarily files that contain the returned data. del_return_files is a dict where the keys are the names of datasets to be deleted (if the corresponding value is set to True) once the data is retrieved.

get_pcoord(state)

Get the progress coordinate of the given basis or initial state.

gen_istate(basis_state, initial_state)

Generate a new initial state from the given basis state.

prepare_iteration(n_iter, segments)

Perform any necessary per-iteration preparation. This is run by the work manager.

finalize_iteration(n_iter, segments)

Perform any necessary post-iteration cleanup. This is run by the work manager.

propagate(segments)

Propagate one or more segments, including any necessary per-iteration setup and teardown for this propagator.