atesa package

Submodules

atesa.batchsystem module

Interface for BatchSystem objects. New BatchSystems can be implemented by constructing a new class that inherits from BatchSystem and implements its abstract methods.

class atesa.batchsystem.AdaptPBS[source]

Bases: atesa.batchsystem.BatchSystem

Adapter class for PBS/Torque BatchSystem.

cancel_job(jobid, settings)[source]

Cancel the job given by jobid

Parameters:
  • jobid (str) – The jobid to cancel
  • settings (argparse.Namespace) – Settings namespace object
Returns:

output – Raw output string from batch system, if any

Return type:

str

get_status(jobid, settings)[source]

Query batch system for a status string for the given job.

Parameters:
  • jobid (str) – The jobid to query
  • settings (argparse.Namespace) – Settings namespace object
Returns:

status – A one-character status string. Options are: ‘R’unning, ‘Q’ueued, and ‘C’omplete/’C’anceled.

Return type:

str

get_submit_command()[source]

Return the appropriate terminal command for submitting a batch job, with ‘{file}’ where the file to submit should be indicated.

Parameters:None
Returns:output – Appropriate command including ‘{file}’ substring
Return type:str
class atesa.batchsystem.AdaptSlurm[source]

Bases: atesa.batchsystem.BatchSystem

Adapter class for Slurm BatchSystem.

cancel_job(jobid, settings)[source]

Cancel the job given by jobid

Parameters:
  • jobid (str) – The jobid to cancel
  • settings (argparse.Namespace) – Settings namespace object
Returns:

output – Raw output string from batch system, if any

Return type:

str

get_status(jobid, settings)[source]

Query batch system for a status string for the given job.

Parameters:
  • jobid (str) – The jobid to query
  • settings (argparse.Namespace) – Settings namespace object
Returns:

status – A one-character status string. Options are: ‘R’unning, ‘Q’ueued, and ‘C’omplete/’C’anceled.

Return type:

str

get_submit_command()[source]

Return the appropriate terminal command for submitting a batch job, with ‘{file}’ where the file to submit should be indicated.

Parameters:None
Returns:output – Appropriate command including ‘{file}’ substring
Return type:str
class atesa.batchsystem.BatchSystem[source]

Bases: abc.ABC

Abstract base class for HPC cluster batch systems.

Implements methods for all of the batch system-specific tasks that ATESA might need.

cancel_job(jobid, settings)[source]

Cancel the job given by jobid

Parameters:
  • jobid (str) – The jobid to cancel
  • settings (argparse.Namespace) – Settings namespace object
Returns:

output – Raw output string from batch system, if any

Return type:

str

get_status(jobid, settings)[source]

Query batch system for a status string for the given job.

Parameters:
  • jobid (str) – The jobid to query
  • settings (argparse.Namespace) – Settings namespace object
Returns:

status – A one-character status string. Options are: ‘R’unning, ‘Q’ueued, and ‘C’omplete/’C’anceled.

Return type:

str

get_submit_command()[source]

Return the appropriate terminal command for submitting a batch job, with ‘{file}’ where the file to submit should be indicated.

Parameters:None
Returns:output – Appropriate command including ‘{file}’ substring
Return type:str

atesa.boltzmann_weight module

Standalone script for converting equilibrium path sampling output files into free energy profiles via Boltzmann weighting.

atesa.boltzmann_weight.main(**kwargs)[source]

Process equilibrium path sampling output file kwargs[‘i’] to obtain free energy profile.

This is the main function of boltzmann_weight.py, which converts each EPS window into a stretch of the energy profile and stitches these stretches together into a continuous plot. Simply put, this function descretizes and reweights the data according to the Boltzmann weight (E = kT*ln(p), where p is the probability of a given state).

Parameters:kwargs (dict) – Dictionary object containing arguments passed in from command line in “if __name__ == ‘__main__’” section.
Returns:
Return type:None
atesa.boltzmann_weight.objective_function(slope, probs, RC_values, kT)[source]
atesa.boltzmann_weight.update_progress(progress, message='Progress')[source]

Print a dynamic progress bar to stdout.

Credit to Brian Khuu from stackoverflow, https://stackoverflow.com/questions/3160699/python-progress-bar

Parameters:
  • progress (float) – A number between 0 and 1 indicating the fractional completeness of the bar. A value under 0 represents a ‘halt’. A value at 1 or bigger represents 100%.
  • message (str) – The string to precede the progress bar (so as to indicate what is progressing)
Returns:

Return type:

None

atesa.configure module

configure.py Takes user input file and returns settings namespace object

atesa.configure.configure(input_file, user_working_directory='')[source]

Configure the settings namespace based on the config file.

Parameters:
  • input_file (str) – Name of the configuration file to read
  • user_working_directory (str) – User override for working directory (overrides value in input_file), ignored if set to ‘’
Returns:

settings – Settings namespace object

Return type:

argparse.Namespace

atesa.factory module

Factory script for obtaining the desired interfaces from the various interface scripts.

atesa.factory.batchsystem_factory(batchsystem_toolkit)[source]

Factory function for BatchSystems.

Parameters:batchsystem_toolkit (str) – Name of the BatchSystem to invoke
Returns:batchsystem – Instance of a BatchSystem adapter
Return type:BatchSystem
atesa.factory.jobtype_factory(jobtype_toolkit)[source]

Factory function for JobTypes.

Parameters:jobtype_toolkit (str) – Name of the JobType to invoke
Returns:jobtype – Instance of a JobType adapter
Return type:JobType
atesa.factory.mdengine_factory(mdengine_toolkit)[source]

Factory function for MDEngines.

Parameters:mdengine_toolkit (str) – Name of the MDEngine to invoke
Returns:mdengine – Instance of an MDEngine adapter
Return type:MDEngine
atesa.factory.taskmanager_factory(taskmanager_toolkit)[source]

Factory function for TaskManagers.

Parameters:taskmanager_toolkit (str) – Name of the TaskManager to invoke
Returns:taskmanager – Instance of a TaskManager adapter
Return type:TaskManager

atesa.information_error module

Script to evaluate and store information error in support of the information error convergence criterion in aimless shooting. Implemented as a separate script to facilitate multiprocessing.

atesa.information_error.main()[source]

Evaluate the information error during aimless shooting and output results to info_err.out.

Reads decorrelated aimless shooting output files from the present directory to evaluate the mean parametric variance based on the Godambe information error of the aimless shooting process.

This function depends on lmax.py for evaluations of the information error.

Parameters:None
Returns:
Return type:None

atesa.interpret module

This portion of the program is responsible for handling update of the results, checking global termination criteria, and implementing the calls to JobType methods to control the value of the thread.coordinates attribute for the next step.

atesa.interpret.interpret(thread, allthreads, running, settings)[source]

The main function of interpret.py. Makes calls to JobType methods to update results, check termination criteria, and update thread.coordinates

Parameters:
  • thread (Thread) – The Thread object on which to act
  • allthreads (list) – The list of all extant Thread objects
  • running (list) – The list of all currently running Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

termination – True if a global termination criterion has been met; False otherwise

Return type:

bool

atesa.jobtype module

Interface for JobType objects. New JobTypes can be implemented by constructing a new class that inherits from JobType and implements its abstract methods.

class atesa.jobtype.AimlessShooting[source]

Bases: atesa.jobtype.JobType

Adapter class for aimless shooting

algorithm(thread, allthreads, running, settings)[source]

Update thread attributes to prepare for next move.

This is where the core logical algorithm of a method is implemented. For example, in aimless shooting, it encodes the logic of when and how to select a new shooting move.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • running (list) – The list of all currently running Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

running – The list of all currently running Thread objects

Return type:

list

check_for_successful_step(thread, settings)[source]

Check whether a just-completed step was successful, as defined by whether the update_results and check_termination methods should be run.

This method returns True if the previous step appeared successful (distinct from ‘accepted’ as the term refers to for example aimless shooting) and False otherwise. The implementation of what to DO with an unsuccessful step should appear in the corresponding algorithm method, which should be run regardless of the output from this method.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

result – True if successful; False otherwise

Return type:

bool

check_termination(thread, allthreads, settings)[source]

Check termination criteria for the particular thread at hand as well as for the entire process.

These methods should update thread.status and thread.terminated in order to communicate the results of the check for the inidividual thread, and should return a boolean to communicate the results of the check for the entire run.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

termination – Global termination criterion for entire process (True means terminate)

Return type:

bool

cleanup(settings)[source]

Perform any last tasks between the end of the main loop and the program exiting.

Parameters:settings (argparse.Namespace) – Settings namespace object
Returns:
Return type:None
gatekeeper(thread, settings)[source]

Return boolean indicating whether job is ready for next interpretation step.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

status – If True, ready for next interpretation step; otherwise, False

Return type:

bool

get_batch_template(thread, type, settings)[source]

Return name of batch template file for the type of job indicated.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • type (str) – Name of the type of job desired, corresponding to the template file
  • settings (argparse.Namespace) – Settings namespace object
Returns:

name – Name of the batch file template requested

Return type:

str

get_initial_coordinates(settings)[source]

Obtain list of initial coordinate files and copy them to the working directory.

Parameters:settings (argparse.Namespace) – Settings namespace object
Returns:initial_coordinates – List of strings naming the applicable initial coordinate files that were copied to the working directory
Return type:list
get_inpcrd(thread)[source]

Return a list (possibly of length one) containing the names of the appropriate inpcrd files for the next step in the thread given by thread.

Parameters:thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
Returns:inpcrd – List of strings containing desired file names
Return type:list
get_input_file(thread, job_index, settings)[source]

Obtain appropriate input file for next job.

At its most simple, implementations of this method can simply return settings.path_to_input_files + ‘/’ + settings.job_type + ‘_’ + thread.current_type[job_index] + ‘_’ + settings.md_engine + ‘.in’

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • job_index (int) – 0-indexed integer identifying which job within thread.current_type to return the input file for
  • settings (argparse.Namespace) – Settings namespace object
Returns:

input_file – Name of the applicable input file

Return type:

str

get_next_step(thread, settings)[source]

Return name of next type of simulation to run in the itinerary of this job type.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

type – List containing strings for name(s) of next type(s) of simulation(s)

Return type:

list

update_history(thread, settings, **kwargs)[source]

Update or initialize the history namespace for this job type.

This namespace is used to store the full history of a threads coordinate and trajectory files, as well as their results if necessary.

If update_history is called with a kwargs containing {‘initialize’: True}, it simply prepares a blank history namespace and returns it. Otherwise, it adds the values of the desired keywords (which are desired depends on the implementation) to the corresponding history attributes in the index given by thread.suffix.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
  • kwargs (dict) – Dictionary of arguments that might be used to update the history object
Returns:

Return type:

None

update_results(thread, allthreads, settings)[source]

Update appropriate results file(s) as needed.

These methods are designed to be called at the end of every step in a job, even if writing to an output file is not necessary after that step; for that reason, they also encode the logic to decide when writing is needed.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

Return type:

None

verify(arg, argtype)[source]

Confirm or deny that the object arg is a valid object of type type.

Parameters:
  • arg (any_type) – Object to verify
  • argtype (str) – Name of type of object
Returns:

Return type:

None

class atesa.jobtype.CommittorAnalysis[source]

Bases: atesa.jobtype.JobType

Adapter class for committor analysis

algorithm(thread, allthreads, running, settings)[source]

Update thread attributes to prepare for next move.

This is where the core logical algorithm of a method is implemented. For example, in aimless shooting, it encodes the logic of when and how to select a new shooting move.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • running (list) – The list of all currently running Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

running – The list of all currently running Thread objects

Return type:

list

check_for_successful_step(thread, settings)[source]

Check whether a just-completed step was successful, as defined by whether the update_results and check_termination methods should be run.

This method returns True if the previous step appeared successful (distinct from ‘accepted’ as the term refers to for example aimless shooting) and False otherwise. The implementation of what to DO with an unsuccessful step should appear in the corresponding algorithm method, which should be run regardless of the output from this method.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

result – True if successful; False otherwise

Return type:

bool

check_termination(thread, allthreads, settings)[source]

Check termination criteria for the particular thread at hand as well as for the entire process.

These methods should update thread.status and thread.terminated in order to communicate the results of the check for the inidividual thread, and should return a boolean to communicate the results of the check for the entire run.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

termination – Global termination criterion for entire process (True means terminate)

Return type:

bool

cleanup(settings)[source]

Perform any last tasks between the end of the main loop and the program exiting.

Parameters:settings (argparse.Namespace) – Settings namespace object
Returns:
Return type:None
gatekeeper(thread, settings)[source]

Return boolean indicating whether job is ready for next interpretation step.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

status – If True, ready for next interpretation step; otherwise, False

Return type:

bool

get_batch_template(thread, type, settings)[source]

Return name of batch template file for the type of job indicated.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • type (str) – Name of the type of job desired, corresponding to the template file
  • settings (argparse.Namespace) – Settings namespace object
Returns:

name – Name of the batch file template requested

Return type:

str

get_initial_coordinates(settings)[source]

Obtain list of initial coordinate files and copy them to the working directory.

Parameters:settings (argparse.Namespace) – Settings namespace object
Returns:initial_coordinates – List of strings naming the applicable initial coordinate files that were copied to the working directory
Return type:list
get_inpcrd(thread)[source]

Return a list (possibly of length one) containing the names of the appropriate inpcrd files for the next step in the thread given by thread.

Parameters:thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
Returns:inpcrd – List of strings containing desired file names
Return type:list
get_input_file(thread, job_index, settings)[source]

Obtain appropriate input file for next job.

At its most simple, implementations of this method can simply return settings.path_to_input_files + ‘/’ + settings.job_type + ‘_’ + thread.current_type[job_index] + ‘_’ + settings.md_engine + ‘.in’

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • job_index (int) – 0-indexed integer identifying which job within thread.current_type to return the input file for
  • settings (argparse.Namespace) – Settings namespace object
Returns:

input_file – Name of the applicable input file

Return type:

str

get_next_step(thread, settings)[source]

Return name of next type of simulation to run in the itinerary of this job type.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

type – List containing strings for name(s) of next type(s) of simulation(s)

Return type:

list

update_history(thread, settings, **kwargs)[source]

Update or initialize the history namespace for this job type.

This namespace is used to store the full history of a threads coordinate and trajectory files, as well as their results if necessary.

If update_history is called with a kwargs containing {‘initialize’: True}, it simply prepares a blank history namespace and returns it. Otherwise, it adds the values of the desired keywords (which are desired depends on the implementation) to the corresponding history attributes in the index given by thread.suffix.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
  • kwargs (dict) – Dictionary of arguments that might be used to update the history object
Returns:

Return type:

None

update_results(thread, allthreads, settings)[source]

Update appropriate results file(s) as needed.

These methods are designed to be called at the end of every step in a job, even if writing to an output file is not necessary after that step; for that reason, they also encode the logic to decide when writing is needed.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

Return type:

None

verify(arg, argtype)[source]

Confirm or deny that the object arg is a valid object of type type.

Parameters:
  • arg (any_type) – Object to verify
  • argtype (str) – Name of type of object
Returns:

Return type:

None

class atesa.jobtype.EquilibriumPathSampling[source]

Bases: atesa.jobtype.JobType

Adapter class for equilibrium path sampling

algorithm(thread, allthreads, running, settings)[source]

Update thread attributes to prepare for next move.

This is where the core logical algorithm of a method is implemented. For example, in aimless shooting, it encodes the logic of when and how to select a new shooting move.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • running (list) – The list of all currently running Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

running – The list of all currently running Thread objects

Return type:

list

check_for_successful_step(thread, settings)[source]

Check whether a just-completed step was successful, as defined by whether the update_results and check_termination methods should be run.

This method returns True if the previous step appeared successful (distinct from ‘accepted’ as the term refers to for example aimless shooting) and False otherwise. The implementation of what to DO with an unsuccessful step should appear in the corresponding algorithm method, which should be run regardless of the output from this method.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

result – True if successful; False otherwise

Return type:

bool

check_termination(thread, allthreads, settings)[source]

Check termination criteria for the particular thread at hand as well as for the entire process.

These methods should update thread.status and thread.terminated in order to communicate the results of the check for the inidividual thread, and should return a boolean to communicate the results of the check for the entire run.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

termination – Global termination criterion for entire process (True means terminate)

Return type:

bool

cleanup(settings)[source]

Perform any last tasks between the end of the main loop and the program exiting.

Parameters:settings (argparse.Namespace) – Settings namespace object
Returns:
Return type:None
gatekeeper(thread, settings)[source]

Return boolean indicating whether job is ready for next interpretation step.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

status – If True, ready for next interpretation step; otherwise, False

Return type:

bool

get_batch_template(thread, type, settings)[source]

Return name of batch template file for the type of job indicated.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • type (str) – Name of the type of job desired, corresponding to the template file
  • settings (argparse.Namespace) – Settings namespace object
Returns:

name – Name of the batch file template requested

Return type:

str

get_initial_coordinates(settings)[source]

Obtain list of initial coordinate files and copy them to the working directory.

Parameters:settings (argparse.Namespace) – Settings namespace object
Returns:initial_coordinates – List of strings naming the applicable initial coordinate files that were copied to the working directory
Return type:list
get_inpcrd(thread)[source]

Return a list (possibly of length one) containing the names of the appropriate inpcrd files for the next step in the thread given by thread.

Parameters:thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
Returns:inpcrd – List of strings containing desired file names
Return type:list
get_input_file(thread, job_index, settings)[source]

Obtain appropriate input file for next job.

At its most simple, implementations of this method can simply return settings.path_to_input_files + ‘/’ + settings.job_type + ‘_’ + thread.current_type[job_index] + ‘_’ + settings.md_engine + ‘.in’

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • job_index (int) – 0-indexed integer identifying which job within thread.current_type to return the input file for
  • settings (argparse.Namespace) – Settings namespace object
Returns:

input_file – Name of the applicable input file

Return type:

str

get_next_step(thread, settings)[source]

Return name of next type of simulation to run in the itinerary of this job type.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

type – List containing strings for name(s) of next type(s) of simulation(s)

Return type:

list

update_history(thread, settings, **kwargs)[source]

Update or initialize the history namespace for this job type.

This namespace is used to store the full history of a threads coordinate and trajectory files, as well as their results if necessary.

If update_history is called with a kwargs containing {‘initialize’: True}, it simply prepares a blank history namespace and returns it. Otherwise, it adds the values of the desired keywords (which are desired depends on the implementation) to the corresponding history attributes in the index given by thread.suffix.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
  • kwargs (dict) – Dictionary of arguments that might be used to update the history object
Returns:

Return type:

None

update_results(thread, allthreads, settings)[source]

Update appropriate results file(s) as needed.

These methods are designed to be called at the end of every step in a job, even if writing to an output file is not necessary after that step; for that reason, they also encode the logic to decide when writing is needed.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

Return type:

None

verify(arg, argtype)[source]

Confirm or deny that the object arg is a valid object of type type.

Parameters:
  • arg (any_type) – Object to verify
  • argtype (str) – Name of type of object
Returns:

Return type:

None

class atesa.jobtype.FindTS[source]

Bases: atesa.jobtype.JobType

Adapter class for finding transition state (find TS)

algorithm(thread, allthreads, running, settings)[source]

Update thread attributes to prepare for next move.

This is where the core logical algorithm of a method is implemented. For example, in aimless shooting, it encodes the logic of when and how to select a new shooting move.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • running (list) – The list of all currently running Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

running – The list of all currently running Thread objects

Return type:

list

check_for_successful_step(thread, settings)[source]

Check whether a just-completed step was successful, as defined by whether the update_results and check_termination methods should be run.

This method returns True if the previous step appeared successful (distinct from ‘accepted’ as the term refers to for example aimless shooting) and False otherwise. The implementation of what to DO with an unsuccessful step should appear in the corresponding algorithm method, which should be run regardless of the output from this method.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

result – True if successful; False otherwise

Return type:

bool

check_termination(thread, allthreads, settings)[source]

Check termination criteria for the particular thread at hand as well as for the entire process.

These methods should update thread.status and thread.terminated in order to communicate the results of the check for the inidividual thread, and should return a boolean to communicate the results of the check for the entire run.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

termination – Global termination criterion for entire process (True means terminate)

Return type:

bool

cleanup(settings)[source]

Perform any last tasks between the end of the main loop and the program exiting.

Parameters:settings (argparse.Namespace) – Settings namespace object
Returns:
Return type:None
gatekeeper(thread, settings)[source]

Return boolean indicating whether job is ready for next interpretation step.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

status – If True, ready for next interpretation step; otherwise, False

Return type:

bool

get_batch_template(thread, type, settings)[source]

Return name of batch template file for the type of job indicated.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • type (str) – Name of the type of job desired, corresponding to the template file
  • settings (argparse.Namespace) – Settings namespace object
Returns:

name – Name of the batch file template requested

Return type:

str

get_initial_coordinates(settings)[source]

Obtain list of initial coordinate files and copy them to the working directory.

Parameters:settings (argparse.Namespace) – Settings namespace object
Returns:initial_coordinates – List of strings naming the applicable initial coordinate files that were copied to the working directory
Return type:list
get_inpcrd(thread)[source]

Return a list (possibly of length one) containing the names of the appropriate inpcrd files for the next step in the thread given by thread.

Parameters:thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
Returns:inpcrd – List of strings containing desired file names
Return type:list
get_input_file(thread, job_index, settings)[source]

Obtain appropriate input file for next job.

At its most simple, implementations of this method can simply return settings.path_to_input_files + ‘/’ + settings.job_type + ‘_’ + thread.current_type[job_index] + ‘_’ + settings.md_engine + ‘.in’

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • job_index (int) – 0-indexed integer identifying which job within thread.current_type to return the input file for
  • settings (argparse.Namespace) – Settings namespace object
Returns:

input_file – Name of the applicable input file

Return type:

str

get_next_step(thread, settings)[source]

Return name of next type of simulation to run in the itinerary of this job type.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

type – List containing strings for name(s) of next type(s) of simulation(s)

Return type:

list

update_history(thread, settings, **kwargs)[source]

Update or initialize the history namespace for this job type.

This namespace is used to store the full history of a threads coordinate and trajectory files, as well as their results if necessary.

If update_history is called with a kwargs containing {‘initialize’: True}, it simply prepares a blank history namespace and returns it. Otherwise, it adds the values of the desired keywords (which are desired depends on the implementation) to the corresponding history attributes in the index given by thread.suffix.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
  • kwargs (dict) – Dictionary of arguments that might be used to update the history object
Returns:

Return type:

None

update_results(thread, allthreads, settings)[source]

Update appropriate results file(s) as needed.

These methods are designed to be called at the end of every step in a job, even if writing to an output file is not necessary after that step; for that reason, they also encode the logic to decide when writing is needed.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

Return type:

None

verify(arg, argtype)[source]

Confirm or deny that the object arg is a valid object of type type.

Parameters:
  • arg (any_type) – Object to verify
  • argtype (str) – Name of type of object
Returns:

Return type:

None

class atesa.jobtype.JobType[source]

Bases: abc.ABC

Abstract base class for job types.

Implements methods for all of the job type-specific tasks that ATESA might need.

algorithm(thread, allthreads, running, settings)[source]

Update thread attributes to prepare for next move.

This is where the core logical algorithm of a method is implemented. For example, in aimless shooting, it encodes the logic of when and how to select a new shooting move.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • running (list) – The list of all currently running Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

running – The list of all currently running Thread objects

Return type:

list

check_for_successful_step(thread, settings)[source]

Check whether a just-completed step was successful, as defined by whether the update_results and check_termination methods should be run.

This method returns True if the previous step appeared successful (distinct from ‘accepted’ as the term refers to for example aimless shooting) and False otherwise. The implementation of what to DO with an unsuccessful step should appear in the corresponding algorithm method, which should be run regardless of the output from this method.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

result – True if successful; False otherwise

Return type:

bool

check_termination(thread, allthreads, settings)[source]

Check termination criteria for the particular thread at hand as well as for the entire process.

These methods should update thread.status and thread.terminated in order to communicate the results of the check for the inidividual thread, and should return a boolean to communicate the results of the check for the entire run.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

termination – Global termination criterion for entire process (True means terminate)

Return type:

bool

cleanup(settings)[source]

Perform any last tasks between the end of the main loop and the program exiting.

Parameters:settings (argparse.Namespace) – Settings namespace object
Returns:
Return type:None
gatekeeper(thread, settings)[source]

Return boolean indicating whether job is ready for next interpretation step.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

status – If True, ready for next interpretation step; otherwise, False

Return type:

bool

get_batch_template(thread, type, settings)[source]

Return name of batch template file for the type of job indicated.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • type (str) – Name of the type of job desired, corresponding to the template file
  • settings (argparse.Namespace) – Settings namespace object
Returns:

name – Name of the batch file template requested

Return type:

str

get_initial_coordinates(settings)[source]

Obtain list of initial coordinate files and copy them to the working directory.

Parameters:settings (argparse.Namespace) – Settings namespace object
Returns:initial_coordinates – List of strings naming the applicable initial coordinate files that were copied to the working directory
Return type:list
get_inpcrd(thread)[source]

Return a list (possibly of length one) containing the names of the appropriate inpcrd files for the next step in the thread given by thread.

Parameters:thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
Returns:inpcrd – List of strings containing desired file names
Return type:list
get_input_file(thread, job_index, settings)[source]

Obtain appropriate input file for next job.

At its most simple, implementations of this method can simply return settings.path_to_input_files + ‘/’ + settings.job_type + ‘_’ + thread.current_type[job_index] + ‘_’ + settings.md_engine + ‘.in’

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • job_index (int) – 0-indexed integer identifying which job within thread.current_type to return the input file for
  • settings (argparse.Namespace) – Settings namespace object
Returns:

input_file – Name of the applicable input file

Return type:

str

get_next_step(thread, settings)[source]

Return name of next type of simulation to run in the itinerary of this job type.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

type – List containing strings for name(s) of next type(s) of simulation(s)

Return type:

list

update_history(thread, settings, **kwargs)[source]

Update or initialize the history namespace for this job type.

This namespace is used to store the full history of a threads coordinate and trajectory files, as well as their results if necessary.

If update_history is called with a kwargs containing {‘initialize’: True}, it simply prepares a blank history namespace and returns it. Otherwise, it adds the values of the desired keywords (which are desired depends on the implementation) to the corresponding history attributes in the index given by thread.suffix.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
  • kwargs (dict) – Dictionary of arguments that might be used to update the history object
Returns:

Return type:

None

update_results(thread, allthreads, settings)[source]

Update appropriate results file(s) as needed.

These methods are designed to be called at the end of every step in a job, even if writing to an output file is not necessary after that step; for that reason, they also encode the logic to decide when writing is needed.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

Return type:

None

verify(arg, argtype)[source]

Confirm or deny that the object arg is a valid object of type type.

Parameters:
  • arg (any_type) – Object to verify
  • argtype (str) – Name of type of object
Returns:

Return type:

None

class atesa.jobtype.UmbrellaSampling[source]

Bases: atesa.jobtype.JobType

Adapter class for umbrella sampling

add_pathway_restraints(thread, settings)[source]

Build appropriate pathway restraints DISANG file for the window in the specified thread

Parameters:settings (argparse.Namespace) – Settings namespace object
Returns:
Return type:None
algorithm(thread, allthreads, running, settings)[source]

Update thread attributes to prepare for next move.

This is where the core logical algorithm of a method is implemented. For example, in aimless shooting, it encodes the logic of when and how to select a new shooting move.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • running (list) – The list of all currently running Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

running – The list of all currently running Thread objects

Return type:

list

check_for_successful_step(thread, settings)[source]

Check whether a just-completed step was successful, as defined by whether the update_results and check_termination methods should be run.

This method returns True if the previous step appeared successful (distinct from ‘accepted’ as the term refers to for example aimless shooting) and False otherwise. The implementation of what to DO with an unsuccessful step should appear in the corresponding algorithm method, which should be run regardless of the output from this method.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

result – True if successful; False otherwise

Return type:

bool

check_termination(thread, allthreads, settings)[source]

Check termination criteria for the particular thread at hand as well as for the entire process.

These methods should update thread.status and thread.terminated in order to communicate the results of the check for the inidividual thread, and should return a boolean to communicate the results of the check for the entire run.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

termination – Global termination criterion for entire process (True means terminate)

Return type:

bool

cleanup(settings)[source]

Perform any last tasks between the end of the main loop and the program exiting.

Parameters:settings (argparse.Namespace) – Settings namespace object
Returns:
Return type:None
gatekeeper(thread, settings)[source]

Return boolean indicating whether job is ready for next interpretation step.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

status – If True, ready for next interpretation step; otherwise, False

Return type:

bool

get_batch_template(thread, type, settings)[source]

Return name of batch template file for the type of job indicated.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • type (str) – Name of the type of job desired, corresponding to the template file
  • settings (argparse.Namespace) – Settings namespace object
Returns:

name – Name of the batch file template requested

Return type:

str

get_initial_coordinates(settings)[source]

Obtain list of initial coordinate files and copy them to the working directory.

Parameters:settings (argparse.Namespace) – Settings namespace object
Returns:initial_coordinates – List of strings naming the applicable initial coordinate files that were copied to the working directory
Return type:list
get_inpcrd(thread)[source]

Return a list (possibly of length one) containing the names of the appropriate inpcrd files for the next step in the thread given by thread.

Parameters:thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
Returns:inpcrd – List of strings containing desired file names
Return type:list
get_input_file(thread, job_index, settings)[source]

Obtain appropriate input file for next job.

At its most simple, implementations of this method can simply return settings.path_to_input_files + ‘/’ + settings.job_type + ‘_’ + thread.current_type[job_index] + ‘_’ + settings.md_engine + ‘.in’

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • job_index (int) – 0-indexed integer identifying which job within thread.current_type to return the input file for
  • settings (argparse.Namespace) – Settings namespace object
Returns:

input_file – Name of the applicable input file

Return type:

str

get_next_step(thread, settings)[source]

Return name of next type of simulation to run in the itinerary of this job type.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

type – List containing strings for name(s) of next type(s) of simulation(s)

Return type:

list

update_history(thread, settings, **kwargs)[source]

Update or initialize the history namespace for this job type.

This namespace is used to store the full history of a threads coordinate and trajectory files, as well as their results if necessary.

If update_history is called with a kwargs containing {‘initialize’: True}, it simply prepares a blank history namespace and returns it. Otherwise, it adds the values of the desired keywords (which are desired depends on the implementation) to the corresponding history attributes in the index given by thread.suffix.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • settings (argparse.Namespace) – Settings namespace object
  • kwargs (dict) – Dictionary of arguments that might be used to update the history object
Returns:

Return type:

None

update_results(thread, allthreads, settings)[source]

Update appropriate results file(s) as needed.

These methods are designed to be called at the end of every step in a job, even if writing to an output file is not necessary after that step; for that reason, they also encode the logic to decide when writing is needed.

Parameters:
  • thread (Thread) – Methods in the JobType abstract base class are intended to operate on Thread objects
  • allthreads (list) – The list of all extant Thread objects
  • settings (argparse.Namespace) – Settings namespace object
Returns:

Return type:

None

verify(arg, argtype)[source]

Confirm or deny that the object arg is a valid object of type type.

Parameters:
  • arg (any_type) – Object to verify
  • argtype (str) – Name of type of object
Returns:

Return type:

None

atesa.lmax module

Likelihood maximization script. This program is designed to be entirely separable from ATESA in that it can be called manually to perform likelihood maximization to user specifications and with arbitrary input files; however, it is required by ATESA’s aimless shooting information error convergence criterion.

atesa.lmax.eval_rc(params, obs)[source]
atesa.lmax.main(**kwargs)[source]

Main runtime function of lmax.py.

Assembles lists of models to optimize in the form of lists of CVs, passes them to optimize, interprets results, and repeats or terminates in accordance with argument-dependent termination criteria.

Parameters:kwargs (dict) – Dictionary object containing arguments
Returns:
Return type:None
atesa.lmax.objective_function(params, A_data, B_data)[source]

Evaluate the negative log likelihood function for the given parameters and lists of observations.

This function evaluates the goodness of fit of the given parameters and data to an error function ansatz, as described in Peters, 2012. Chem. Phys. Lett. 554: 248.

Designed to be called by an optimization routine to obtain the best fitting params.

Parameters:
  • params (list) – Parameters for the current model to be tested
  • A_data (list) – List of observations from aimless shooting that committed to basin “A” (usually the reactants)
  • B_data (list) – List of observations from aimless shooting that committed to basin “B” (usually the products)
Returns:

negative_log_likelihood – The negative log likelihood of the fit to the ansatz for the given parameters and observations

Return type:

float

atesa.lmax.two_line_test_func(results, plots, two_line_threshold=0.5)[source]

Perform a double linear regression on intersecting subsets of the data in results to determine whether to terminate and how many dimensions to return in the RC during two_line_test.

Can only be called with len(results) >= 5.

Parameters:
  • results (list) – List of dictionary objects indexed by step of two_line_test, each possessing attribute ‘fun’ giving the optimization score for that step
  • plots (bool) – If True, plot lines using gnuplot
  • two_line_threshold (float) – Ratio of second slope to first slope (as a fraction) below which the two-line test can pass
Returns:

out – Index of selected ‘best’ RC from two-line test; or, -1 if no best RC could be determined

Return type:

int

atesa.lmax.update_progress(progress, message='Progress', eta=0, quiet=False)[source]

Print a dynamic progress bar to stdout.

Credit to Brian Khuu from stackoverflow, https://stackoverflow.com/questions/3160699/python-progress-bar

Parameters:
  • progress (float) – A number between 0 and 1 indicating the fractional completeness of the bar. A value under 0 represents a ‘halt’. A value at 1 or bigger represents 100%.
  • message (str) – The string to precede the progress bar (so as to indicate what is progressing)
  • eta (int) – Number of seconds to display as estimated completion time (converted into HH:MM:SS)
  • quiet (bool) – If True, suppresses output entirely
Returns:

Return type:

None

atesa.lmax_temp module

atesa.main module

main.py Aimless Transition Ensemble Sampling and Analysis (ATESA)

This script handles the primary loop of building and submitting jobs in independent Threads, using the methods thereof to execute various interfaced/abstracted commands.

class atesa.main.Thread[source]

Bases: object

Object representing a series of simulations and containing the relevant information to define its current state.

Threads represent the level on which ATESA is parallelized. This flexible object is used for every type of job performed by ATESA.

Parameters:settings (argparse.Namespace) – Settings namespace object
Returns:
Return type:None
cancel_job(job_index, settings)[source]
gatekeeper(settings)[source]
get_batch_template(type, settings)[source]
get_frame(traj, frame, settings)[source]
get_next_step(settings)[source]
get_status(job_index, settings)[source]
interpret(allthreads, running, settings)[source]
process(running, settings)[source]
atesa.main.handle_loop_exception(attempted_rescue, running, settings)[source]

Handle attempted rescue of main loop after encountering an exception, or cancellation of jobs if rescue fails.

Parameters:
  • attempted_rescue (bool) – True if rescue has already been attempted and this function is being called again. Skips attempting rescue again and simply cancels all running jobs.
  • running (list) – List of Thread objects that are currently running. These are the threads that will be canceled if the ATESA run cannot be rescued.
  • settings (argparse.Namespace) – Settings namespace object
Returns:

Return type:

None

atesa.main.init_threads(settings)[source]

Initialize all the Thread objects called for by the user input file.

In the case where settings.restart == True, this involves unpickling restart.pkl; otherwise, brand new objects are produced in accordance with settings.job_type (aimless_shooting, committor_analysis, equilibrium_path_sampling, or isee).

Parameters:settings (argparse.Namespace) – Settings namespace object
Returns:allthreads – List of all Thread objects, including those for which no further tasks are scheduled.
Return type:list
atesa.main.main(settings, rescue_running=[])[source]

Perform the primary loop of building, submitting, monitoring, and analyzing jobs.

This function works via a loop of calls to thread.process and thread.interpret for each thread that hasn’t terminated, until either the global termination criterion is met or all the individual threads have completed.

Parameters:
  • settings (argparse.Namespace) – Settings namespace object
  • rescue_running (list) – List of threads passed in from handle_loop_exception, containing running threads. If given, setup is skipped and the function proceeds directly to the main loop.
Returns:

exit_message – A message indicating the status of ATESA at the end of main

Return type:

str

atesa.main.main_loop(settings, allthreads, running)[source]
atesa.main.run_main()[source]

atesa.mdengine module

Interface for MDEngine objects. New MDEngines can be implemented by constructing a new class that inherits from MDEngine and implements its abstract methods.

class atesa.mdengine.AdaptAmber[source]

Bases: atesa.mdengine.MDEngine

Adapter class for Amber MDEngine.

get_frame(trajectory, frame, settings)[source]

Return a new file containing just the frame’th frame of a trajectory in Amber .rst7 format

Parameters:
  • trajectory (str) – Name of trajectory file to obtain last frame from
  • frame (int) – Index of frame to return; 1-indexed, -1 gives last frame, 0 is invalid
  • settings (argparse.Namespace) – Settings namespace object
Returns:

last_frame – Name of .rst7 format coordinate file corresponding to desired frame of trajectory, if it exists; an empty string otherwise

Return type:

str

write_find_ts_restraint(basin, inp_file)[source]

Return the input file for a restrained simulation that performs barrier crossing in find_ts

Parameters:
  • basin (tuple) – Either settings.commit_fwd or settings.commit_bwd, defining the basin to restrain towards
  • inp_file (str) – Name of original input file without restraint
Returns:

input_file – Name of the simulation input file

Return type:

str

class atesa.mdengine.MDEngine[source]

Bases: abc.ABC

Abstract base class for molecular dynamics engines.

Implements methods for all of the engine-specific tasks that ATESA might need.

get_frame(trajectory, frame, settings)[source]

Return a new file containing just the frame’th frame of a trajectory in Amber .rst7 format

Parameters:
  • trajectory (str) – Name of trajectory file to obtain last frame from
  • frame (int) – Index of frame to return; 1-indexed, -1 gives last frame, 0 is invalid
  • settings (argparse.Namespace) – Settings namespace object
Returns:

last_frame – Name of .rst7 format coordinate file corresponding to desired frame of trajectory, if it exists; an empty string otherwise

Return type:

str

write_find_ts_restraint(basin, inp_file)[source]

Return the input file for a restrained simulation that performs barrier crossing in find_ts

Parameters:
  • basin (tuple) – Either settings.commit_fwd or settings.commit_bwd, defining the basin to restrain towards
  • inp_file (str) – Name of original input file without restraint
Returns:

input_file – Name of the simulation input file

Return type:

str

atesa.process module

This portion of the program is responsible for handling setup of the appropriate batch script(s) for the next step in a Thread, passing them to a task manager to submit them, and updating the list of currently running threads accordingly.

atesa.process.process(thread, running, settings)[source]

The main function of process.py. Reads the thread to identify the next step, then builds and submits the batch file(s) as needed.

Parameters:
  • thread (Thread()) – The Thread object on which to act
  • running (list) – The list of currently running threads, which will be updated as needed
  • settings (argparse.Namespace) – Settings namespace object
Returns:

running – The updated list of currently running threads after this process step

Return type:

list

atesa.rc_eval module

rc_eval.py Standalone script to evaluate RC values given an aimless shooting working directory and reaction coordinate definition

atesa.rc_eval.main(working_directory, rc_definition, as_out_file, extrema=False)[source]

The main function of rc_eval.py. Accepts an aimless shooting working directory and a reaction coordinate definition, producing in that directory a new file named ‘rc.out’ (overwriting if one already exists) identifying each shooting point (files in the directory whose names end in “_init.rst7”) and its corresponding reaction coordinate value in a sorted list.

If extrema == True, skips producing rc.out and just returns the minimum and maximum RC value for a single accepted shooting move, which is useful when preparing umbrella sampling simulations.

Parameters:
  • working_directory (str) – The path to the aimless shooting working directory in which to act
  • rc_definition (str) – A reaction coordinate definition formatted as a string of python-readable code with “CV[X]” standing in for the Xth CV value (one-indexed); this RC definition should be in terms of reduced variables (values between 0 and 1)
  • as_out_file (str) – Path to the aimless shooting output file used to build the reaction coordinate. Usually this should be a decorrelated file (named with “decorr”).
  • extrema (bool) – If True, skips producing rc.out and just returns the minimum and maximum RC value for a single accepted shooting move, which is useful when preparing umbrella sampling simulations.
Returns:

Return type:

None

atesa.rc_eval.update_progress(progress, message='Progress', eta=0, quiet=False)[source]

Print a dynamic progress bar to stdout.

Credit to Brian Khuu from stackoverflow, https://stackoverflow.com/questions/3160699/python-progress-bar

Parameters:
  • progress (float) – A number between 0 and 1 indicating the fractional completeness of the bar. A value under 0 represents a ‘halt’. A value at 1 or bigger represents 100%.
  • message (str) – The string to precede the progress bar (so as to indicate what is progressing)
  • eta (int) – Number of seconds to display as estimated completion time (converted into HH:MM:SS)
  • quiet (bool) – If True, suppresses output entirely
Returns:

Return type:

None

atesa.resample_and_inferr module

Helper file to call utilities.resample and then information_error.main in sequence in a single process.

atesa.resample_and_inferr.main()[source]

atesa.taskmanager module

Interface for TaskManager objects. New TaskManagers can be implemented by constructing a new class that inherits from TaskManager and implements its abstract methods.

class atesa.taskmanager.AdaptSimple[source]

Bases: atesa.taskmanager.TaskManager

Adapter class for my simple, no-frills task manager.

Just interfaces directly with the batch system through the terminal.

submit_batch(filename, settings)[source]

Submit a batch file to the task manager.

Parameters:
  • filename (str) – Name of batch file to submit
  • settings (argparse.Namespace) – Settings namespace object
Returns:

jobid – Identification number for this task, such that it can be cancelled by referring to this string

Return type:

str

class atesa.taskmanager.TaskManager[source]

Bases: abc.ABC

Abstract base class for task managers.

Implements methods for all of the task manager-specific tasks that ATESA might need.

submit_batch(filename, settings)[source]

Submit a batch file to the task manager.

Parameters:
  • filename (str) – Name of batch file to submit
  • settings (argparse.Namespace) – Settings namespace object
Returns:

jobid – Identification number for this task, such that it can be cancelled by referring to this string

Return type:

str

atesa.utilities module

Utility functions that don’t properly fit anywhere else. These are operations that aren’t specific to any particular interface or script.

atesa.utilities.check_commit(filename, settings)[source]

Check commitment of coordinate file to basins defined by settings.commit_fwd and settings.commit_bwd.

Raises a RuntimeError if the supplied file is not suitable for checking for commitment.

Parameters:
  • filename (str) – Name of coordinate or trajectory file to be checked. If the file has more than one frame, only the last frame will be loaded.
  • settings (argparse.Namespace) – Settings namespace object
Returns:

commit_flag – Either ‘fwd’ or ‘bwd’ if the coordinates are in the corresponding basin, or ‘’ if in neither

Return type:

str

atesa.utilities.evaluate_rc(rc_definition, cv_list)[source]

Evaluate the RC value given by RC definition for the given list of CV values given by cv_list.

Parameters:
  • rc_definition (str) – A reaction coordinate definition formatted as a string of python-readable code with “CV[X]” standing in for the Xth CV value (zero-indexed); e.g., “CV2” has value “4” in the cv_list [1, -2, 4, 6]
  • cv_list (list) – A list of CV values whose indices correspond to the desired values in rc_definition
Returns:

rc_value – The value of the reaction coordinate given the values in cv_list

Return type:

float

atesa.utilities.get_cvs(filename, settings, reduce=False, frame=0, only_in_rc=False)[source]

Get CV values for a coordinate file given by filename, as well as rates of change if settings.include_qdot = True.

If reduce = True, the returned CVs will be reduced to between 0 and 1 based on the minimum and maximum values of that CV in as.out, which is assumed to exist at settings.as_out_file.

If frame is > 0 or ‘all’, filename will be interpreted as a trajectory file instead of a .rst7 coordinate file. This option is incompatible with settings.include_qdot = True.

Parameters:
  • filename (str) – Name of .rst7-formatted coordinate file to be checked (or trajectory file if frame > 0 or frame == ‘all’)
  • settings (argparse.Namespace) – Settings namespace object
  • reduce (bool) – Boolean determining whether to reduce the CV values for use in evaluating an RC value that uses reduced values
  • frame (int or str) – Frame of trajectory filename to use (0-indexed, negatives read from end); or, ‘all’ returns the CVs for each frame of the input trajectory, separated by newlines. ‘all’ is incompatible with settings.include_qdot = True
  • only_in_rc (bool) – If this is True, then do not evaluate and return 0 for all CVs not present in the RC defined by settings.rc_definition. This is useful to speed up evaluation when all CVs are not necessary. Applies also to corresponding qdot values as appropriate.
Returns:

output – Space-separated list of CV values for the given coordinate file

Return type:

str

atesa.utilities.interpret_cv(cv_index, settings)[source]

Read the cv_index’th CV from settings.cvs, identify its type (distance, angle, dihedral, or differance-of-distances) and the atom indices the define it (one-indexed) and return these.

This function is designed for use in the umbrella_sampling jobtype only. For this reason, it only supports the aforementioned CV types. If none of these types appears to fit, this function raises a RuntimeError.

Parameters:
  • cv_index (int) – The index for the CV to use; e.g., 6 corresponds to CV6. Must be in the range [1, len(settings.cvs)].
  • settings (argparse.Namespace) – Settings namespace object
Returns:

  • atoms (list) – A list of 1-indexed atom indices as strings that define the given CV
  • optype (str) – A string (either ‘distance’, ‘angle’, ‘dihedral’, or ‘diffdistance’) corresponding to the type for this CV.
  • nat (int) – The number of atoms constituting the given CV

atesa.utilities.partial_full_cvs(thread, filename, settings)[source]

Write the full CVs list to the file given by filename for each accepted move in each thread in threads.

A helper function for parallelizing get_cvs (has to be defined at top-level for multiprocessing)

Parameters:
  • thread (Thread) – Thread object to evaluate
  • filename (str) – Name of the file to write CVs to
  • settings (argparse.Namespace) – Settings namespace object
Returns:

Return type:

None

atesa.utilities.plot_cvs_vs_rc(full_cvs_file, rc_definition, as_output_file)[source]

Produce a plot of the values of each CV in the RC as a function of RC value from either aimless shooting or umbrella sampling data.

The plot is made in matplotlib but also printed as text to an output file.

Parameters:
  • full_cvs_file (str) – Path to full_cvs output file (produced by utilities.resample or resampling.resample_umbrella_sampling)
  • rc_definition (str) – String representing the definition of the reduced reaction coordinate
  • as_output_file (str) – Path to the as_output_file file passed to lmax.py when generating the reaction coordinate
Returns:

Return type:

None

atesa.utilities.resample(settings, partial=False, full_cvs=False, only_full_cvs=False)[source]

Resample each shooting point in each thread with different CV definitions to produce new output files with extant aimless shooting data.

This function also assesses decorrelation times and produces one or more decorrelated output files. If and only if settings.information_error_checking == True, decorrelated files are produced at each settings.information_error_freq increment. In this case, if partial == True, decorrelation will only be assessed for data lengths absent from the info_err.out file in the working directory.

Parameters:
  • settings (argparse.Namespace) – Settings namespace object
  • partial (bool) – If True, reads the info_err.out file and only builds new decorrelated output files where the corresponding lines are missing from that file. If partial == False, decorrelation is assessed for every valid data length. Has no effect if not settings.information_error_checking.
  • full_cvs (bool) – If True, also resamples as_full_cvs.out using every prod trajectory in the working directory.
Returns:

Return type:

None

atesa.utilities.rev_vels(restart_file)[source]

Reverse all the velocity terms in a restart file and return the name of the new, ‘reversed’ file.

Parameters:restart_file (str) – Filename of the ‘fwd’ restart file, in .rst7 format
Returns:reversed_file – Filename of the newly written ‘bwd’ restart file, in .rst7 format
Return type:str

Module contents

atesa Python program for automating the “Aimless Transition Ensemble Sampling and Analysis” (ATESA) aimless shooting workflow on PBS/TORQUE or Slurm.