![]() |
(git:d18deda)
|
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | cp2k_transport_parameters |
Transport parameters read from a CP2K input file. This definition matches the respective type definition in the transport_env_types module. More... | |
struct | cp2k_csr_interop_type |
CP2K's C-interoperable CSR matrix This definition matches the respective type definition in the transport_env_types module. More... | |
Typedefs | |
typedef int | force_env_t |
Definitions for the functions exported in libcp2k.F. | |
typedef void(* | ext_method_callback_f_ptr) (cp2k_transport_parameters, cp2k_csr_interop_type, cp2k_csr_interop_type, cp2k_csr_interop_type *, cp2k_csr_interop_type *) |
Function pointer type for the externally evaluated density matrix Function pointer type pointing to a C routine that takes the S and H matrices as input and outputs a P matrix. | |
Functions | |
void | cp2k_get_version (char *version_str, int str_length) |
Get the CP2K version string. | |
void | cp2k_init () |
Initialize CP2K and MPI. | |
void | cp2k_init_without_mpi () |
Initialize CP2K without initializing MPI. | |
void | cp2k_finalize () |
Finalize CP2K and MPI. | |
void | cp2k_finalize_without_mpi () |
Finalize CP2K and without finalizing MPI. | |
void | cp2k_create_force_env (force_env_t *new_force_env, const char *input_file_path, const char *output_file_path) |
Create a new force environment. | |
void | cp2k_create_force_env_comm (force_env_t *new_force_env, const char *input_file_path, const char *output_file_path, int mpi_comm) |
Create a new force environment (custom managed MPI) | |
void | cp2k_destroy_force_env (force_env_t force_env) |
Destroy/cleanup a force environment. | |
void | cp2k_set_positions (force_env_t force_env, const double *new_pos, int n_el) |
Set positions of the particles. | |
void | cp2k_set_velocities (force_env_t force_env, const double *new_vel, int n_el) |
Set velocity of the particles. | |
void | cp2k_set_cell (force_env_t force_env, const double *new_cell) |
Set the size of the cell. | |
void | cp2k_get_result (force_env_t force_env, const char *description, double *result, int n_el) |
Get an arbitrary result as 1D array from CP2K. | |
void | cp2k_get_natom (force_env_t force_env, int *natom) |
Get the number of atoms. | |
void | cp2k_get_nparticle (force_env_t force_env, int *nparticle) |
Get the number of particles. | |
void | cp2k_get_positions (force_env_t force_env, double *pos, int n_el) |
Get the positions of the particles. | |
void | cp2k_get_forces (force_env_t force_env, double *force, int n_el) |
Get the forces for the particles. | |
void | cp2k_get_potential_energy (force_env_t force_env, double *e_pot) |
Get the potential energy of the system. | |
void | cp2k_get_cell (force_env_t force_env, const double *cell) |
Get the size of the cell. | |
void | cp2k_get_qmmm_cell (force_env_t force_env, const double *cell) |
Get the size of the qmmm cell. | |
void | cp2k_calc_energy_force (force_env_t force_env) |
Calculate energy and forces of the system. | |
void | cp2k_calc_energy (force_env_t force_env) |
Calculate only the energy of the system. | |
void | cp2k_run_input (const char *input_file_path, const char *output_file_path) |
Make a CP2K run with the given input file. | |
void | cp2k_run_input_comm (const char *input_file_path, const char *output_file_path, int mpi_comm) |
Make a CP2K run with the given input file (custom managed MPI) | |
void | cp2k_transport_set_callback (force_env_t force_env, ext_method_callback_f_ptr func) |
Set the function callback for the externally evaluated density matrix. | |
int | cp2k_active_space_get_mo_count (force_env_t force_env) |
Get the number of molecular orbitals in the active space. | |
long int | cp2k_active_space_get_fock_sub (force_env_t force_env, double *buf, long int buf_len) |
Get the Fock submatrix for the active space. | |
long int | cp2k_active_space_get_eri_nze_count (force_env_t force_env) |
Get the number of non-zero elements in the ERI matrix. | |
int | cp2k_active_space_get_eri (force_env_t force_env, int *buf_coords, long int buf_coords_len, double *buf_values, long int buf_values_len) |
Get the non-zero elements of the ERI matrix The buf_coords will contain the coordinates in the format [i1, j1, k1, l1, i2, j2, k2, l2, ... ] . | |
typedef int force_env_t |
typedef void(* ext_method_callback_f_ptr) (cp2k_transport_parameters, cp2k_csr_interop_type, cp2k_csr_interop_type, cp2k_csr_interop_type *, cp2k_csr_interop_type *) |
Function pointer type for the externally evaluated density matrix Function pointer type pointing to a C routine that takes the S and H matrices as input and outputs a P matrix.
Function definition example:
void cp2k_get_version | ( | char * | version_str, |
int | str_length | ||
) |
Get the CP2K version string.
version_str | The buffer to write the version string into |
str_length | The size of the buffer (must be large enough) |
void cp2k_init | ( | ) |
Initialize CP2K and MPI.
void cp2k_init_without_mpi | ( | ) |
Initialize CP2K without initializing MPI.
void cp2k_finalize | ( | ) |
Finalize CP2K and MPI.
void cp2k_finalize_without_mpi | ( | ) |
Finalize CP2K and without finalizing MPI.
void cp2k_create_force_env | ( | force_env_t * | new_force_env, |
const char * | input_file_path, | ||
const char * | output_file_path | ||
) |
Create a new force environment.
new_force_env | the created force environment |
input_file_path | Path to a CP2K input file |
output_file_path | Path to a file where CP2K is going to append its output (created if non-existent) |
void cp2k_create_force_env_comm | ( | force_env_t * | new_force_env, |
const char * | input_file_path, | ||
const char * | output_file_path, | ||
int | mpi_comm | ||
) |
Create a new force environment (custom managed MPI)
new_force_env | the created force environment |
input_file_path | Path to a CP2K input file |
output_file_path | Path to a file where CP2K is will write its output. Will be created if not existent, otherwise appended. |
mpi_comm | Fortran MPI communicator if MPI is not managed by CP2K |
void cp2k_destroy_force_env | ( | force_env_t | force_env | ) |
Destroy/cleanup a force environment.
force_env | the force environment |
void cp2k_set_positions | ( | force_env_t | force_env, |
const double * | new_pos, | ||
int | n_el | ||
) |
Set positions of the particles.
force_env | the force environment |
new_pos | Array containing the new positions of the particles |
n_el | Size of the new_pos array |
void cp2k_set_velocities | ( | force_env_t | force_env, |
const double * | new_vel, | ||
int | n_el | ||
) |
Set velocity of the particles.
force_env | the force environment |
new_vel | Array containing the new velocities of the particles |
n_el | Size of the new_vel array |
void cp2k_set_cell | ( | force_env_t | force_env, |
const double * | new_cell | ||
) |
Set the size of the cell.
force_env | the force environment |
new_cell | Array containing the new cell |
void cp2k_get_result | ( | force_env_t | force_env, |
const char * | description, | ||
double * | result, | ||
int | n_el | ||
) |
Get an arbitrary result as 1D array from CP2K.
force_env | the force environment |
description | The string tag of the result |
results | Pre-allocated array |
n_el | size of the results array |
void cp2k_get_natom | ( | force_env_t | force_env, |
int * | natom | ||
) |
Get the number of atoms.
force_env | the force environment |
natom | The number of atoms |
void cp2k_get_nparticle | ( | force_env_t | force_env, |
int * | nparticle | ||
) |
Get the number of particles.
force_env | the force environment |
nparticle | The number of particles |
void cp2k_get_positions | ( | force_env_t | force_env, |
double * | pos, | ||
int | n_el | ||
) |
Get the positions of the particles.
force_env | the force environment |
pos | Pre-allocated array of at least 3*nparticle elements. Use cp2k_get_nparticle() to get the number of particles. |
n_el | Size of the force array |
void cp2k_get_forces | ( | force_env_t | force_env, |
double * | force, | ||
int | n_el | ||
) |
Get the forces for the particles.
force_env | the force environment |
force | Pre-allocated array of at least 3*nparticle elements. Use cp2k_get_nparticle() to get the number of particles. |
n_el | Size of the force array |
void cp2k_get_potential_energy | ( | force_env_t | force_env, |
double * | e_pot | ||
) |
Get the potential energy of the system.
force_env | the force environment |
e_pot | The potential energy |
void cp2k_get_cell | ( | force_env_t | force_env, |
const double * | cell | ||
) |
Get the size of the cell.
force_env | the force environment |
cell | Array containing the cell |
void cp2k_get_qmmm_cell | ( | force_env_t | force_env, |
const double * | cell | ||
) |
Get the size of the qmmm cell.
force_env | the force environment |
cell | Array containing the qmmm cell |
void cp2k_calc_energy_force | ( | force_env_t | force_env | ) |
Calculate energy and forces of the system.
force_env | the force environment |
void cp2k_calc_energy | ( | force_env_t | force_env | ) |
Calculate only the energy of the system.
force_env | the force environment |
void cp2k_run_input | ( | const char * | input_file_path, |
const char * | output_file_path | ||
) |
Make a CP2K run with the given input file.
input_file_path | Path to a CP2K input file |
output_file_path | Path to a file where CP2K is going to append its output (created if non-existent) |
void cp2k_run_input_comm | ( | const char * | input_file_path, |
const char * | output_file_path, | ||
int | mpi_comm | ||
) |
Make a CP2K run with the given input file (custom managed MPI)
input_file_path | Path to a CP2K input file |
output_file_path | Path to a file where CP2K is going to append its output (created if non-existent) |
mpi_comm | Fortran MPI communicator if MPI is not managed by CP2K |
void cp2k_transport_set_callback | ( | force_env_t | force_env, |
ext_method_callback_f_ptr | func | ||
) |
Set the function callback for the externally evaluated density matrix.
int cp2k_active_space_get_mo_count | ( | force_env_t | force_env | ) |
Get the number of molecular orbitals in the active space.
force_env | the force environment |
long int cp2k_active_space_get_fock_sub | ( | force_env_t | force_env, |
double * | buf, | ||
long int | buf_len | ||
) |
Get the Fock submatrix for the active space.
force_env | the force environment |
buf | Pre-allocated array of at least mo_count^2 elements. Use cp2k_active_space_get_mo_count() to get the number of molecular orbitals. |
buf_len | Size of the buf array |
long int cp2k_active_space_get_eri_nze_count | ( | force_env_t | force_env | ) |
Get the number of non-zero elements in the ERI matrix.
force_env | the force environment |
int cp2k_active_space_get_eri | ( | force_env_t | force_env, |
int * | buf_coords, | ||
long int | buf_coords_len, | ||
double * | buf_values, | ||
long int | buf_values_len | ||
) |
Get the non-zero elements of the ERI matrix The buf_coords will contain the coordinates in the format [i1, j1, k1, l1, i2, j2, k2, l2, ... ]
.
force_env | the force environment |
buf_coords | Pre-allocated array of at least 4*nze_count elements. Use cp2k_active_space_get_eri_nze_count() to get the number of non-zero elements. |
buf_coords_len | Size of the buf_coords array |
buf_values | Pre-allocated array of at least nze_count elements. Use cp2k_active_space_get_eri_nze_count() to get the number of non-zero elements. |
buf_values_len | Size of the buf_values array |