![]() |
(git:5f3bc36)
|
interface to use cp2k as library More...
Data Types | |
| type | f_env_type |
Functions/Subroutines | |
| subroutine, public | init_cp2k (init_mpi, ierr, mpi_comm) |
| initializes cp2k, needs to be called once before using any of the other functions when using cp2k as library | |
| subroutine, public | finalize_cp2k (finalize_mpi, ierr) |
| cleanup after you have finished using this interface | |
| subroutine, public | f_env_get_from_id (f_env_id, f_env) |
| ... | |
| subroutine, public | f_env_add_defaults (f_env_id, f_env, handle) |
| adds the default environments of the f_env to the stack of the defaults, and returns a new error and sets failure to true if something went wrong | |
| subroutine, public | f_env_rm_defaults (f_env, ierr, handle) |
| removes the default environments of the f_env to the stack of the defaults, and sets ierr accordingly to the failuers stored in error It also releases the error | |
| recursive subroutine, public | create_force_env (new_env_id, input_declaration, input_path, output_path, mpi_comm, output_unit, owns_out_unit, input, ierr, work_dir, initial_variables) |
| creates a new force environment using the given input, and writing the output to the given output unit | |
| recursive subroutine, public | destroy_force_env (env_id, ierr, q_finalize) |
| deallocates the force_env with the given id | |
| subroutine, public | get_natom (env_id, n_atom, ierr) |
| returns the number of atoms in the given force env | |
| subroutine, public | get_nparticle (env_id, n_particle, ierr) |
| returns the number of particles in the given force env | |
| subroutine, public | get_cell (env_id, cell, per, ierr) |
| gets a cell | |
| subroutine, public | get_qmmm_cell (env_id, cell, ierr) |
| gets the qmmm cell | |
| subroutine, public | get_result_r1 (env_id, description, n, result, res_exist, ierr) |
| gets a result from CP2K that is a real 1D array | |
| subroutine, public | get_force (env_id, frc, n_el, ierr) |
| gets the forces of the particles | |
| subroutine, public | get_stress_tensor (env_id, stress_tensor, ierr) |
| gets the stress tensor | |
| subroutine, public | get_pos (env_id, pos, n_el, ierr) |
| gets the positions of the particles | |
| subroutine, public | set_cell (env_id, new_cell, ierr) |
| sets a new cell | |
| subroutine, public | set_pos (env_id, new_pos, n_el, ierr) |
| sets the positions of the particles | |
| subroutine, public | set_vel (env_id, new_vel, n_el, ierr) |
| sets the velocities of the particles | |
| recursive subroutine, public | calc_energy_force (env_id, calc_force, ierr) |
| updates the energy and the forces of given force_env | |
| subroutine, public | get_energy (env_id, e_pot, ierr) |
| returns the energy of the last configuration calculated | |
| recursive subroutine, public | calc_energy (env_id, pos, n_el, e_pot, ierr) |
| returns the energy of the configuration given by the positions passed as argument | |
| recursive subroutine, public | calc_force (env_id, pos, n_el_pos, e_pot, force, n_el_force, ierr) |
| returns the energy of the configuration given by the positions passed as argument | |
| subroutine, public | check_input (input_declaration, input_file_path, output_file_path, echo_input, mpi_comm, initial_variables, ierr) |
| performs a check of the input | |
Variables | |
| type(f_env_p_type), dimension(:), pointer, save | f_envs |
| type(mp_para_env_type), pointer, save, public | default_para_env |
interface to use cp2k as library
| subroutine, public f77_interface::init_cp2k | ( | logical, intent(in) | init_mpi, |
| integer, intent(out) | ierr, | ||
| type(mp_comm_type), intent(in), optional | mpi_comm | ||
| ) |
initializes cp2k, needs to be called once before using any of the other functions when using cp2k as library
| init_mpi | if the mpi environment should be initialized |
| ierr | returns a number different from 0 if there was an error |
| mpi_comm | an existing mpi communicator (if not given mp_comm_world will be used) |
Definition at line 219 of file f77_interface.F.
| subroutine, public f77_interface::finalize_cp2k | ( | logical, intent(in) | finalize_mpi, |
| integer, intent(out) | ierr | ||
| ) |
cleanup after you have finished using this interface
| finalize_mpi | if the mpi environment should be finalized |
| ierr | returns a number different from 0 if there was an error |
Definition at line 321 of file f77_interface.F.
| subroutine, public f77_interface::f_env_get_from_id | ( | integer, intent(in) | f_env_id, |
| type(f_env_type), pointer | f_env | ||
| ) |
...
| f_env_id | ... |
| f_env | ... |
Definition at line 429 of file f77_interface.F.
| subroutine, public f77_interface::f_env_add_defaults | ( | integer, intent(in) | f_env_id, |
| type(f_env_type), pointer | f_env, | ||
| integer, intent(out), optional | handle | ||
| ) |
adds the default environments of the f_env to the stack of the defaults, and returns a new error and sets failure to true if something went wrong
| f_env_id | the f_env from where to take the defaults |
| f_env | will contain the f_env corresponding to f_env_id |
| handle | ... |
Definition at line 460 of file f77_interface.F.
| subroutine, public f77_interface::f_env_rm_defaults | ( | type(f_env_type), pointer | f_env, |
| integer, intent(out), optional | ierr, | ||
| integer, intent(in), optional | handle | ||
| ) |
removes the default environments of the f_env to the stack of the defaults, and sets ierr accordingly to the failuers stored in error It also releases the error
| f_env | the f_env from where to take the defaults |
| ierr | variable that will be set to a number different from 0 if error contains an error (otherwise it will be set to 0) |
| handle | ... |
Definition at line 504 of file f77_interface.F.
| recursive subroutine, public f77_interface::create_force_env | ( | integer, intent(out) | new_env_id, |
| type(section_type), pointer | input_declaration, | ||
| character(len=*), intent(in) | input_path, | ||
| character(len=*), intent(in), optional | output_path, | ||
| class(mp_comm_type), intent(in), optional | mpi_comm, | ||
| integer, intent(in), optional | output_unit, | ||
| logical, intent(in), optional | owns_out_unit, | ||
| type(section_vals_type), optional, pointer | input, | ||
| integer, intent(out), optional | ierr, | ||
| character(len=*), intent(in), optional | work_dir, | ||
| character(len=*), dimension(:, :), optional | initial_variables | ||
| ) |
creates a new force environment using the given input, and writing the output to the given output unit
| new_env_id | will contain the id of the newly created environment |
| input_declaration | ... |
| input_path | where to read the input (if the input is given it can a virtual path) |
| output_path | filename (or name of the unit) for the output |
| mpi_comm | the mpi communicator to be used for this environment it will not be freed when you get rid of the force_env |
| output_unit | if given it should be the unit for the output and no file is open(should be valid on the processor with rank 0) |
| owns_out_unit | if the output unit should be closed upon destroing of the force_env (defaults to true if not default_output_unit) |
| input | the parsed input, if given and valid it is used instead of parsing from file |
| ierr | will return a number different from 0 if there was an error |
| work_dir | ... |
| initial_variables | key-value list of initial preprocessor variables |
Definition at line 574 of file f77_interface.F.
| recursive subroutine, public f77_interface::destroy_force_env | ( | integer, intent(in) | env_id, |
| integer, intent(out) | ierr, | ||
| logical, intent(in), optional | q_finalize | ||
| ) |
deallocates the force_env with the given id
| env_id | the id of the force_env to remove |
| ierr | will contain a number different from 0 if |
| q_finalize | ... |
Definition at line 970 of file f77_interface.F.
| subroutine, public f77_interface::get_natom | ( | integer, intent(in) | env_id, |
| integer, intent(out) | n_atom, | ||
| integer, intent(out) | ierr | ||
| ) |
returns the number of atoms in the given force env
| env_id | id of the force_env |
| n_atom | ... |
| ierr | will return a number different from 0 if there was an error |
Definition at line 1015 of file f77_interface.F.
| subroutine, public f77_interface::get_nparticle | ( | integer, intent(in) | env_id, |
| integer, intent(out) | n_particle, | ||
| integer, intent(out) | ierr | ||
| ) |
returns the number of particles in the given force env
| env_id | id of the force_env |
| n_particle | ... |
| ierr | will return a number different from 0 if there was an error |
Definition at line 1038 of file f77_interface.F.
| subroutine, public f77_interface::get_cell | ( | integer, intent(in) | env_id, |
| real(kind=dp), dimension(3, 3) | cell, | ||
| integer, dimension(3), optional | per, | ||
| integer, intent(out) | ierr | ||
| ) |
gets a cell
| env_id | id of the force_env |
| cell | the array with the cell matrix |
| per | periodicity |
| ierr | will return a number different from 0 if there was an error |
Definition at line 1061 of file f77_interface.F.
| subroutine, public f77_interface::get_qmmm_cell | ( | integer, intent(in) | env_id, |
| real(kind=dp), dimension(3, 3) | cell, | ||
| integer, intent(out) | ierr | ||
| ) |
gets the qmmm cell
| env_id | id of the force_env |
| cell | the array with the cell matrix |
| ierr | will return a number different from 0 if there was an error |
Definition at line 1089 of file f77_interface.F.
| subroutine, public f77_interface::get_result_r1 | ( | integer | env_id, |
| character(len=default_string_length) | description, | ||
| integer | n, | ||
| real(kind=dp), dimension(1:n) | result, | ||
| logical, optional | res_exist, | ||
| integer | ierr | ||
| ) |
gets a result from CP2K that is a real 1D array
| env_id | id of the force_env |
| description | the tag of the result |
| N | ... |
| RESULT | ... |
| res_exist | ... |
| ierr | will return a number different from 0 if there was an error |
Definition at line 1120 of file f77_interface.F.
| subroutine, public f77_interface::get_force | ( | integer, intent(in) | env_id, |
| real(kind=dp), dimension(1:n_el) | frc, | ||
| integer, intent(in) | n_el, | ||
| integer, intent(out) | ierr | ||
| ) |
gets the forces of the particles
| env_id | id of the force_env |
| frc | the array where to write the forces |
| n_el | number of positions (3*nparticle) just to check |
| ierr | will return a number different from 0 if there was an error |
Definition at line 1165 of file f77_interface.F.
| subroutine, public f77_interface::get_stress_tensor | ( | integer, intent(in) | env_id, |
| real(kind=dp), dimension(3, 3), intent(out) | stress_tensor, | ||
| integer, intent(out) | ierr | ||
| ) |
gets the stress tensor
| env_id | id of the force_env |
| stress_tensor | the array where to write the stress tensor |
| ierr | will return a number different from 0 if there was an error |
Definition at line 1187 of file f77_interface.F.
| subroutine, public f77_interface::get_pos | ( | integer, intent(in) | env_id, |
| real(kind=dp), dimension(1:n_el) | pos, | ||
| integer, intent(in) | n_el, | ||
| integer, intent(out) | ierr | ||
| ) |
gets the positions of the particles
| env_id | id of the force_env |
| pos | the array where to write the positions |
| n_el | number of positions (3*nparticle) just to check |
| ierr | will return a number different from 0 if there was an error |
Definition at line 1220 of file f77_interface.F.
| subroutine, public f77_interface::set_cell | ( | integer, intent(in) | env_id, |
| real(kind=dp), dimension(3, 3) | new_cell, | ||
| integer, intent(out) | ierr | ||
| ) |
sets a new cell
| env_id | id of the force_env |
| new_cell | the array with the cell matrix |
| ierr | will return a number different from 0 if there was an error |
Definition at line 1266 of file f77_interface.F.
| subroutine, public f77_interface::set_pos | ( | integer, intent(in) | env_id, |
| real(kind=dp), dimension(1:n_el) | new_pos, | ||
| integer, intent(in) | n_el, | ||
| integer, intent(out) | ierr | ||
| ) |
sets the positions of the particles
| env_id | id of the force_env |
| new_pos | the array with the new positions |
| n_el | number of positions (3*nparticle) just to check |
| ierr | will return a number different from 0 if there was an error |
Definition at line 1298 of file f77_interface.F.
| subroutine, public f77_interface::set_vel | ( | integer, intent(in) | env_id, |
| real(kind=dp), dimension(1:n_el) | new_vel, | ||
| integer, intent(in) | n_el, | ||
| integer, intent(out) | ierr | ||
| ) |
sets the velocities of the particles
| env_id | id of the force_env |
| new_vel | the array with the new velocities |
| n_el | number of velocities (3*nparticle) just to check |
| ierr | will return a number different from 0 if there was an error |
Definition at line 1325 of file f77_interface.F.
| recursive subroutine, public f77_interface::calc_energy_force | ( | integer, intent(in) | env_id, |
| logical, intent(in) | calc_force, | ||
| integer, intent(out) | ierr | ||
| ) |
updates the energy and the forces of given force_env
| env_id | id of the force_env that you want to update |
| calc_force | if the forces should be updated, if false the forces might be wrong. |
| ierr | will return a number different from 0 if there was an error |
Definition at line 1351 of file f77_interface.F.
| subroutine, public f77_interface::get_energy | ( | integer, intent(in) | env_id, |
| real(kind=dp), intent(out) | e_pot, | ||
| integer, intent(out) | ierr | ||
| ) |
returns the energy of the last configuration calculated
| env_id | id of the force_env that you want to update |
| e_pot | the potential energy of the system |
| ierr | will return a number different from 0 if there was an error |
Definition at line 1376 of file f77_interface.F.
| recursive subroutine, public f77_interface::calc_energy | ( | integer, intent(in) | env_id, |
| real(kind=dp), dimension(1:n_el), intent(in) | pos, | ||
| integer, intent(in) | n_el, | ||
| real(kind=dp), intent(out) | e_pot, | ||
| integer, intent(out) | ierr | ||
| ) |
returns the energy of the configuration given by the positions passed as argument
| env_id | id of the force_env that you want to update |
| pos | array with the positions |
| n_el | number of elements in pos (3*natom) |
| e_pot | the potential energy of the system |
| ierr | will return a number different from 0 if there was an error |
Definition at line 1403 of file f77_interface.F.
| recursive subroutine, public f77_interface::calc_force | ( | integer, intent(in) | env_id, |
| real(kind=dp), dimension(1:n_el_pos), intent(in) | pos, | ||
| integer, intent(in) | n_el_pos, | ||
| real(kind=dp), intent(out) | e_pot, | ||
| real(kind=dp), dimension(1:n_el_force), intent(inout) | force, | ||
| integer, intent(in) | n_el_force, | ||
| integer, intent(out) | ierr | ||
| ) |
returns the energy of the configuration given by the positions passed as argument
| env_id | id of the force_env that you want to update |
| pos | array with the positions |
| n_el_pos | number of elements in pos (3*natom) |
| e_pot | the potential energy of the system |
| force | array that will contain the forces |
| n_el_force | number of elements in force (3*natom). If 0 the forces are not calculated |
| ierr | will return a number different from 0 if there was an error |
Definition at line 1433 of file f77_interface.F.
| subroutine, public f77_interface::check_input | ( | type(section_type), pointer | input_declaration, |
| character(len=*), intent(in) | input_file_path, | ||
| character(len=*), intent(in) | output_file_path, | ||
| logical, intent(in), optional | echo_input, | ||
| type(mp_comm_type), intent(in), optional | mpi_comm, | ||
| character(len=default_path_length), dimension(:, :), intent(in) | initial_variables, | ||
| integer, intent(out) | ierr | ||
| ) |
performs a check of the input
| input_declaration | ... |
| input_file_path | the path of the input file to check |
| output_file_path | path of the output file (to which it is appended) if it is "__STD_OUT__" the default_output_unit is used |
| echo_input | if the parsed input should be written out with all the defaults made explicit |
| mpi_comm | the mpi communicator (if not given it uses the default one) |
| initial_variables | key-value list of initial preprocessor variables |
| ierr | error control, if different from 0 there was an error |
Definition at line 1467 of file f77_interface.F.
| type(f_env_p_type), dimension(:), pointer, save f77_interface::f_envs |
Definition at line 172 of file f77_interface.F.
| type(mp_para_env_type), pointer, save, public f77_interface::default_para_env |
Definition at line 173 of file f77_interface.F.