pestifer.util.namdrestart module¶
Defines the NAMDConfig class for parsing NAMD config files and the make_namd_restart() function for the NAMD restart task.
- class pestifer.util.namdrestart.NAMDConfig(configfile: Path | str)[source]¶
Bases:
objectA class for parsing NAMD configuration files. This class reads a NAMD config file, extracts commands and variable assignments, and allows for modification of the configuration by replacing variable assignments and commands.
- Parameters:
configfile (str) – The path to the NAMD configuration file to be parsed. The file should exist and be readable.
- backresolve_lines()[source]¶
Back-resolve variable assignments in the lines of the NAMD configuration.
- replace_command(commandname: str, args: list[str])[source]¶
Replace a command in the NAMD configuration with a new command and its arguments.
- Parameters:
commandname (str) – The name of the command to be replaced. The command name is case-insensitive.
args (list) – A list of arguments to be passed to the command. The arguments can include variable references (starting with $). If an argument starts with $, it is treated as a variable reference and will be back-resolved to its value.
- pestifer.util.namdrestart.make_namd_restart_subcommand(args: Namespace)[source]¶
Create a NAMD restart configuration file based on an existing NAMD log file and configuration file.
- Parameters:
args (argparse.Namespace) –
The command-line arguments parsed by argparse. It should contain the following attributes:
namd_log: The path to the NAMD log file.config: The path to the NAMD configuration file.new_base: The new base name for the output files.run: The number of time steps to run. Ifrunis 0, the script will not run any new time steps.slurm: The path to the SLURM script file, if applicable.