41#include "../base/base_uses.f90"
46 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .false.
47 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'cell_opt_types'
62 LOGICAL :: keep_angles = .false., &
63 keep_symmetry = .false., &
65 REAL(kind=
dp) :: pres_ext = 0.0_dp, pres_int = 0.0_dp, pres_tol = 0.0_dp, pres_constr = 0.0_dp
66 REAL(kind=
dp),
DIMENSION(3, 3) :: mtrx = 0.0_dp
67 REAL(kind=
dp),
DIMENSION(3, 3) :: rot_matrix = 0.0_dp
87 CHARACTER(LEN=4) :: label
88 INTEGER :: ip, output_unit, required_constraint_id
89 LOGICAL :: constraint_explicit, valid_constraint
90 REAL(kind=
dp),
DIMENSION(3) :: r
96 NULLIFY (cell_env%ref_cell, cell, subsys, particles)
99 CALL cell_clone(cell, cell_env%ref_cell, tag=
"REF_CELL_OPT")
105 i_val=cell_env%constraint_id, explicit=constraint_explicit)
107 IF (count(cell%perd /= 0) == 2)
THEN
109 IF (cell%perd(1) == 0) required_constraint_id =
fix_x
110 IF (cell%perd(2) == 0) required_constraint_id =
fix_y
111 IF (cell%perd(3) == 0) required_constraint_id =
fix_z
113 SELECT CASE (required_constraint_id)
115 valid_constraint = cell_env%constraint_id ==
fix_x .OR. &
116 cell_env%constraint_id ==
fix_xy .OR. &
117 cell_env%constraint_id ==
fix_xz
119 valid_constraint = cell_env%constraint_id ==
fix_y .OR. &
120 cell_env%constraint_id ==
fix_xy .OR. &
121 cell_env%constraint_id ==
fix_yz
123 valid_constraint = cell_env%constraint_id ==
fix_z .OR. &
124 cell_env%constraint_id ==
fix_xz .OR. &
125 cell_env%constraint_id ==
fix_yz
127 valid_constraint = .false.
130 IF (cell_env%constraint_id ==
fix_none .AND. .NOT. constraint_explicit)
THEN
131 cell_env%constraint_id = required_constraint_id
132 CALL cp_warn(__location__, &
133 "2D CELL_OPT: constraining non-periodic cell direction.")
134 ELSE IF (.NOT. valid_constraint)
THEN
135 CALL cp_abort(__location__, &
136 "2D CELL_OPT needs constrained non-periodic cell direction.")
141 cell_env%rot_matrix = matmul(cell_env%ref_cell%hmat, cell%h_inv)
149 DO ip = 1, particles%n_els
150 r = matmul(transpose(cell_env%rot_matrix), particles%els(ip)%r)
151 particles%els(ip)%r = r
158 IF (output_unit > 0)
THEN
159 WRITE (unit=output_unit, fmt=
"(/,T2,A,T61,F20.1)") &
160 "CELL_OPT| Pressure tolerance [bar]: ",
cp_unit_from_cp2k(cell_env%pres_tol,
"bar")
161 IF (cell_env%keep_volume)
THEN
162 WRITE (unit=output_unit, fmt=
"(T2,A,T78,A3)") &
163 "CELL_OPT| Keep volume of cell: ",
"YES"
165 WRITE (unit=output_unit, fmt=
"(T2,A,T78,A3)") &
166 "CELL_OPT| Keep volume of cell: ",
" NO"
168 IF (cell_env%keep_angles)
THEN
169 WRITE (unit=output_unit, fmt=
"(T2,A,T78,A3)") &
170 "CELL_OPT| Keep angles between the cell vectors: ",
"YES"
172 WRITE (unit=output_unit, fmt=
"(T2,A,T78,A3)") &
173 "CELL_OPT| Keep angles between the cell vectors: ",
" NO"
175 IF (cell_env%keep_symmetry)
THEN
176 WRITE (unit=output_unit, fmt=
"(T2,A,T78,A3)") &
177 "CELL_OPT| Keep cell symmetry: ",
"YES"
179 WRITE (unit=output_unit, fmt=
"(T2,A,T78,A3)") &
180 "CELL_OPT| Keep cell symmetry: ",
" NO"
182 SELECT CASE (cell_env%constraint_id)
198 WRITE (unit=output_unit, fmt=
"(T2,A,T77,A4)") &
199 "CELL_OPT| Constraint: ", label
Handles all functions related to the CELL.
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, rot)
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,...
types that represent a subsys, i.e. a part of the system
subroutine, public cp_subsys_get(subsys, ref_count, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell, cell_ref, use_ref_cell)
returns information about various attributes of the given subsys
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
represent a simple array based list of the given type
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...
represents a system: atoms, molecules, their pos,vel,...
wrapper to abstract the force evaluation of the various methods
represent a list of objects