31#include "./base/base_uses.f90"
65 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_fb_atomic_halo_types'
80 TYPE fb_atomic_halo_data
82 INTEGER :: owner_id_in_halo
85 INTEGER,
DIMENSION(:),
POINTER :: halo_atoms
88 END TYPE fb_atomic_halo_data
95 TYPE(fb_atomic_halo_data),
POINTER,
PRIVATE :: obj
106 TYPE fb_atomic_halo_list_data
108 INTEGER :: max_nhalos
109 TYPE(fb_atomic_halo_obj),
DIMENSION(:),
POINTER :: halos
110 END TYPE fb_atomic_halo_list_data
117 TYPE(fb_atomic_halo_list_data),
POINTER,
PRIVATE :: obj
132 IF (
ASSOCIATED(atomic_halo%obj))
THEN
133 IF (
ASSOCIATED(atomic_halo%obj%halo_atoms))
THEN
138 DEALLOCATE (atomic_halo%obj%halo_atoms)
140 DEALLOCATE (atomic_halo%obj)
142 NULLIFY (atomic_halo%obj)
157 NULLIFY (atomic_halo%obj)
166 SUBROUTINE fb_atomic_halo_associate(a, b)
171 END SUBROUTINE fb_atomic_halo_associate
184 res =
ASSOCIATED(atomic_halo%obj)
196 cpassert(.NOT.
ASSOCIATED(atomic_halo%obj))
197 ALLOCATE (atomic_halo%obj)
198 atomic_halo%obj%owner_atom = 0
199 atomic_halo%obj%owner_id_in_halo = 0
200 atomic_halo%obj%natoms = 0
201 atomic_halo%obj%nelectrons = 0
202 atomic_halo%obj%sorted = .false.
203 atomic_halo%obj%cost = 0.0_dp
204 NULLIFY (atomic_halo%obj%halo_atoms)
216 cpassert(
ASSOCIATED(atomic_halo%obj))
218 IF (
ASSOCIATED(atomic_halo%obj%halo_atoms))
THEN
219 DEALLOCATE (atomic_halo%obj%halo_atoms)
221 atomic_halo%obj%owner_atom = 0
222 atomic_halo%obj%owner_id_in_halo = 0
223 atomic_halo%obj%natoms = 0
224 atomic_halo%obj%nelectrons = 0
225 atomic_halo%obj%sorted = .false.
226 atomic_halo%obj%cost = 0.0_dp
254 INTEGER,
INTENT(OUT),
OPTIONAL :: owner_atom, owner_id_in_halo, natoms, &
256 INTEGER,
DIMENSION(:),
OPTIONAL,
POINTER :: halo_atoms
257 LOGICAL,
INTENT(OUT),
OPTIONAL :: sorted
258 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: cost
260 cpassert(
ASSOCIATED(atomic_halo%obj))
261 IF (
PRESENT(owner_atom)) owner_atom = atomic_halo%obj%owner_atom
262 IF (
PRESENT(owner_id_in_halo)) owner_id_in_halo = atomic_halo%obj%owner_id_in_halo
263 IF (
PRESENT(natoms)) natoms = atomic_halo%obj%natoms
264 IF (
PRESENT(nelectrons)) nelectrons = atomic_halo%obj%nelectrons
265 IF (
PRESENT(halo_atoms)) halo_atoms => atomic_halo%obj%halo_atoms
266 IF (
PRESENT(sorted)) sorted = atomic_halo%obj%sorted
267 IF (
PRESENT(cost)) cost = atomic_halo%obj%cost
297 INTEGER,
INTENT(IN),
OPTIONAL :: owner_atom, owner_id_in_halo, natoms, &
299 INTEGER,
DIMENSION(:),
OPTIONAL,
POINTER :: halo_atoms
300 LOGICAL,
INTENT(IN),
OPTIONAL :: sorted
301 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: cost
303 cpassert(
ASSOCIATED(atomic_halo%obj))
304 IF (
PRESENT(owner_atom)) atomic_halo%obj%owner_atom = owner_atom
305 IF (
PRESENT(owner_id_in_halo)) atomic_halo%obj%owner_id_in_halo = owner_id_in_halo
306 IF (
PRESENT(natoms)) atomic_halo%obj%natoms = natoms
307 IF (
PRESENT(nelectrons)) atomic_halo%obj%nelectrons = nelectrons
308 IF (
PRESENT(halo_atoms))
THEN
309 IF (
ASSOCIATED(atomic_halo%obj%halo_atoms))
THEN
310 DEALLOCATE (atomic_halo%obj%halo_atoms)
312 atomic_halo%obj%halo_atoms => halo_atoms
314 IF (
PRESENT(nelectrons)) atomic_halo%obj%nelectrons = nelectrons
315 IF (
PRESENT(sorted)) atomic_halo%obj%sorted = sorted
316 IF (
PRESENT(cost)) atomic_halo%obj%cost = cost
328 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: tmp_index
330 cpassert(
SIZE(atomic_halo%obj%halo_atoms) > 0)
331 ALLOCATE (tmp_index(atomic_halo%obj%natoms))
332 CALL sort(atomic_halo%obj%halo_atoms, atomic_halo%obj%natoms, tmp_index)
333 DEALLOCATE (tmp_index)
334 atomic_halo%obj%sorted = .true.
353 INTEGER,
INTENT(IN) :: iatom_global
354 INTEGER,
INTENT(OUT) :: iatom_halo
355 LOGICAL,
INTENT(OUT) :: found
357 CHARACTER(len=*),
PARAMETER :: routinen =
'fb_atomic_halo_atom_global2halo'
361 CALL timeset(routinen, handle)
363 cpassert(atomic_halo%obj%sorted)
364 iatom_halo =
locate(atomic_halo%obj%halo_atoms, iatom_global)
365 IF (iatom_halo == 0)
THEN
371 CALL timestop(handle)
386 TYPE(
particle_type),
DIMENSION(:),
INTENT(IN) :: particle_set
387 INTEGER :: nelectrons
389 INTEGER :: iatom_global, iatom_halo, z
393 IF (
ASSOCIATED(atomic_halo%obj))
THEN
394 DO iatom_halo = 1, atomic_halo%obj%natoms
395 iatom_global = atomic_halo%obj%halo_atoms(iatom_halo)
396 atomic_kind => particle_set(iatom_global)%atomic_kind
399 nelectrons = nelectrons + z
426 TYPE(
particle_type),
DIMENSION(:),
INTENT(IN) :: particle_set
427 TYPE(
qs_kind_type),
DIMENSION(:),
INTENT(IN) :: qs_kind_set
428 REAL(kind=
dp) :: cost
430 INTEGER :: iatom, ii, ikind, ncgf
433 DO ii = 1, atomic_halo%obj%natoms
434 iatom = atomic_halo%obj%halo_atoms(ii)
439 cost = cost + real(ncgf,
dp)
466 INTEGER,
INTENT(IN) :: owner_atom
467 TYPE(
particle_type),
DIMENSION(:),
INTENT(IN) :: particle_set
469 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: pair_radii
470 INTEGER,
DIMENSION(:),
POINTER :: halo_atoms
471 INTEGER,
INTENT(OUT) :: nhalo_atoms, owner_id_in_halo
473 INTEGER :: iatom, ikind, jatom, jkind, natoms_global
476 REAL(kind=
dp),
DIMENSION(3) :: ri, rij_pbc, rj
479 check_ok = .NOT.
ASSOCIATED(halo_atoms)
482 NULLIFY (atomic_kind)
485 atomic_kind => particle_set(iatom)%atomic_kind
488 natoms_global =
SIZE(particle_set)
489 ALLOCATE (halo_atoms(natoms_global))
492 DO jatom = 1, natoms_global
493 atomic_kind => particle_set(jatom)%atomic_kind
499 ri(1:3) = particle_set(iatom)%r(1:3)
500 rj(1:3) = particle_set(jatom)%r(1:3)
501 rij_pbc =
pbc(ri, rj, cell)
502 rij = rij_pbc(1)*rij_pbc(1) + &
503 rij_pbc(2)*rij_pbc(2) + &
504 rij_pbc(3)*rij_pbc(3)
506 IF (rij .LE. pair_radii(ikind, jkind))
THEN
508 nhalo_atoms = nhalo_atoms + 1
509 halo_atoms(nhalo_atoms) = jatom
510 IF (jatom == iatom) owner_id_in_halo = nhalo_atoms
527 IF (
ASSOCIATED(atomic_halos%obj))
THEN
528 IF (
ASSOCIATED(atomic_halos%obj%halos))
THEN
529 DO ii = 1,
SIZE(atomic_halos%obj%halos)
532 DEALLOCATE (atomic_halos%obj%halos)
534 DEALLOCATE (atomic_halos%obj)
536 NULLIFY (atomic_halos%obj)
551 NULLIFY (atomic_halos%obj)
565 res =
ASSOCIATED(atomic_halos%obj)
590 cpassert(.NOT.
ASSOCIATED(atomic_halos%obj))
591 ALLOCATE (atomic_halos%obj)
592 atomic_halos%obj%nhalos = 0
593 atomic_halos%obj%max_nhalos = 0
594 NULLIFY (atomic_halos%obj%halos)
603 SUBROUTINE fb_atomic_halo_list_init(atomic_halos)
608 cpassert(
ASSOCIATED(atomic_halos%obj))
610 IF (
ASSOCIATED(atomic_halos%obj%halos))
THEN
611 DO ii = 1,
SIZE(atomic_halos%obj%halos)
614 DEALLOCATE (atomic_halos%obj%halos)
616 atomic_halos%obj%nhalos = 0
617 atomic_halos%obj%max_nhalos = 0
618 END SUBROUTINE fb_atomic_halo_list_init
633 INTEGER,
INTENT(OUT),
OPTIONAL :: nhalos, max_nhalos
637 cpassert(
ASSOCIATED(atomic_halos%obj))
638 IF (
PRESENT(nhalos)) nhalos = atomic_halos%obj%nhalos
639 IF (
PRESENT(max_nhalos)) max_nhalos = atomic_halos%obj%max_nhalos
640 IF (
PRESENT(halos)) halos => atomic_halos%obj%halos
657 INTEGER,
INTENT(IN),
OPTIONAL :: nhalos, max_nhalos
663 cpassert(
ASSOCIATED(atomic_halos%obj))
664 IF (
PRESENT(nhalos)) atomic_halos%obj%nhalos = nhalos
665 IF (
PRESENT(max_nhalos)) atomic_halos%obj%max_nhalos = max_nhalos
666 IF (
PRESENT(halos))
THEN
667 IF (
ASSOCIATED(atomic_halos%obj%halos))
THEN
668 DO ihalo = 1,
SIZE(atomic_halos%obj%halos)
671 DEALLOCATE (atomic_halos%obj%halos)
673 atomic_halos%obj%halos => halos
685 SUBROUTINE fb_atomic_halo_list_write(atomic_halos, para_env, fb_section)
690 CHARACTER(LEN=default_string_length) :: string
691 INTEGER :: ihalo, jatom, mype, nhalo_atoms, nhalos, &
692 owner_atom, print_unit
693 INTEGER,
DIMENSION(:),
POINTER :: halo_atoms
702 "PRINT%ATOMIC_HALOS"), &
705 basis_section=fb_section, &
706 print_key_path=
"PRINT%ATOMIC_HALOS", &
709 log_filename=.false., &
710 file_position=
"REWIND", &
711 file_action=
"WRITE", &
712 is_new_file=new_file)
713 mype = para_env%mepos
716 WRITE (unit=string, fmt=
"(A,I5,A)") &
717 "ATOMIC HALOS IN (PROCESS ", mype,
")"
719 IF (print_unit > 0)
THEN
720 WRITE (unit=print_unit, fmt=
"(/,/,T2,A)") trim(string)
721 WRITE (unit=print_unit, fmt=
"(/,T2,A)") &
722 "atom : list of atoms in the atomic halo"
730 owner_atom=owner_atom, &
731 natoms=nhalo_atoms, &
732 halo_atoms=halo_atoms)
733 WRITE (unit=print_unit, fmt=
"(2X,I6,A)", advance=
"no") &
735 DO jatom = 1, nhalo_atoms
736 WRITE (unit=print_unit, fmt=
"(I6)", advance=
"no") &
739 WRITE (unit=print_unit)
""
743 "PRINT%ATOMIC_HALOS")
745 END SUBROUTINE fb_atomic_halo_list_write
760 INTEGER :: ihalo, max_natoms, min_natoms, &
761 nhalo_atoms, nhalos, &
762 total_n_halo_atoms, total_n_halos, &
764 REAL(kind=
dp) :: ave_natoms
768 NULLIFY (logger, halos)
771 "PRINT%FILTER_MATRIX", &
780 total_n_halo_atoms = 0
781 total_n_halos = nhalos
785 total_n_halo_atoms = total_n_halo_atoms + nhalo_atoms
786 max_natoms = max(max_natoms, nhalo_atoms)
787 min_natoms = min(min_natoms, nhalo_atoms)
789 CALL para_env%max(max_natoms)
790 CALL para_env%min(min_natoms)
791 CALL para_env%sum(total_n_halos)
792 CALL para_env%sum(total_n_halo_atoms)
793 ave_natoms = real(total_n_halo_atoms,
dp)/real(total_n_halos,
dp)
795 IF (unit_nr > 0)
THEN
796 WRITE (unit=unit_nr, fmt=
"(/,A)") &
797 " FILTER_MAT_DIAG| Atomic matrix neighbor lists information:"
798 WRITE (unit=unit_nr, fmt=
"(A,I10)") &
799 " FILTER_MAT_DIAG| Number of atomic matrices: ", &
801 WRITE (unit=unit_nr, &
802 fmt=
"(A,T45,A,T57,A,T69,A,T81,A)") &
803 " FILTER_MAT_DIAG| ",
"Average",
"Max",
"Min"
804 WRITE (unit=unit_nr, &
805 fmt=
"(A,T45,F10.1,T57,I10,T69,I10,T81,I10)") &
806 " FILTER_MAT_DIAG| N neighbors per atom:", &
807 ave_natoms, max_natoms, min_natoms
811 "PRINT%FILTER_MATRIX")
826 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rcut
827 INTEGER,
INTENT(IN) :: nkinds
828 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(OUT) :: pair_radii
835 pair_radii(ii, jj) = rcut(ii) + rcut(jj)
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
Handles all functions related to the CELL.
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,...
integer, parameter, public cp_p_file
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Utility routines for the memory handling.
Interface to the message passing library MPI.
Define the data structure for the particle information.
subroutine, public fb_atomic_halo_list_get(atomic_halos, nhalos, max_nhalos, halos)
Gets attributes from an fb_atomic_halo_list object, one should only access the data content in a fb_a...
real(kind=dp) function, public fb_atomic_halo_cost(atomic_halo, particle_set, qs_kind_set)
Estimates the computational cost with respect to the filter matrix calculation associated to an atomi...
subroutine, public fb_atomic_halo_get(atomic_halo, owner_atom, owner_id_in_halo, natoms, nelectrons, halo_atoms, sorted, cost)
Gets attributes from a fb_atomic_halo object, one should only access the data content in a fb_atomic_...
subroutine, public fb_atomic_halo_build_halo_atoms(owner_atom, particle_set, cell, pair_radii, halo_atoms, nhalo_atoms, owner_id_in_halo)
Builds halo atoms for a given (owner) atom.
subroutine, public fb_atomic_halo_set(atomic_halo, owner_atom, owner_id_in_halo, natoms, nelectrons, halo_atoms, sorted, cost)
Sets attributes in a fb_atomic_halo object, one should only set the data content in a fb_atomic_halo ...
subroutine, public fb_atomic_halo_sort(atomic_halo)
Sort the list of atomic indices in the halo in ascending order. The atomic_halo must not be empty.
subroutine, public fb_atomic_halo_create(atomic_halo)
Creates and initialises an empty fb_atomic_halo object.
subroutine, public fb_atomic_halo_list_create(atomic_halos)
Creates and initialises an empty fb_atomic_halo_list object.
subroutine, public fb_atomic_halo_atom_global2halo(atomic_halo, iatom_global, iatom_halo, found)
Given a global atomic index, convert it to its index in a given atomic halo, if found....
logical function, public fb_atomic_halo_has_data(atomic_halo)
Checks if a fb_atomic_halo object is associated with an actual data content or not.
pure subroutine, public fb_build_pair_radii(rcut, nkinds, pair_radii)
Builds the required pair_radii array required for building the halo atoms from a given set of cut off...
subroutine, public fb_atomic_halo_list_set(atomic_halos, nhalos, max_nhalos, halos)
Sets attributes from an fb_atomic_halo_list object, one should only set the data content in a fb_atom...
subroutine, public fb_atomic_halo_nullify(atomic_halo)
Nullifies a fb_atomic_halo object, note that it does not release the original object....
subroutine, public fb_atomic_halo_list_release(atomic_halos)
Releases an fb_atomic_halo_list object.
subroutine, public fb_atomic_halo_list_associate(a, b)
Associates one fb_atomic_halo_list object to another.
integer function, public fb_atomic_halo_nelectrons_estimate_z(atomic_halo, particle_set)
Estimates the total number of electrons in a halo using atomic numbers.
logical function, public fb_atomic_halo_list_has_data(atomic_halos)
Checks if a fb_atomic_halo_list object is associated with an actual data content or not.
subroutine, public fb_atomic_halo_list_write_info(atomic_halos, para_env, scf_section)
Writes out the atomic halo list summary, no detailed neighbour lists, just average,...
subroutine, public fb_atomic_halo_release(atomic_halo)
Releases an fb_atomic_halo object.
subroutine, public fb_atomic_halo_init(atomic_halo)
Initialises an fb_atomic_halo object, and makes it empty.
subroutine, public fb_atomic_halo_list_nullify(atomic_halos)
Nullifies a fb_atomic_halo_list object, note that it does not release the original object....
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_r3d_rs_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, floating, name, element_symbol, pao_basis_size, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
Utilities for string manipulations.
subroutine, public compress(string, full)
Eliminate multiple space characters in a string. If full is .TRUE., then all spaces are eliminated.
All kind of helpful little routines.
pure integer function, public locate(array, x)
Purpose: Given an array array(1:n), and given a value x, a value x_index is returned which is the ind...
Provides all information about an atomic kind.
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...
stores all the informations relevant to an mpi environment
defines a fb_atomic_halo_list object
defines a fb_atomic_halo object
Provides all information about a quickstep kind.