32#include "./base/base_uses.f90"
64 TYPE becke_vector_buffer
65 LOGICAL :: store_vectors = .false.
66 REAL(kind=
dp),
ALLOCATABLE, &
67 DIMENSION(:) :: distances
68 REAL(kind=
dp),
ALLOCATABLE, &
69 DIMENSION(:, :) :: distance_vecs, &
72 REAL(kind=
dp),
ALLOCATABLE, &
73 DIMENSION(:, :, :) :: pair_dist_vecs
74 END TYPE becke_vector_buffer
77 INTEGER :: cavity_shape = -1, cutoff_type = -1, &
78 confine_bounds(2) = -1
79 LOGICAL :: in_memory = .false., &
80 adjust = .false., cavity_confine = .false., &
81 should_skip = .false., print_cavity = .false., &
83 REAL(kind=
dp) :: rglobal = -1.0_dp, &
84 rcavity = -1.0_dp, eps_cavity = -1.0_dp
85 REAL(kind=
dp),
DIMENSION(:),
POINTER :: cutoffs => null(), cutoffs_tmp => null(), &
86 radii_tmp => null(), radii => null()
87 REAL(kind=
dp),
POINTER, &
88 DIMENSION(:, :) :: aij => null()
89 REAL(kind=
dp),
POINTER, &
90 DIMENSION(:, :, :) :: cavity_mat => null()
91 TYPE(becke_vector_buffer) :: vector_buffer = becke_vector_buffer()
111 INTEGER :: gaussian_shape = -1, shape_function = -1, atoms_memory = -1
112 LOGICAL :: use_bohr = .false., print_density = .false., use_atomic_cutoff = .false.
113 REAL(kind=
dp) :: radius = -1.0_dp, eps_cutoff = -1.0_dp, atomic_cutoff = -1.0_dp
114 REAL(kind=
dp),
DIMENSION(:),
POINTER :: radii => null()
188 INTEGER,
POINTER,
DIMENSION(:) :: atoms => null()
190 INTEGER :: constraint_type = -1
192 LOGICAL :: is_fragment_constraint = .false.
195 REAL(kind=
dp),
ALLOCATABLE, &
196 DIMENSION(:, :) :: d_sum_const_dr
198 REAL(kind=
dp),
POINTER,
DIMENSION(:) :: coeff => null()
200 REAL(kind=
dp),
POINTER, &
201 DIMENSION(:, :) :: integrated => null()
203 REAL(kind=
dp),
POINTER, &
204 DIMENSION(:, :, :, :) :: gradients => null()
205 REAL(kind=
dp),
POINTER, &
206 DIMENSION(:, :, :, :) :: gradients_x => null()
207 REAL(kind=
dp),
POINTER, &
208 DIMENSION(:, :, :, :) :: gradients_y => null()
209 REAL(kind=
dp),
POINTER, &
210 DIMENSION(:, :, :, :) :: gradients_z => null()
220 CHARACTER(LEN=default_path_length) :: fragment_a_fname =
"", &
221 fragment_b_fname =
"", &
222 fragment_a_spin_fname =
"", &
223 fragment_b_spin_fname =
""
224 INTEGER :: ref_count = -1, total_steps = -1,
TYPE = -1, &
225 precond_freq = -1, nreused = -1, max_reuse = -1, &
226 purge_freq = -1, nbad_conv = -1, purge_offset = -1, &
227 istep = -1, ienergy = -1, natoms = -1
228 INTEGER,
POINTER,
DIMENSION(:) :: atoms => null()
229 LOGICAL :: need_pot = .false., save_pot = .false., do_et = .false., &
230 reuse_precond = .false., purge_history = .false., &
231 should_purge = .false., calculate_metric = .false., &
233 fragments_integrated = .false., flip_fragment(2) = .false., &
234 transfer_pot = .false., external_control = .false., &
235 first_iteration = .false., print_weight = .false., in_memory = .false.
236 LOGICAL,
POINTER,
DIMENSION(:) :: is_constraint => null()
237 REAL(kind=
dp),
DIMENSION(:),
POINTER :: strength => null(),
TARGET => null(),
value => null()
238 REAL(kind=
dp),
POINTER, &
239 DIMENSION(:, :) :: charges_fragment => null()
242 DIMENSION(:) :: group => null()
244 DIMENSION(:) :: occupations
246 POINTER :: mo_coeff => null()
249 POINTER :: wmat => null(), matrix_p => null()
251 POINTER :: hirshfeld_control => null()
254 DIMENSION(:) :: charge => null()
256 DIMENSION(:, :) :: fragments => null()
261 CHARACTER(len=*),
PARAMETER,
PRIVATE :: modulen =
'qs_cdft_types'
283 SUBROUTINE becke_control_create(becke_control)
286 becke_control%adjust = .false.
288 becke_control%cavity_confine = .false.
289 becke_control%should_skip = .false.
290 becke_control%print_cavity = .false.
291 becke_control%in_memory = .false.
292 becke_control%use_bohr = .false.
293 becke_control%confine_bounds = 0
294 becke_control%rcavity = 3.0_dp
295 becke_control%rglobal = 6.0_dp
296 becke_control%eps_cavity = 1.0e-6_dp
298 becke_control%vector_buffer%store_vectors = .true.
299 NULLIFY (becke_control%aij)
300 NULLIFY (becke_control%cavity_mat)
301 NULLIFY (becke_control%cavity_env)
302 NULLIFY (becke_control%cutoffs)
303 NULLIFY (becke_control%cutoffs_tmp)
304 NULLIFY (becke_control%radii)
305 NULLIFY (becke_control%radii_tmp)
306 END SUBROUTINE becke_control_create
314 SUBROUTINE becke_control_release(becke_control)
317 IF (becke_control%vector_buffer%store_vectors)
THEN
318 IF (
ALLOCATED(becke_control%vector_buffer%distances))
THEN
319 DEALLOCATE (becke_control%vector_buffer%distances)
321 IF (
ALLOCATED(becke_control%vector_buffer%distance_vecs))
THEN
322 DEALLOCATE (becke_control%vector_buffer%distance_vecs)
324 IF (
ALLOCATED(becke_control%vector_buffer%position_vecs))
THEN
325 DEALLOCATE (becke_control%vector_buffer%position_vecs)
327 IF (
ALLOCATED(becke_control%vector_buffer%R12))
THEN
328 DEALLOCATE (becke_control%vector_buffer%R12)
330 IF (
ALLOCATED(becke_control%vector_buffer%pair_dist_vecs))
THEN
331 DEALLOCATE (becke_control%vector_buffer%pair_dist_vecs)
334 IF (
ASSOCIATED(becke_control%cutoffs))
THEN
335 DEALLOCATE (becke_control%cutoffs)
337 IF (
ASSOCIATED(becke_control%cutoffs_tmp))
THEN
338 DEALLOCATE (becke_control%cutoffs_tmp)
340 IF (
ASSOCIATED(becke_control%radii_tmp))
THEN
341 DEALLOCATE (becke_control%radii_tmp)
343 IF (
ASSOCIATED(becke_control%radii))
THEN
344 DEALLOCATE (becke_control%radii)
346 IF (
ASSOCIATED(becke_control%aij))
THEN
347 DEALLOCATE (becke_control%aij)
349 IF (
ASSOCIATED(becke_control%cavity_mat))
THEN
350 DEALLOCATE (becke_control%cavity_mat)
352 IF (becke_control%cavity_confine)
THEN
356 END SUBROUTINE becke_control_release
367 cdft_control%total_steps = 0
368 NULLIFY (cdft_control%strength)
369 NULLIFY (cdft_control%target)
370 NULLIFY (cdft_control%value)
371 NULLIFY (cdft_control%atoms)
372 NULLIFY (cdft_control%is_constraint)
373 NULLIFY (cdft_control%charges_fragment)
374 NULLIFY (cdft_control%fragments)
375 NULLIFY (cdft_control%group)
376 NULLIFY (cdft_control%charge)
377 cdft_control%natoms = 0
379 cdft_control%need_pot = .true.
380 cdft_control%save_pot = .false.
381 cdft_control%transfer_pot = .false.
382 cdft_control%atomic_charges = .false.
383 cdft_control%first_iteration = .true.
384 cdft_control%fragment_density = .false.
385 cdft_control%fragments_integrated = .false.
386 cdft_control%flip_fragment = .false.
387 cdft_control%external_control = .false.
388 cdft_control%do_et = .false.
389 cdft_control%reuse_precond = .false.
390 cdft_control%nreused = 0
391 cdft_control%precond_freq = 0
392 cdft_control%max_reuse = 0
393 cdft_control%should_purge = .false.
394 cdft_control%purge_history = .false.
395 cdft_control%calculate_metric = .false.
396 cdft_control%in_memory = .false.
397 cdft_control%purge_freq = 0
398 cdft_control%nbad_conv = 0
399 cdft_control%purge_offset = 0
400 cdft_control%istep = 0
401 cdft_control%ienergy = 0
402 NULLIFY (cdft_control%becke_control)
403 ALLOCATE (cdft_control%becke_control)
404 CALL becke_control_create(cdft_control%becke_control)
405 NULLIFY (cdft_control%hirshfeld_control)
406 ALLOCATE (cdft_control%hirshfeld_control)
407 CALL hirshfeld_control_create(cdft_control%hirshfeld_control)
408 NULLIFY (cdft_control%wmat)
409 NULLIFY (cdft_control%matrix_s%matrix)
410 NULLIFY (cdft_control%mo_coeff)
411 NULLIFY (cdft_control%matrix_p)
413 cdft_control%ot_control%have_scf = .false.
414 cdft_control%ot_control%max_scf = 0
415 cdft_control%ot_control%eps_scf = 0.0_dp
416 cdft_control%ot_control%step_size = 0.0_dp
417 cdft_control%ot_control%type = -1
418 cdft_control%ot_control%optimizer = -1
419 cdft_control%ot_control%diis_buffer_length = -1
420 NULLIFY (cdft_control%ot_control%cdft_opt_control)
421 cdft_control%constraint_control%have_scf = .false.
422 cdft_control%constraint_control%max_scf = 0
423 cdft_control%constraint_control%eps_scf = 0.0_dp
424 cdft_control%constraint_control%step_size = 0.0_dp
425 cdft_control%constraint_control%type = -1
426 cdft_control%constraint_control%optimizer = -1
427 cdft_control%constraint_control%diis_buffer_length = -1
428 NULLIFY (cdft_control%constraint_control%cdft_opt_control)
429 cdft_control%constraint%iter_count = 0
430 NULLIFY (cdft_control%constraint%variables)
431 NULLIFY (cdft_control%constraint%gradient)
432 NULLIFY (cdft_control%constraint%energy)
433 NULLIFY (cdft_control%constraint%count)
434 NULLIFY (cdft_control%constraint%inv_jacobian)
435 cdft_control%constraint%deallocate_jacobian = .true.
450 IF (
ASSOCIATED(cdft_control%atoms))
THEN
451 DEALLOCATE (cdft_control%atoms)
453 IF (
ASSOCIATED(cdft_control%strength))
THEN
454 DEALLOCATE (cdft_control%strength)
456 IF (
ASSOCIATED(cdft_control%target))
THEN
457 DEALLOCATE (cdft_control%target)
459 IF (
ASSOCIATED(cdft_control%value))
THEN
460 DEALLOCATE (cdft_control%value)
462 IF (
ASSOCIATED(cdft_control%charges_fragment))
THEN
463 DEALLOCATE (cdft_control%charges_fragment)
465 IF (
ASSOCIATED(cdft_control%fragments))
THEN
466 DEALLOCATE (cdft_control%fragments)
468 IF (
ASSOCIATED(cdft_control%is_constraint))
THEN
469 DEALLOCATE (cdft_control%is_constraint)
471 IF (
ASSOCIATED(cdft_control%charge))
THEN
472 DEALLOCATE (cdft_control%charge)
475 IF (
ASSOCIATED(cdft_control%group))
THEN
476 DO i = 1,
SIZE(cdft_control%group)
477 IF (
ASSOCIATED(cdft_control%group(i)%atoms))
THEN
478 DEALLOCATE (cdft_control%group(i)%atoms)
480 IF (
ASSOCIATED(cdft_control%group(i)%coeff))
THEN
481 DEALLOCATE (cdft_control%group(i)%coeff)
483 IF (
ALLOCATED(cdft_control%group(i)%d_sum_const_dR))
THEN
484 DEALLOCATE (cdft_control%group(i)%d_sum_const_dR)
487 IF (
ASSOCIATED(cdft_control%group(i)%gradients))
THEN
488 DEALLOCATE (cdft_control%group(i)%gradients)
491 IF (
ASSOCIATED(cdft_control%group(i)%gradients_x))
THEN
492 DEALLOCATE (cdft_control%group(i)%gradients_x)
494 IF (
ASSOCIATED(cdft_control%group(i)%gradients_y))
THEN
495 DEALLOCATE (cdft_control%group(i)%gradients_y)
497 IF (
ASSOCIATED(cdft_control%group(i)%gradients_z))
THEN
498 DEALLOCATE (cdft_control%group(i)%gradients_z)
501 IF (
ASSOCIATED(cdft_control%group(i)%integrated))
THEN
502 DEALLOCATE (cdft_control%group(i)%integrated)
505 DEALLOCATE (cdft_control%group)
508 IF (
ASSOCIATED(cdft_control%becke_control))
THEN
509 CALL becke_control_release(cdft_control%becke_control)
510 DEALLOCATE (cdft_control%becke_control)
512 IF (
ASSOCIATED(cdft_control%hirshfeld_control))
THEN
513 CALL hirshfeld_control_release(cdft_control%hirshfeld_control)
514 DEALLOCATE (cdft_control%hirshfeld_control)
519 IF (
ASSOCIATED(cdft_control%constraint%variables))
THEN
520 DEALLOCATE (cdft_control%constraint%variables)
522 IF (
ASSOCIATED(cdft_control%constraint%count))
THEN
523 DEALLOCATE (cdft_control%constraint%count)
525 IF (
ASSOCIATED(cdft_control%constraint%gradient))
THEN
526 DEALLOCATE (cdft_control%constraint%gradient)
528 IF (
ASSOCIATED(cdft_control%constraint%energy))
THEN
529 DEALLOCATE (cdft_control%constraint%energy)
531 IF (
ASSOCIATED(cdft_control%constraint%inv_jacobian))
THEN
532 DEALLOCATE (cdft_control%constraint%inv_jacobian)
535 IF (
ALLOCATED(cdft_control%occupations))
THEN
536 DO i = 1,
SIZE(cdft_control%occupations)
537 IF (
ASSOCIATED(cdft_control%occupations(i)%array))
THEN
538 DEALLOCATE (cdft_control%occupations(i)%array)
541 DEALLOCATE (cdft_control%occupations)
554 SUBROUTINE hirshfeld_control_create(hirshfeld_control)
557 hirshfeld_control%use_bohr = .false.
558 hirshfeld_control%print_density = .false.
559 hirshfeld_control%use_atomic_cutoff = .true.
560 hirshfeld_control%radius = 3.0_dp
561 hirshfeld_control%eps_cutoff = 1.0e-12_dp
562 hirshfeld_control%atomic_cutoff = 1.0e-12_dp
564 hirshfeld_control%atoms_memory = 80
566 NULLIFY (hirshfeld_control%hirshfeld_env)
567 NULLIFY (hirshfeld_control%radii)
569 END SUBROUTINE hirshfeld_control_create
577 SUBROUTINE hirshfeld_control_release(hirshfeld_control)
580 IF (
ASSOCIATED(hirshfeld_control%radii))
THEN
581 DEALLOCATE (hirshfeld_control%radii)
585 END SUBROUTINE hirshfeld_control_release
simple routine to print charges for all atomic charge methods (currently mulliken,...
various utilities that regard array of different kinds: output, allocation,... maybe it is not a good...
represent a full matrix distributed on many processors
The types needed for the calculation of Hirshfeld charges and related functions.
subroutine, public release_hirshfeld_type(hirshfeld_env)
...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_path_length
parameters that control the outer loop of an SCF iteration
Control parameters for optimizers that work with CDFT constraints.
subroutine, public cdft_opt_type_release(cdft_opt_control)
releases the CDFT optimizer control object
Defines CDFT control structures.
subroutine, public cdft_control_release(cdft_control)
release the cdft_control_type
subroutine, public cdft_control_create(cdft_control)
create the cdft_control_type
represent a pointer to a 1d array
quantities needed for a Hirshfeld based partitioning of real space
contains the parameters needed by a scf run
control parameters for CDFT simulations