Skip to content

Commit

Permalink
Converted functions set_params, check_gmx_executable, run_grompp, and…
Browse files Browse the repository at this point in the history
… run_mdrun to internal functions
  • Loading branch information
wehs7661 committed Aug 29, 2023
1 parent 13efc15 commit 27a8e24
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
5 changes: 5 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,8 @@
autodoc_member_order = 'bysource'
napoleon_attr_annotations = True
autodoc_mock_imports = ["mpi4py"] # we originally included gmxapi in the old versions of ensemble_md

# -- Others ------------------------------------------------------------------
autodoc_default_options = {
'private-members': True,
}
20 changes: 10 additions & 10 deletions ensemble_md/ensemble_EXE.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class EnsembleEXE:
an ensemble of expanded ensemble. Upon instantiation, all parameters in the YAML
file will be assigned to an attribute in the class. In addition to these variables,
below is a list of attributes of the class. (All the the attributes are assigned by
:obj:`set_params` unless otherwise noted.)
:obj:`_set_params` unless otherwise noted.)
:ivar gmx_path: The absolute path of the GROMACS exectuable.
:ivar gmx_version: The version of the GROMACS executable.
Expand Down Expand Up @@ -84,9 +84,9 @@ class EnsembleEXE:

def __init__(self, yaml_file, analysis=False):
self.yaml = yaml_file
self.set_params(analysis)
self._set_params(analysis)

def set_params(self, analysis):
def _set_params(self, analysis):
"""
Sets up or reads in the user-defined parameters from a yaml file and an MDP template.
This function is called to instantiate the class in the :code:`__init__` function of
Expand Down Expand Up @@ -1241,7 +1241,7 @@ def combine_weights(self, weights, weights_err=None):

return weights, g_vec

def run_grompp(self, n, swap_pattern):
def _run_grompp(self, n, swap_pattern):
"""
Prepares TPR files for the simulation ensemble using the GROMACS :code:`grompp` command.
Expand Down Expand Up @@ -1306,7 +1306,7 @@ def run_grompp(self, n, swap_pattern):
if code_list != [0] * self.n_sim:
MPI.COMM_WORLD.Abort(1) # Doesn't matter what non-zero returncode we put here as the code from GROMACS will be printed before this point anyway. # noqa: E501

def run_mdrun(self, n):
def _run_mdrun(self, n):
"""
Executes GROMACS mdrun commands in parallel.
Expand Down Expand Up @@ -1373,14 +1373,14 @@ def run_EEXE(self, n, swap_pattern=None):
print(iter_str + '\n' + '=' * (len(iter_str) - 1))

# 1st synchronizing point for all MPI processes: To make sure ranks other than 0 will not start executing
# run_grompp earlier and mess up the order of printing.
# _run_grompp earlier and mess up the order of printing.
comm.barrier()

# Generating all required TPR files simultaneously, then run all simulations simultaneously.
# No synchronizing point is needed between run_grompp and run_mdrun, since once rank i finishes run_grompp,
# it should run run_mdrun in the same working directory, so there won't be any I/O error.
self.run_grompp(n, swap_pattern)
self.run_mdrun(n)
# No synchronizing point is needed between _run_grompp and _run_mdrun, since once rank i finishes _run_grompp,
# it should run _run_mdrun in the same working directory, so there won't be any I/O error.
self._run_grompp(n, swap_pattern)
self._run_mdrun(n)

# 2nd synchronizaing point for all MPI processes: To make sure no rank will start getting to the next
# iteration earlier than the others. For example, if rank 0 finishes the mdrun command earlier, we don't
Expand Down

0 comments on commit 27a8e24

Please sign in to comment.