htesp.generate_submission¶
Module to prepare job submission scripts
Functions
|
Generate submission files based on the calculation type, parallel command, number of processors, and a dictionary of commands. |
|
Build the launcher prefix for one run line, e.g. |
|
Load parameters from a JSON file, generate submission files based on the specified calculation type, and create a script containing the submission commands. |
|
Map a which_calc value onto one of 'qe', 'epw', 'wannier', 'vasp'. |
- htesp.generate_submission.normalise_calc(which_calc)[source]¶
Map a which_calc value onto one of ‘qe’, ‘epw’, ‘wannier’, ‘vasp’.
- Parameters:
which_calc (str) – Value of the
job_script.which_calckey, in any capitalisation.- Returns:
The canonical name, or None when the value is not recognised.
- Return type:
str or None
- htesp.generate_submission.launch(parallel_command, nproc)[source]¶
Build the launcher prefix for one run line, e.g.
"mpirun -np 4".- Parameters:
parallel_command (str) –
job_script.parallel_command. Either a bare launcher (srun) or one that already carries its own flags ("srun --cpu-bind=cores -n 8"), in which case it is passed through untouched – a site that has spelled out its launcher means it.nproc (int or str) –
job_script.nproc.
- Returns:
The prefix, with no trailing space, or
""when no launcher is configured (the executable then runs serially rather than being handed to a command named “”).- Return type:
str
- htesp.generate_submission.generate_submission_files(which_calc, parallel_command, nproc, command_list)[source]¶
Generate submission files based on the calculation type, parallel command, number of processors, and a dictionary of commands.
Parameters:
which_calc (str): The type of calculation. Valid options include ‘qe’, ‘epw’, ‘wannier’, and ‘vasp’.
parallel_command (str): The parallel command to be used for execution, e.g., ‘mpirun’.
nproc (str): The number of processors to be used.
command_list (dict): A dictionary containing command information for each calculation type. Keys are command names, and values are tuples containing the executable command, input file, and output file.
Returns:
submission_files (dict): A dictionary containing generated submission files. Keys are command names, and values are formatted submission commands ready for execution.
Raises:
ValueError: If an invalid calculation type is provided.
Example:
>>> command_list = { ... 'scf': ('pw.x', 'scf.in', 'scf.out'), ... 'nscf': ('pw.x', 'nscf.in', 'nscf.out') ... } >>> submission_files = generate_submission_files('qe', 'mpirun', '4', command_list) >>> print(submission_files)
- htesp.generate_submission.main()[source]¶
Load parameters from a JSON file, generate submission files based on the specified calculation type, and create a script containing the submission commands.
Reads parameters from ‘config.json’ and defines command dictionaries for different calculation types. Generates submission files based on the provided calculation type and prints the submission commands. Creates a script containing the submission commands named ‘run-<calculation_type>.sh’.
Parameters: None
Returns: None