namespace rgpot::cp2k

Overview

CP2K input decks from CP2KParams and one geometry. More…

namespace cp2k {
 
// global variables
 
const char* kCoordToken = “@RGPOT_COORD@”;
const char* kCellToken = “@RGPOT_CELL@”;
 
// global functions
 
std::string elementSymbol(int z);
std::string checkTemplate(const std::string& deck);
std::string coordRows(std::size_t n_atoms, const double* pos_ang, const int* atomic_numbers);
std::string cellRows(const double* box_ang);
std::string defaultTemplate(const ::CP2KParams::Reader& params, const std::vector<int>& atomic_numbers);
std::string renderDeck(const ::CP2KParams::Reader& params, std::size_t n_atoms, const double* pos_ang, const int* atomic_numbers, const double* box_ang);
 
} // namespace cp2k

Detailed Documentation

CP2K input decks from CP2KParams and one geometry.

Pure text functions without libcp2k, so the deck CP2KPot hands the shim can be tested on its own.

Global Variables

const char* kCoordToken = “@RGPOT_COORD@”

Token a template replaces with one &COORD row per atom (Angstrom).

const char* kCellToken = “@RGPOT_CELL@”

Token a template replaces with the &CELL A, B and C rows (Angstrom).

Global Functions

std::string elementSymbol(int z)

Element symbol of atomic number z (1..118). Throws std::invalid_argument outside that range.

std::string checkTemplate(const std::string& deck)

Empty when deck contains both tokens, else the reason it does not.

std::string coordRows(std::size_t n_atoms, const double* pos_ang, const int* atomic_numbers)

Symbol x y z rows, one per atom, positions in Angstrom.

std::string cellRows(const double* box_ang)

A, B and C rows from a row-major 3x3 cell in Angstrom (rows are the cell vectors).

std::string defaultTemplate(const ::CP2KParams::Reader& params, const std::vector<int>& atomic_numbers)

The deck the typed fields describe, with both tokens in place of the geometry. One &KIND block per element, in order of first appearance.

std::string renderDeck(const ::CP2KParams::Reader& params, std::size_t n_atoms, const double* pos_ang, const int* atomic_numbers, const double* box_ang)

inputTemplate when it is set, else defaultTemplate, with the tokens replaced by this geometry. Throws std::invalid_argument when the template lacks a token or an atomic number has no symbol.