39#include "../base/base_uses.f90"
44 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .false.
45 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'cell_opt_types'
60 LOGICAL :: keep_angles = .false., &
61 keep_symmetry = .false., &
63 REAL(kind=
dp) :: pres_ext = 0.0_dp, pres_int = 0.0_dp, pres_tol = 0.0_dp, pres_constr = 0.0_dp
64 REAL(kind=
dp),
DIMENSION(3, 3) :: mtrx = 0.0_dp
67 REAL(kind=
dp),
DIMENSION(3, 3) :: input_to_opt = 0.0_dp, &
88 CHARACTER(LEN=4) :: label
89 INTEGER :: output_unit, required_constraint_id
90 LOGICAL :: constraint_explicit, valid_constraint
94 NULLIFY (cell_env%opt_cell, cell)
97 CALL cell_clone(cell, cell_env%opt_cell, tag=
"CELL_OPT_CANONICAL")
101 cell_env%input_to_opt = matmul(cell_env%opt_cell%hmat, cell%h_inv)
102 cell_env%opt_to_input = matmul(cell%hmat, cell_env%opt_cell%h_inv)
108 i_val=cell_env%constraint_id, explicit=constraint_explicit)
109 IF (count(cell%perd /= 0) == 2)
THEN
111 IF (cell%perd(1) == 0) required_constraint_id =
fix_x
112 IF (cell%perd(2) == 0) required_constraint_id =
fix_y
113 IF (cell%perd(3) == 0) required_constraint_id =
fix_z
115 SELECT CASE (required_constraint_id)
117 valid_constraint = cell_env%constraint_id ==
fix_x .OR. &
118 cell_env%constraint_id ==
fix_xy .OR. &
119 cell_env%constraint_id ==
fix_xz
121 valid_constraint = cell_env%constraint_id ==
fix_y .OR. &
122 cell_env%constraint_id ==
fix_xy .OR. &
123 cell_env%constraint_id ==
fix_yz
125 valid_constraint = cell_env%constraint_id ==
fix_z .OR. &
126 cell_env%constraint_id ==
fix_xz .OR. &
127 cell_env%constraint_id ==
fix_yz
129 valid_constraint = .false.
132 IF (cell_env%constraint_id ==
fix_none .AND. .NOT. constraint_explicit)
THEN
133 cell_env%constraint_id = required_constraint_id
134 CALL cp_warn(__location__, &
135 "2D CELL_OPT: constraining non-periodic cell direction.")
136 ELSE IF (.NOT. valid_constraint)
THEN
137 CALL cp_abort(__location__, &
138 "2D CELL_OPT needs constrained non-periodic cell direction.")
144 cell_env%mtrx, cell_env%input_to_opt)
150 IF (output_unit > 0)
THEN
151 WRITE (unit=output_unit, fmt=
"(/,T2,A,T61,F20.1)") &
152 "CELL_OPT| Pressure tolerance [bar]: ",
cp_unit_from_cp2k(cell_env%pres_tol,
"bar")
153 IF (cell_env%keep_volume)
THEN
154 WRITE (unit=output_unit, fmt=
"(T2,A,T78,A3)") &
155 "CELL_OPT| Keep volume of cell: ",
"YES"
157 WRITE (unit=output_unit, fmt=
"(T2,A,T78,A3)") &
158 "CELL_OPT| Keep volume of cell: ",
" NO"
160 IF (cell_env%keep_angles)
THEN
161 WRITE (unit=output_unit, fmt=
"(T2,A,T78,A3)") &
162 "CELL_OPT| Keep angles between the cell vectors: ",
"YES"
164 WRITE (unit=output_unit, fmt=
"(T2,A,T78,A3)") &
165 "CELL_OPT| Keep angles between the cell vectors: ",
" NO"
167 IF (cell_env%keep_symmetry)
THEN
168 WRITE (unit=output_unit, fmt=
"(T2,A,T78,A3)") &
169 "CELL_OPT| Keep cell symmetry: ",
"YES"
171 WRITE (unit=output_unit, fmt=
"(T2,A,T78,A3)") &
172 "CELL_OPT| Keep cell symmetry: ",
" NO"
174 SELECT CASE (cell_env%constraint_id)
190 WRITE (unit=output_unit, fmt=
"(T2,A,T77,A4)") &
191 "CELL_OPT| Constraint: ", label
Handles all functions related to the CELL.
subroutine, public canonicalize_cell_matrix(cell)
Canonicalize a general cell matrix without changing lengths and angles.
subroutine, public cell_create(cell, hmat, periodic, tag)
allocates and initializes a cell
Contains type used for a Simulation Cell Optimization.
subroutine, public cell_opt_env_release(cell_env)
...
subroutine, public cell_opt_env_create(cell_env, force_env, geo_section)
...
contains a functional that calculates the energy and its derivatives for the geometry optimizer
subroutine, public read_external_press_tensor(geo_section, cell, pres_ext, mtrx, input_to_opt)
Reads the external pressure tensor.
Handles all functions related to the CELL.
subroutine, public cell_release(cell)
releases the given cell (see doc/ReferenceCounting.html)
subroutine, public cell_clone(cell_in, cell_out, tag)
Clone cell variable.
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
real(kind=dp) function, public cp_unit_from_cp2k(value, unit_str, defaults, power)
converts from the internal cp2k units to the given unit
Interface for the force calculations.
recursive subroutine, public force_env_get(force_env, in_use, fist_env, qs_env, meta_env, fp_env, subsys, para_env, potential_energy, additional_potential, kinetic_energy, harmonic_shell, kinetic_shell, cell, sub_force_env, qmmm_env, qmmmx_env, eip_env, pwdft_env, globenv, input, force_env_section, method_name_id, root_section, mixed_env, nnp_env, embed_env, ipi_env)
returns various attributes about the force environment
Defines the basic variable types.
integer, parameter, public dp
Type containing all informations abour the simulation cell optimization.
Type defining parameters related to the simulation cell.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
wrapper to abstract the force evaluation of the various methods