35 molecule_kind_list_type
46 #include "./base/base_uses.f90"
50 PUBLIC :: opt_embed_pot_type, opt_dmfet_pot_type, embed_env_type
59 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
60 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'embed_types'
67 TYPE opt_embed_pot_type
68 TYPE(cp_fm_type),
POINTER :: embed_pot_coef => null(), embed_pot_grad => null(), &
69 prev_step => null(), step => null(), embed_pot_hess => null(), &
70 prev_embed_pot_coef => null(), prev_embed_pot_grad => null(), &
71 prev_embed_pot_hess => null(), kinetic_mat => null()
72 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:) :: w_func, max_diff, int_diff, int_diff_square, &
73 max_grid_step, max_subsys_dens_diff
74 INTEGER :: n_iter = -1, i_iter = -1, dimen_aux = -1, &
75 last_accepted = -1, dimen_var_aux = -1
76 REAL(KIND=
dp) :: lambda = 0.0_dp, allowed_decrease = 0.0_dp, &
77 max_trad = 0.0_dp, min_trad = 0.0_dp, &
78 grad_norm = 0.0_dp, vw_cutoff = 0.0_dp, &
79 vw_smooth_cutoff_range = 0.0_dp, eta = 0.0_dp
80 TYPE(pw_r3d_rs_type),
POINTER :: const_pot => null(), prev_embed_pot => null(), &
81 prev_spin_embed_pot => null(), pot_diff => null()
82 TYPE(pw_r3d_rs_type),
DIMENSION(:),
POINTER :: prev_grid_grad => null(), prev_grid_pot => null(), &
83 prev_subsys_dens => null(), v_w => null()
84 REAL(KIND=
dp) :: reg_term = 0.0_dp, trust_rad = 0.0_dp, &
85 conv_max = 0.0_dp, conv_int = 0.0_dp, &
86 conv_max_spin = 0.0_dp, conv_int_spin = 0.0_dp, step_len = 0.0_dp
87 LOGICAL :: accept_step = .false., newton_step = .false., &
88 level_shift = .false., steep_desc = .false., &
89 add_const_pot = .false., converged = .false., read_embed_pot = .false., &
90 read_embed_pot_cube = .false., change_spin = .false., &
91 open_shell_embed = .false., &
92 grid_opt = .false., leeuwen = .false., fab = .false., &
93 coulomb_guess = .false., fermi_amaldi = .false., &
95 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: all_nspins
96 TYPE(lri_kind_type),
DIMENSION(:),
POINTER :: lri => null()
98 END TYPE opt_embed_pot_type
105 TYPE opt_dmfet_pot_type
106 TYPE(cp_fm_type),
POINTER :: dmfet_pot => null(), dm_1 => null(), dm_2 => null(), &
107 dm_total => null(), dm_diff => null(), &
108 dmfet_pot_beta => null(), dm_total_beta => null(), &
109 dm_diff_beta => null(), dm_subsys => null(), dm_subsys_beta => null()
110 REAL(KIND=
dp) :: trust_rad = 0.0_dp, conv_max = 0.0_dp, &
111 conv_int = 0.0_dp, conv_max_beta = 0.0_dp, &
112 conv_int_beta = 0.0_dp
113 LOGICAL :: accept_step = .false., converged = .false., &
114 read_dmfet_pot = .false., &
115 change_spin = .false., open_shell_embed = .false.
116 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:) :: w_func, max_diff, int_diff
117 INTEGER :: n_iter = -1, i_iter = -1, last_accepted = -1
118 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: all_nspins
120 END TYPE opt_dmfet_pot_type
128 TYPE(cell_type),
POINTER :: cell_ref => null()
129 TYPE(mp_para_env_type),
POINTER :: para_env => null()
130 TYPE(cp_subsys_type),
POINTER :: subsys => null()
131 TYPE(section_vals_type),
POINTER :: input => null()
132 REAL(KIND=
dp),
DIMENSION(:),
POINTER :: energies => null()
134 INTEGER :: ngroups = -1
135 INTEGER,
DIMENSION(:),
POINTER :: group_distribution => null()
136 TYPE(mp_para_env_p_type),
DIMENSION(:),
POINTER :: sub_para_env => null()
137 TYPE(cp_logger_p_type),
DIMENSION(:),
POINTER :: sub_logger => null()
139 REAL(KIND=
dp) :: pot_energy = 0.0_dp
140 END TYPE embed_env_type
163 local_particles, local_molecules, molecule_kind_set, &
164 molecule_set, cell, cell_ref, &
165 para_env, sub_para_env, subsys, &
166 input, results, pot_energy)
168 TYPE(embed_env_type),
INTENT(IN) :: embed_env
169 TYPE(atomic_kind_type),
OPTIONAL,
POINTER :: atomic_kind_set(:)
170 TYPE(particle_type),
OPTIONAL,
POINTER :: particle_set(:)
171 TYPE(distribution_1d_type),
OPTIONAL,
POINTER :: local_particles, local_molecules
172 TYPE(molecule_kind_type),
OPTIONAL,
POINTER :: molecule_kind_set(:)
173 TYPE(molecule_type),
OPTIONAL,
POINTER :: molecule_set(:)
174 TYPE(cell_type),
OPTIONAL,
POINTER :: cell, cell_ref
175 TYPE(mp_para_env_type),
OPTIONAL,
POINTER :: para_env
176 TYPE(mp_para_env_p_type),
DIMENSION(:),
OPTIONAL, &
177 POINTER :: sub_para_env
178 TYPE(cp_subsys_type),
OPTIONAL,
POINTER :: subsys
179 TYPE(section_vals_type),
OPTIONAL,
POINTER :: input
180 TYPE(cp_result_type),
OPTIONAL,
POINTER :: results
181 REAL(kind=
dp),
OPTIONAL :: pot_energy
183 TYPE(atomic_kind_list_type),
POINTER :: atomic_kinds
184 TYPE(molecule_kind_list_type),
POINTER :: molecule_kinds
185 TYPE(molecule_list_type),
POINTER :: molecules
186 TYPE(particle_list_type),
POINTER :: particles
188 NULLIFY (atomic_kinds, particles, molecules, molecule_kinds)
189 cpassert(
ASSOCIATED(embed_env%subsys))
191 IF (
PRESENT(input)) input => embed_env%input
192 IF (
PRESENT(cell_ref)) cell_ref => embed_env%cell_ref
193 IF (
PRESENT(para_env)) para_env => embed_env%para_env
194 IF (
PRESENT(sub_para_env)) sub_para_env => embed_env%sub_para_env
195 IF (
PRESENT(subsys)) subsys => embed_env%subsys
197 atomic_kinds=atomic_kinds, &
198 local_molecules=local_molecules, &
199 local_particles=local_particles, &
200 particles=particles, &
201 molecule_kinds=molecule_kinds, &
202 molecules=molecules, &
205 IF (
PRESENT(atomic_kind_set)) atomic_kind_set => atomic_kinds%els
206 IF (
PRESENT(particle_set)) particle_set => particles%els
207 IF (
PRESENT(molecule_kind_set)) molecule_kind_set => molecule_kinds%els
208 IF (
PRESENT(molecule_set)) molecule_set => molecules%els
209 IF (
PRESENT(pot_energy)) pot_energy = embed_env%pot_energy
228 local_particles, local_molecules, molecule_kind_set, &
229 molecule_set, cell_ref, subsys, &
232 TYPE(embed_env_type),
INTENT(INOUT) :: embed_env
233 TYPE(atomic_kind_type),
OPTIONAL,
POINTER :: atomic_kind_set(:)
234 TYPE(particle_type),
OPTIONAL,
POINTER :: particle_set(:)
235 TYPE(distribution_1d_type),
OPTIONAL,
POINTER :: local_particles, local_molecules
236 TYPE(molecule_kind_type),
OPTIONAL,
POINTER :: molecule_kind_set(:)
237 TYPE(molecule_type),
OPTIONAL,
POINTER :: molecule_set(:)
238 TYPE(cell_type),
OPTIONAL,
POINTER :: cell_ref
239 TYPE(cp_subsys_type),
OPTIONAL,
POINTER :: subsys
240 TYPE(section_vals_type),
OPTIONAL,
POINTER :: input
241 TYPE(mp_para_env_p_type),
DIMENSION(:),
OPTIONAL, &
242 POINTER :: sub_para_env
244 TYPE(atomic_kind_list_type),
POINTER :: atomic_kinds
245 TYPE(molecule_kind_list_type),
POINTER :: molecule_kinds
246 TYPE(molecule_list_type),
POINTER :: molecules
247 TYPE(particle_list_type),
POINTER :: particles
249 IF (
PRESENT(cell_ref))
THEN
252 embed_env%cell_ref => cell_ref
254 IF (
PRESENT(input))
THEN
257 embed_env%input => input
259 IF (
PRESENT(subsys))
THEN
260 IF (
ASSOCIATED(embed_env%subsys))
THEN
261 IF (.NOT.
ASSOCIATED(embed_env%subsys, subsys))
THEN
265 embed_env%subsys => subsys
267 IF (
PRESENT(sub_para_env))
THEN
268 embed_env%sub_para_env => sub_para_env
270 IF (
PRESENT(atomic_kind_set))
THEN
272 els_ptr=atomic_kind_set)
274 atomic_kinds=atomic_kinds)
277 IF (
PRESENT(particle_set))
THEN
279 els_ptr=particle_set)
284 IF (
PRESENT(local_particles))
THEN
286 local_particles=local_particles)
288 IF (
PRESENT(local_molecules))
THEN
290 local_molecules=local_molecules)
292 IF (
PRESENT(molecule_kind_set))
THEN
294 CALL cp_subsys_set(embed_env%subsys, molecule_kinds=molecule_kinds)
297 IF (
PRESENT(molecule_set))
THEN
312 TYPE(embed_env_type),
INTENT(OUT) :: embed_env
313 TYPE(mp_para_env_type),
INTENT(IN),
TARGET :: para_env
315 embed_env%para_env => para_env
316 CALL embed_env%para_env%retain()
326 TYPE(embed_env_type),
INTENT(INOUT) :: embed_env
328 INTEGER :: i, ngroups
330 ngroups = embed_env%ngroups
332 IF (
ASSOCIATED(embed_env%sub_para_env(i)%para_env))
THEN
337 DEALLOCATE (embed_env%sub_para_env)
338 DEALLOCATE (embed_env%sub_logger)
339 DEALLOCATE (embed_env%energies)
344 IF (
ASSOCIATED(embed_env%group_distribution))
THEN
345 DEALLOCATE (embed_env%group_distribution)
represent a simple array based list of the given type
subroutine, public atomic_kind_list_release(list)
releases a list (see doc/ReferenceCounting.html)
subroutine, public atomic_kind_list_create(list, els_ptr, owns_els, n_els)
creates a list
Define the atomic kind types and their sub types.
Handles all functions related to the CELL.
subroutine, public cell_release(cell)
releases the given cell (see doc/ReferenceCounting.html)
subroutine, public cell_retain(cell)
retains the given cell (see doc/ReferenceCounting.html)
represent a full matrix distributed on many processors
various routines to log and control the output. The idea is that decisions about where to log should ...
subroutine, public cp_logger_release(logger)
releases this logger
set of type/routines to handle the storage of results in force_envs
types that represent a subsys, i.e. a part of the system
subroutine, public cp_subsys_release(subsys)
releases a subsys (see doc/ReferenceCounting.html)
subroutine, public cp_subsys_set(subsys, atomic_kinds, particles, local_particles, molecules, molecule_kinds, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, results, cell)
sets various propreties of the subsys
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)
returns information about various attributes of the given subsys
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
subroutine, public get_embed_env(embed_env, atomic_kind_set, particle_set, local_particles, local_molecules, molecule_kind_set, molecule_set, cell, cell_ref, para_env, sub_para_env, subsys, input, results, pot_energy)
Get the embed environment.
subroutine, public embed_env_create(embed_env, para_env)
...
subroutine, public set_embed_env(embed_env, atomic_kind_set, particle_set, local_particles, local_molecules, molecule_kind_set, molecule_set, cell_ref, subsys, input, sub_para_env)
...
subroutine, public embed_env_release(embed_env)
...
Defines the basic variable types.
integer, parameter, public dp
contains the types and subroutines for dealing with the lri_env lri : local resolution of the identit...
Interface to the message passing library MPI.
subroutine, public mp_para_env_release(para_env)
releases the para object (to be called when you don't want anymore the shared copy of this object)
represent a simple array based list of the given type
subroutine, public molecule_kind_list_create(list, els_ptr, owns_els, n_els)
creates a list
subroutine, public molecule_kind_list_release(list)
releases a list (see doc/ReferenceCounting.html)
Define the molecule kind structure types and the corresponding functionality.
represent a simple array based list of the given type
subroutine, public molecule_list_create(list, els_ptr, owns_els, n_els)
creates a list
subroutine, public molecule_list_release(list)
releases a list (see doc/ReferenceCounting.html)
Define the data structure for the molecule information.
represent a simple array based list of the given type
subroutine, public particle_list_create(list, els_ptr, owns_els, n_els)
creates a list
subroutine, public particle_list_release(list)
releases a list (see doc/ReferenceCounting.html)
Define the data structure for the particle information.