User Tools

Site Tools


dev:codestructure

This is an old revision of the document!


CP2K Code Structure

CP2K is a large, complex application which has many features, methods and algorithms implemented. When looking at the code for the first time it can be very challenging to understand how it all works, or even where to start looking! This page is intended for novice developers who have read and understood the literature and wish to locate the relevant algorithms and data structures in the code.

File Names

Source files should have prefixes corresponding to their main functionalities. For example:

  • qs_* for Quickstep related source codes (Hamiltonian construction, integration, collocation, energy minimisation and SCF cycle etc)
  • xc_* for Exchange-Correlation functionals used by Quickstep
  • md_* for Molecular Dynamics related source codes
  • mc_* for Quantum Monte Carlo related source codes
  • fist_* for FIST classical MD related source codes
  • input_* for general input functions of CP2K
  • qmmm_* for QM/MM related source codes
  • messsage_* for MPI message passing related source codes
  • machine_* for architecture dependent codes
  • admm_* for auxilliary density matrix (ADMM) method related codes
  • ai_* for integrals of the primitive cartesian Gaussians
  • atomic_* for datatypes related to information on atoms in a simulation
  • atom_* for atomic calculations

These prefixes are not exclusive, nor are they always logical. There are exceptions in code naming conventions, for example:

  • realspace_grid_types.F and realspace_grid_cube.F are both used in Quickstep, but do not have the corresponding qs_ prefix

Overall Structure

  • Extensive use of Fortran modules, and there are no global variables
  • Major parts of the CP2K code are compiled into separate libraries, for example:
    • cp2k_lib, cp2k_base_lib, cp2k_dbcsr_lib, cp2k_ft_lib etc.
dev/codestructure.1381405194.txt.gz · Last modified: 2020/08/21 10:14 (external edit)