cp2k package

Submodules

cp2k.cp2k_prep module

Module containing the Cp2kPrep class and the command line interface.

class cp2k.cp2k_prep.Cp2kPrep(output_inp_path: str, input_pdb_path: str | None = None, input_inp_path: str | None = None, input_rst_path: str | None = None, properties: dict | None = None, **kwargs)[source]

Bases: BiobbObject

biobb_cp2k Cp2kPrep
Helper bb to prepare inputs for the CP2K QM tool module.
Prepares input files for the CP2K QM tool.
Parameters:
  • input_inp_path (str) (Optional) – Input configuration file (CP2K run options). File type: input. Sample file. Accepted formats: pdb (edam:format_1476).

  • input_pdb_path (str) (Optional) –

    Input PDB file. File type: input. Sample file. Accepted formats: pdb (edam:format_1476).

  • input_rst_path (str) (Optional) –

    Input restart file (WFN). File type: input. Sample file. Accepted formats: wfn (edam:format_2333).

  • output_inp_path (str) –

    Output CP2K input configuration file. File type: output. Sample file. Accepted formats: inp (edam:format_2330), in (edam:format_2330), txt (edam:format_2330).

  • properties (dict - Python dictionary object containing the tool parameters, not input/output files) –

    • simulation_type (str) - (“energy”) Default options for the cp2k_in file. Each creates a different inp file. Values: energy (Computes Energy and Forces), geom_opt (Runs a geometry optimization), md (Runs an MD calculation), mp2 (Runs an MP2 calculation).

    • cp2k_in (dict) - ({}) CP2K run options specification.

    • cell_cutoff (float) - (5.0) CP2K cell cutoff, to build the cell around the system (only used if input_pdb_path is defined).

    • remove_tmp (bool) - (True) [WF property] Remove temporal files.

    • restart (bool) - (False) [WF property] Do not execute if output files exist.

    • sandbox_path (str) - (“./”) [WF property] Parent path to the sandbox directory.

Examples

This is a use example of how to use the building block from Python:

from biobb_cp2k.cp2k.cp2k_prep import cp2k_prep
prop = {
    'simulation_type': 'geom_opt'
}
cp2k_prep(input_pdb_path='/path/to/input.pdb',
             input_inp_path='/path/to/cp2k_in.inp',
             output_inp_path='/path/to/cp2k_out.inp',
             properties=prop)
Info:
check_data_params(out_log, out_err)[source]

Checks input/output paths correctness

iterdict(d, depth, fileout_h)[source]
launch()[source]

Launches the execution of the Cp2kPrep module.

merge(a, b)[source]
parse_pdb(pdb_file)[source]
parse_rec_def(cp2k_in_array, index, stop)[source]
replace_coords(a, b)[source]
update(d, u)[source]
cp2k.cp2k_prep.cp2k_prep(output_inp_path: str, input_inp_path: str | None = None, input_pdb_path: str | None = None, input_rst_path: str | None = None, properties: dict | None = None, **kwargs) int[source]

Create Cp2kPrep method

cp2k.cp2k_prep.main()[source]

cp2k.cp2k_run module

Module containing the Cp2kRun class and the command line interface.

class cp2k.cp2k_run.Cp2kRun(input_inp_path: str, output_log_path: str, output_outzip_path: str, output_rst_path: str, properties: dict | None = None, **kwargs)[source]

Bases: BiobbObject

biobb_cp2k Cp2kRun
Wrapper of the CP2K QM tool module.
Runs atomistic simulations of solid state, liquid, molecular, periodic, material, crystal, and biological systems using CP2K QM tool.
Parameters:
  • input_inp_path (str) –

    Input configuration file (CP2K run options). File type: input. Sample file. Accepted formats: inp (edam:format_2330), in (edam:format_2330), txt (edam:format_2330), wfn (edam:format_2333).

  • output_log_path (str) –

    Output log file. File type: output. Sample file. Accepted formats: log (edam:format_2330), out (edam:format_2330), txt (edam:format_2330), o (edam:format_2330).

  • output_outzip_path (str) –

    Output files. File type: output. Sample file. Accepted formats: zip (edam:format_3987), gzip (edam:format_3987), gz (edam:format_3987).

  • output_rst_path (str) –

    Output restart file. File type: output. Sample file. Accepted formats: wfn (edam:format_2333).

  • properties (dict - Python dictionary object containing the tool parameters, not input/output files) –

    • binary_path (str) - (“cp2k.sopt”) CP2K binary path to be used.

    • param_path (str) - (None) Path to the CP2K parameter data files (BASIS_SET, POTENTIALS, etc.). If not provided, the parameter data files included in the package will be used.

    • mpi_bin (str) - (None) Path to the MPI runner. Usually “mpirun” or “srun”.

    • mpi_np (int) - (0) [0~1000|1] Number of MPI processes. Usually an integer bigger than 1.

    • mpi_flags (str) - (None) Path to the MPI hostlist file.

    • remove_tmp (bool) - (True) [WF property] Remove temporal files.

    • restart (bool) - (False) [WF property] Do not execute if output files exist.

    • sandbox_path (str) - (“./”) [WF property] Parent path to the sandbox directory.

Examples

This is a use example of how to use the building block from Python:

from biobb_cp2k.cp2k.cp2k_run import cp2k_run
prop = {
    'binary_path': 'cp2k.sopt'
}
cp2k_run(input_inp_path='/path/to/cp2k_input.inp',
             output_log_path='/path/to/cp2k_log.log',
             output_outzip_path='/path/to/cp2k_out.zip',
             output_rst_path='/path/to/cp2k_rst.wfn',
             properties=prop)
Info:
check_data_params(out_log, out_err)[source]

Checks input/output paths correctness

launch()[source]

Launches the execution of the Cp2kRun module.

cp2k.cp2k_run.cp2k_run(input_inp_path: str, output_log_path: str, output_outzip_path: str, output_rst_path: str, properties: dict | None = None, **kwargs) int[source]

Create Cp2kRun method

cp2k.cp2k_run.main()[source]