Start from copy
Gear for haddock3-copy
CLI and –extend-run` flag.
- class haddock.gear.extend_run.WorkflowManagerExtend(workflow_params: dict[str, dict[str, Any]], start: int | None = 0, **other_params: Any)[source]
Bases:
WorkflowManager
Workflow to extend a run.
- haddock.gear.extend_run.add_extend_run(parser: ArgumentParser) None [source]
Add option to
--extend-run
.
- haddock.gear.extend_run.copy_renum_step_folders(indir: str | Path, destdir: str | Path, steps: list[FilePathT]) list[Path] [source]
Copy step folders renumbering them sequentially in the run directory.
The content of the files is not modified. See
rename_step_contents()
.py:gear.zerofill.zero_fill: must be previously calibrated.
Example
>>> steps = ['0_topoaa', '4_flexref'] >>> zero_fill.set_zerofill_number(len(steps)) >>> copy_renum_step_folders('run1', 'newrun', steps)
The initial structure:
run1/ 0_topoaa/ 1_rigidbody/ 2_caprieval/ 3_seletop/ 4_flexref/ (etc...)
Results in:
newrun/ 0_topoaa/ 1_flexref/
- Parameters:
indir (str or Path) – The input directory where the original steps reside.
destdir (str or Path) – The output directory where to copy the steps to.
steps (list of (str or Path)) – The list of the folder names in indir to copy.
- Returns:
list – The new paths created.
- haddock.gear.extend_run.read_num_molecules_from_folder(folder: str | Path) int [source]
Read the number of molecules from the first step folder.
Find the lower indexed step folder in folder.
Read the io.json file.
Count the number of items in the “output” key.
The above is the number of molecules.
- Parameters:
folder (Path or string) – The run directory.
- Returns:
int – The number of molecules found.
- haddock.gear.extend_run.renum_step_folders(folder: str | Path) tuple[list[str], list[str]] [source]
Renumber the step folders sequentially in the run directory.
The content of the files is not modified.
See
rename_step_contents()
.Example
The initial structure:
folder/ 0_topoaa/ 4_flexref/
Results in:
folder/ 0_topoaa/ 1_flexref/
- Returns:
list – The list of the original step folder names.
list – The list of the new step folder names.
- haddock.gear.extend_run.update_contents_of_new_steps(selected_steps: Iterable[str], olddir: str | Path, newdir: str | Path) None [source]
Find-replace run references in step folders files.
Find and replaces (updates) all references to step folders and to the old run directory in all files of selected step folders.
Example
>>> update_contents_of_new_steps( ['0_topoaa', '1_rigidbody'], 'run1', 'run2', )
- Parameters:
selected_steps (list of str) – The names of the original step folder names that to find in the new step folders. This function uses
haddock.modules.get_module_steps_folders()
to find the new step folders.selected_steps
must be synchronized with the new folders; that is, the names inselected_steps
must be the old names of the new step folders.olddir (str or Path) – The original run directory to be replaced by newdir.
newdir (str or Path) – The new run directory.
- Returns:
None – Save files in place.