| 1 | --- |
| 2 | layout: default |
| 3 | title: custodian.cp2k.jobs.md |
| 4 | nav_exclude: true |
| 5 | --- |
| 6 | |
| 7 | # custodian.cp2k.jobs module |
| 8 | |
| 9 | This module implements basic kinds of jobs for Cp2k runs. |
| 10 | |
| 11 | ## *class* custodian.cp2k.jobs.Cp2kJob(cp2k_cmd, input_file=’cp2k.inp’, output_file=’cp2k.out’, stderr_file=’std_err.txt’, suffix=’’, final=True, backup=True, settings_override=None, restart=False) |
| 12 | |
| 13 | Bases: [`Job`](custodian.custodian.md#custodian.custodian.Job) |
| 14 | |
| 15 | A basic cp2k job. Just runs whatever is in the directory. But conceivably |
| 16 | can be a complex processing of inputs etc. with initialization. |
| 17 | |
| 18 | This constructor is necessarily complex due to the need for |
| 19 | flexibility. For standard kinds of runs, it’s often better to use one |
| 20 | of the static constructors. The defaults are usually fine too. |
| 21 | |
| 22 | * **Parameters** |
| 23 | * **cp2k_cmd** (*list*) – Command to run cp2k as a list of args. For example, |
| 24 | if you are using mpirun, it can be something like |
| 25 | [“mpirun”, “cp2k.popt”] |
| 26 | * **input_file** (*str*) – Name of the file to use as input to CP2K |
| 27 | executable. Defaults to “cp2k.inp” |
| 28 | * **output_file** (*str*) – Name of file to direct standard out to. |
| 29 | Defaults to “cp2k.out”. |
| 30 | * **stderr_file** (*str*) – Name of file to direct standard error to. |
| 31 | Defaults to “std_err.txt”. |
| 32 | * **suffix** (*str*) – A suffix to be appended to the final output. E.g., |
| 33 | to rename all CP2K output from say cp2k.out to |
| 34 | cp2k.out.relax1, provide “.relax1” as the suffix. |
| 35 | * **final** (*bool*) – Indicating whether this is the final cp2k job in a |
| 36 | series. Defaults to True. |
| 37 | * **backup** (*bool*) – Whether to backup the initial input files. If True, |
| 38 | the input file will be copied with a |
| 39 | “.orig” appended. Defaults to True. |
| 40 | * **settings_override** ( *[**actions**]*) – A list of actions. See the Cp2kModder |
| 41 | in interpreter.py |
| 42 | * **restart** (*bool*) – Whether to run in restart mode, i.e. this a continuation of |
| 43 | a previous calculation. Default is False. |
| 44 | |
| 45 | ### *classmethod* double_job(cp2k_cmd, input_file=’cp2k.inp’, output_file=’cp2k.out’, stderr_file=’std_err.txt’, backup=True) |
| 46 | |
| 47 | This creates a sequence of two jobs. The first of which is an “initialization” of the |
| 48 | wfn. Using this, the “restart” function can be exploited to determine if a diagonalization |
| 49 | job can/would benefit from switching to OT scheme. If not, then the second job remains a |
| 50 | diagonalization job, and there is minimal overhead from restarting. |
| 51 | |
| 52 | ### *classmethod* gga_static_to_hybrid(cp2k_cmd, input_file=’cp2k.inp’, output_file=’cp2k.out’, stderr_file=’std_err.txt’, backup=True, settings_override_gga=None, settings_override_hybrid=None) |
| 53 | |
| 54 | A bare gga to hybrid calculation. Removes all unnecessary features |
| 55 | from the gga run, and making it only a ENERGY/ENERGY_FORCE |
| 56 | depending on the hybrid run. |
| 57 | |
| 58 | ### postprocess() |
| 59 | |
| 60 | Postprocessing includes renaming and gzipping where necessary. |
| 61 | |
| 62 | ### *classmethod* pre_screen_hybrid(cp2k_cmd, input_file=’cp2k.inp’, output_file=’cp2k.out’, stderr_file=’std_err.txt’, backup=True) |
| 63 | |
| 64 | Build a job where the first job is an unscreened hybrid static calculation, then the second one |
| 65 | uses the wfn from the first job as a restart to do a screened calculation. |
| 66 | |
| 67 | ### run() |
| 68 | |
| 69 | Perform the actual CP2K run. |
| 70 | |
| 71 | * **Returns** |
| 72 | |
| 73 | (subprocess.Popen) Used for monitoring. |
| 74 | |
| 75 | ### setup() |
| 76 | |
| 77 | Performs initial setup for Cp2k in three stages. First, if custodian is running in restart mode, then |
| 78 | the restart function will copy the restart file to self.input_file, and remove any previous WFN initialization |
| 79 | if present. Second, any additional user specified settings will be applied. Lastly, a backup of the input |
| 80 | file will be made for reference. |
| 81 | |
| 82 | ### terminate() |
| 83 | |
| 84 | Terminate cp2k |