class ase.calculators.cp2k.CP2K(restart=None, ignore_bad_restart_file=False, label=’cp2k’, atoms=None, command=None, debug=False, **kwargs)[source]

ASE-Calculator for CP2K.

CP2K is a program to perform atomistic and molecular simulations of solid state, liquid, molecular, and biological systems. It provides a general framework for different methods such as e.g., density functional theory (DFT) using a mixed Gaussian and plane waves approach (GPW) and classical pair and many-body potentials.

CP2K is freely available under the GPL license. It is written in Fortran 2003 and can be run efficiently in parallel.

Check http://www.cp2k.org about how to obtain and install CP2K. Make sure that you also have the CP2K-shell available, since it is required by the CP2K-calulator.

The CP2K-calculator relies on the CP2K-shell. The CP2K-shell was originally designed for interactive sessions. When a calculator object is instantiated, it launches a CP2K-shell as a subprocess in the background and communications with it through stdin/stdout pipes. This has the advantage that the CP2K process is kept alive for the whole lifetime of the calculator object, i.e. there is no startup overhead for a sequence of energy evaluations. Furthermore, the usage of pipes avoids slow file- system I/O. This mechanism even works for MPI-parallelized runs, because stdin/stdout of the first rank are forwarded by the MPI-environment to the mpiexec-process.

The command used by the calculator to launch the CP2K-shell is cp2k_shell. To run a parallelized simulation use something like this:

>>> CP2K.command="env OMP_NUM_THREADS=2 mpiexec -np 4 cp2k_shell.psmp"


auto_write: bool
Flag to enable the auto-write mode. If enabled the write() routine is called after every calculation, which mimics the behavior of the FileIOCalculator. Default is False.
basis_set: str
Name of the basis set to be use. The default is DZVP-MOLOPT-SR-GTH.
basis_set_file: str
Filename of the basis set file. Default is BASIS_MOLOPT. Set the environment variable $CP2K_DATA_DIR to enabled automatic file discovered.
charge: float
The total charge of the system. Default is 0.
command: str
The command used to launch the CP2K-shell. If command is not passed as an argument to the constructor, the class-variable CP2K.command, and then the environment variabel $ASE_CP2K_COMMAND are checked. Eventually, cp2k_shell is used as default.
cutoff: float
The cutoff of the finest grid level. Default is 400 * Rydberg.
debug: bool
Flag to enable debug mode. This will print all communication between the CP2K-shell and the CP2K-calculator. Default is False.
force_eval_method: str
The method CP2K uses to evaluate energies and forces. The default is Quickstep, which is CP2K’s module for electronic structure methods like DFT.
inp: str
CP2K input template. If present, the calculator will augment the template, e.g. with coordinates, and use it to launch CP2K. Hence, this generic mechanism gives access to all features of CP2K. Note, that most keywords accept None to disable the generation of the corresponding input section.
max_scf: int
Maximum number of SCF iteration to be performed for one optimization. Default is 50.
poisson_solver: str
The poisson solver to be used. Currently, the only supported values are auto and None. Default is auto.
potential_file: str
Filename of the pseudo-potential file. Default is POTENTIAL. Set the environment variable $CP2K_DATA_DIR to enabled automatic file discovered.
pseudo_potential: str
Name of the pseudo-potential to be use. Default is auto. This tries to infer the potential from the employed XC-functional, otherwise it falls back to GTH-PBE.
stress_tensor: bool
Indicates whether the analytic stress-tensor should be calculated. Default is True.
uks: bool
Requests an unrestricted Kohn-Sham calculations. This is need for spin-polarized systems, ie. with an odd number of electrons. Default is False.
xc: str
Name of exchange and correlation functional. Accepts all functions supported by CP2K itself or libxc. Default is LDA.
print_level: str
PRINT_LEVEL of global output. Possible options are: DEBUG Everything is written out, useful for debugging purposes only HIGH Lots of output LOW Little output MEDIUM Quite some output SILENT Almost no output Default is ‘LOW’

Construct CP2K-calculator object.