pysages.methods.utils¶
Overview
Implements a Callback functor for methods. |
|
Logs the state of the collective variable and other parameters in Metadynamics. |
Details
Collection of helpful classes for methods.
This includes callback functor objects (callable classes).
- class pysages.methods.utils.SerialExecutor¶
Subclass of concurrent.futures.Executor used as the default task manager. It will execute all tasks in serial.
- submit(fn, *args, **kwargs)¶
Executes fn(*args, **kwargs) and returns a Future object wrapping the result.
- class pysages.methods.utils.ReplicasConfiguration(copies: int = 1, executor=<pysages.methods.utils.SerialExecutor object>)¶
Stores the information necessary to execute multiple simulation runs, including the number of copies of the system and the task manager.
- class pysages.methods.utils.HistogramLogger(period: int, offset: int = 0)¶
Implements a Callback functor for methods. Logs the state of the collective variable to generate histograms.
- Parameters:
period – Time steps between logging of collective variables.
offset – Time steps at the beginning of a run used for equilibration.
- get_histograms(**kwargs)¶
Helper function to generate histograms from the collected CV data. kwargs are passed on to numpy.histogramdd function.
- get_means()¶
Returns mean values of the histogram data.
- get_cov()¶
Returns covariance matrix of the histogram data.
- reset()¶
Reset internal state.
- class pysages.methods.utils.MetaDLogger(hills_file, log_period)¶
Logs the state of the collective variable and other parameters in Metadynamics.
- Parameters:
hills_file – Name of the output hills log file.
log_period – Time steps between logging of collective variables and Metadynamics parameters.
- save_hills(xi, sigma, height)¶
Append the centers, standard deviations and heights to log file.
- pysages.methods.utils.listify(arg, replicas, name, dtype)¶
Returns a list of with length replicas of arg if arg is not a list, or arg if it is already a list of length replicas.
- pysages.methods.utils.numpyfy_vals(dictionary: dict, numpy_only: bool = False)¶
Iterate all keys of the dictionary and convert every possible value into a numpy array. We recommend to pickle final analyzed results are numpyfying with numpy_only=True to avoid pickling issues.
Strings and numpy arrays, that would result in dtype == object are not converted.
- Parameters:
dictionary (dict) – Input dictionary, which keys are attempted to be converted to numpy arrays.
numpy_only (bool) – If true, any not simple numpy array object is excluded from the results.
- Returns:
dict
- Return type:
The same dictionary, but keys are preferably numpy arrays.