59#include "./base/base_uses.f90"
66 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'fist_neighbor_lists'
69 INTEGER,
DIMENSION(:),
POINTER :: list => null(), &
70 list_local_a_index => null()
71 END TYPE local_atoms_type
100 local_particles, cell, r_max, r_minsq, ei_scale14, vdw_scale14, &
101 nonbonded, para_env, build_from_scratch, geo_check, mm_section, &
108 REAL(
dp),
DIMENSION(:, :),
INTENT(IN) :: r_max, r_minsq
109 REAL(kind=
dp),
INTENT(IN) :: ei_scale14, vdw_scale14
112 LOGICAL,
INTENT(IN) :: build_from_scratch, geo_check
114 LOGICAL,
DIMENSION(:, :),
OPTIONAL,
POINTER :: full_nl
117 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_fist_neighbor_lists'
119 CHARACTER(LEN=default_string_length) :: kind_name, print_key_path, unit_str
120 INTEGER :: atom_a, handle, iatom_local, ikind, iw, &
121 maxatom, natom_local_a, nkind, &
123 LOGICAL :: present_local_particles, &
125 LOGICAL,
DIMENSION(:),
POINTER :: skip_kind
126 LOGICAL,
DIMENSION(:, :),
POINTER :: my_full_nl
129 TYPE(local_atoms_type),
ALLOCATABLE,
DIMENSION(:) ::
atom
131 CALL timeset(routinen, handle)
135 print_subcell_grid = .false.
138 IF (output_unit > 0) print_subcell_grid = .true.
143 present_local_particles =
PRESENT(local_particles)
147 IF (
PRESENT(exclusions))
THEN
148 cpassert(present_local_particles)
152 nkind =
SIZE(atomic_kind_set)
153 ALLOCATE (
atom(nkind))
154 ALLOCATE (skip_kind(nkind))
156 IF (
PRESENT(full_nl))
THEN
157 my_full_nl => full_nl
159 ALLOCATE (my_full_nl(nkind, nkind))
164 atomic_kind => atomic_kind_set(ikind)
165 NULLIFY (
atom(ikind)%list)
166 NULLIFY (
atom(ikind)%list_local_a_index)
169 atom_list=
atom(ikind)%list, name=kind_name)
171 IF (present_local_particles)
THEN
172 natom_local_a = local_particles%n_el(ikind)
174 natom_local_a =
SIZE(
atom(ikind)%list)
176 IF (natom_local_a > 0)
THEN
177 ALLOCATE (
atom(ikind)%list_local_a_index(natom_local_a))
179 DO iatom_local = 1, natom_local_a
180 IF (present_local_particles)
THEN
181 atom_a = local_particles%list(ikind)%array(iatom_local)
183 atom_a =
atom(ikind)%list(iatom_local)
185 atom(ikind)%list_local_a_index(iatom_local) = atom_a
191 IF (build_from_scratch)
THEN
192 IF (
ASSOCIATED(nonbonded))
THEN
198 CALL build_neighbor_lists(nonbonded, particle_set,
atom, cell, &
199 print_subcell_grid, output_unit, r_max, r_minsq, &
200 ei_scale14, vdw_scale14, geo_check,
"NONBONDED", skip_kind, &
201 my_full_nl, exclusions)
204 CALL sort_neighbor_lists(nonbonded, nkind)
206 print_key_path =
"PRINT%NEIGHBOR_LISTS"
211 basis_section=mm_section, &
212 print_key_path=print_key_path, &
214 middle_name=
"nonbonded_nl", &
216 log_filename=.false., &
217 file_position=
"REWIND")
219 CALL write_neighbor_lists(nonbonded, particle_set, cell, para_env, iw, &
220 "NONBONDED NEIGHBOR LISTS", unit_str)
223 basis_section=mm_section, &
224 print_key_path=print_key_path, &
230 NULLIFY (
atom(ikind)%list)
231 IF (
ASSOCIATED(
atom(ikind)%list_local_a_index))
THEN
232 DEALLOCATE (
atom(ikind)%list_local_a_index)
235 IF (
PRESENT(full_nl))
THEN
238 DEALLOCATE (my_full_nl)
242 DEALLOCATE (skip_kind)
246 basis_section=mm_section, &
247 print_key_path=
"PRINT%SUBCELL")
248 CALL timestop(handle)
273 SUBROUTINE build_neighbor_lists(nonbonded, particle_set, atom, cell, &
274 print_subcell_grid, output_unit, r_max, r_minsq, &
275 ei_scale14, vdw_scale14, geo_check, name, skip_kind, full_nl, exclusions)
279 TYPE(local_atoms_type),
DIMENSION(:),
INTENT(IN) ::
atom
281 LOGICAL,
INTENT(IN) :: print_subcell_grid
282 INTEGER,
INTENT(IN) :: output_unit
283 REAL(
dp),
DIMENSION(:, :),
INTENT(IN) :: r_max, r_minsq
284 REAL(kind=
dp),
INTENT(IN) :: ei_scale14, vdw_scale14
285 LOGICAL,
INTENT(IN) :: geo_check
286 CHARACTER(LEN=*),
INTENT(IN) :: name
287 LOGICAL,
DIMENSION(:),
POINTER :: skip_kind
288 LOGICAL,
DIMENSION(:, :),
POINTER :: full_nl
291 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_neighbor_lists'
293 INTEGER :: a_i, a_j, a_k, atom_a, atom_b, b_i, b_j, b_k, b_pi, b_pj, b_pk, bg_i, bg_j, bg_k, &
294 handle, i, i1, iatom_local, icell, icellmap, id_kind, ii, ii_start, ij, ij_start, ik, &
295 ik_start, ikind, imap, imax_cell, invcellmap, iw, ix, j, j1, jatom_local, jcell, jkind, &
296 jx, k, kcell, kx, natom_local_a, ncellmax, nkind, nkind00, tmpdim, xdim, ydim, zdim
297 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: kind_of, work
298 INTEGER,
ALLOCATABLE,
DIMENSION(:, :, :) :: cellmap
299 INTEGER,
DIMENSION(3) :: isubcell, ncell, nsubcell, periodic
300 LOGICAL :: any_full, atom_order, check_spline, &
302 LOGICAL,
ALLOCATABLE,
DIMENSION(:, :, :) :: sphcub
303 REAL(
dp) :: rab2, rab2_max, rab2_min, rab_max
304 REAL(
dp),
DIMENSION(3) :: abc, cell_v, cv_b, rab, rb, sab_max
305 REAL(kind=
dp) :: ic(3), icx(3), radius, vv
306 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: coord
309 TYPE(
subcell_type),
DIMENSION(:, :, :),
POINTER :: subcell_a, subcell_b
311 CALL timeset(routinen, handle)
316 any_full = any(full_nl)
322 DO jkind = ikind, nkind
324 rab_max = r_max(ikind, jkind)
325 IF (skip_kind(ikind) .AND. skip_kind(jkind)) cycle
326 nsubcell(1) = max(nsubcell(1), ceiling(
plane_distance(1, 0, 0, cell)/rab_max))
327 nsubcell(2) = max(nsubcell(2), ceiling(
plane_distance(0, 1, 0, cell)/rab_max))
328 nsubcell(3) = max(nsubcell(3), ceiling(
plane_distance(0, 0, 1, cell)/rab_max))
333 DO jkind = ikind, nkind
334 IF (skip_kind(ikind) .AND. skip_kind(jkind)) cycle
336 rab_max = r_max(ikind, jkind)
340 ncell = max(ncell(:), ceiling(sab_max(:)*periodic(:)))
341 isubcell = max(isubcell(:), ceiling(sab_max(:)*real(nsubcell(:), kind=
dp)))
346 IF (print_subcell_grid)
THEN
347 WRITE (unit=output_unit, fmt=
"(/,/,T2,A,/)") &
348 "SUBCELL GRID INFO FOR THE "//trim(name)//
" NEIGHBOR LISTS"
349 WRITE (unit=output_unit, fmt=
"(T4,A,10X,3I10)")
" NUMBER OF SUBCELLS ::", nsubcell
350 WRITE (unit=output_unit, fmt=
"(T4,A,10X,3I10)")
" NUMBER OF PERIODIC IMAGES ::", ncell
351 WRITE (unit=output_unit, fmt=
"(T4,A,10X,3I10)")
" NUMBER OF INTERACTING SUBCELLS ::", isubcell
357 ncellmax = maxval(ncell)
358 ALLOCATE (cellmap(-ncellmax:ncellmax, -ncellmax:ncellmax, -ncellmax:ncellmax))
361 nkind00 = nkind*(nkind + 1)/2
362 DO imax_cell = 0, ncellmax
363 DO kcell = -imax_cell, imax_cell
364 DO jcell = -imax_cell, imax_cell
365 DO icell = -imax_cell, imax_cell
366 IF (cellmap(icell, jcell, kcell) == -1)
THEN
368 cellmap(icell, jcell, kcell) = imap
369 cpassert(imap <= nonbonded%nlists)
370 neighbor_kind_pair => nonbonded%neighbor_kind_pairs(imap)
372 neighbor_kind_pair%cell_vector(1) = icell
373 neighbor_kind_pair%cell_vector(2) = jcell
374 neighbor_kind_pair%cell_vector(3) = kcell
381 ALLOCATE (sphcub(-isubcell(1):isubcell(1), &
382 -isubcell(2):isubcell(2), &
383 -isubcell(3):isubcell(3)))
385 IF (all(isubcell /= 0))
THEN
386 radius = real(isubcell(1), kind=
dp)**2 + real(isubcell(2), kind=
dp)**2 + &
387 REAL(isubcell(3), kind=
dp)**2
388 loop1:
DO k = -isubcell(3), isubcell(3)
389 loop2:
DO j = -isubcell(2), isubcell(2)
390 loop3:
DO i = -isubcell(1), isubcell(1)
391 ic = real((/i, j, k/), kind=
dp)
394 icx(3) = ic(3) + sign(0.5_dp, real(kx, kind=
dp))
396 icx(2) = ic(2) + sign(0.5_dp, real(jx, kind=
dp))
398 icx(1) = ic(1) + sign(0.5_dp, real(ix, kind=
dp))
399 vv = icx(1)*icx(1) + icx(2)*icx(2) + icx(3)*icx(3)
401 IF (vv <= 1.0_dp)
THEN
402 sphcub(i, j, k) = .true.
413 ALLOCATE (coord(3,
SIZE(particle_set)))
414 DO atom_a = 1,
SIZE(particle_set)
415 coord(:, atom_a) =
pbc(particle_set(atom_a)%r, cell)
419 IF (.NOT.
ASSOCIATED(
atom(ikind)%list_local_a_index)) cycle
420 natom_local_a =
SIZE(
atom(ikind)%list_local_a_index)
421 DO iatom_local = 1, natom_local_a
422 atom_a =
atom(ikind)%list_local_a_index(iatom_local)
424 subcell_a(i, j, k)%natom = subcell_a(i, j, k)%natom + 1
427 DO k = 1, nsubcell(3)
428 DO j = 1, nsubcell(2)
429 DO i = 1, nsubcell(1)
430 ALLOCATE (subcell_a(i, j, k)%atom_list(subcell_a(i, j, k)%natom))
431 subcell_a(i, j, k)%natom = 0
436 IF (.NOT.
ASSOCIATED(
atom(ikind)%list_local_a_index)) cycle
437 natom_local_a =
SIZE(
atom(ikind)%list_local_a_index)
438 DO iatom_local = 1, natom_local_a
439 atom_a =
atom(ikind)%list_local_a_index(iatom_local)
441 subcell_a(i, j, k)%natom = subcell_a(i, j, k)%natom + 1
442 subcell_a(i, j, k)%atom_list(subcell_a(i, j, k)%natom) = atom_a
446 DO atom_b = 1,
SIZE(particle_set)
448 subcell_b(i, j, k)%natom = subcell_b(i, j, k)%natom + 1
450 DO k = 1, nsubcell(3)
451 DO j = 1, nsubcell(2)
452 DO i = 1, nsubcell(1)
453 ALLOCATE (subcell_b(i, j, k)%atom_list(subcell_b(i, j, k)%natom))
454 subcell_b(i, j, k)%natom = 0
458 DO atom_b = 1,
SIZE(particle_set)
460 subcell_b(i, j, k)%natom = subcell_b(i, j, k)%natom + 1
461 subcell_b(i, j, k)%atom_list(subcell_b(i, j, k)%natom) = atom_b
464 tmpdim = maxval(subcell_a(:, :, :)%natom)
465 tmpdim = max(tmpdim, maxval(subcell_b(:, :, :)%natom))
466 ALLOCATE (work(3*tmpdim))
467 ALLOCATE (kind_of(
SIZE(particle_set)))
468 DO i = 1,
SIZE(particle_set)
469 kind_of(i) = particle_set(i)%atomic_kind%kind_number
471 DO k = 1, nsubcell(3)
472 DO j = 1, nsubcell(2)
473 DO i = 1, nsubcell(1)
479 DEALLOCATE (work, kind_of)
485 ik_start = -isubcell(3)
486 IF (.NOT. any_full) ik_start = 0
488 loop_a_k:
DO a_k = 1, nsubcell(3)
489 loop_a_j:
DO a_j = 1, nsubcell(2)
490 loop_a_i:
DO a_i = 1, nsubcell(1)
491 IF (subcell_a(a_i, a_j, a_k)%natom == 0) cycle
493 loop_b_k:
DO ik = ik_start, isubcell(3)
495 b_k = mod(bg_k, zdim)
501 IF ((periodic(3) == 0) .AND. (abs(b_pk) > 0)) cycle
503 ij_start = -isubcell(2)
504 IF ((ik == 0) .AND. (ik_start == 0)) ij_start = 0
505 loop_b_j:
DO ij = ij_start, isubcell(2)
507 b_j = mod(bg_j, ydim)
513 IF ((periodic(2) == 0) .AND. (abs(b_pj) > 0)) cycle
515 ii_start = -isubcell(1)
516 IF ((ij == 0) .AND. (ij_start == 0)) ii_start = 0
517 loop_b_i:
DO ii = ii_start, isubcell(1)
519 IF (.NOT. sphcub(ii, ij, ik)) cycle
521 b_i = mod(bg_i, xdim)
527 IF ((periodic(1) == 0) .AND. (abs(b_pi) > 0)) cycle
528 IF (subcell_b(b_i, b_j, b_k)%natom == 0) cycle
530 icellmap = cellmap(b_pi, b_pj, b_pk)
531 neighbor_kind_pair => nonbonded%neighbor_kind_pairs(icellmap)
534 IF ((b_pi /= 0) .OR. (b_pj /= 0) .OR. (b_pk /= 0))
THEN
535 cv_b(1) = b_pi; cv_b(2) = b_pj; cv_b(3) = b_pk
538 subcell000 = (a_k == bg_k) .AND. (a_j == bg_j) .AND. (a_i == bg_i)
540 DO jatom_local = 1, subcell_b(b_i, b_j, b_k)%natom
541 atom_b = subcell_b(b_i, b_j, b_k)%atom_list(jatom_local)
542 jkind = particle_set(atom_b)%atomic_kind%kind_number
543 rb(1) = coord(1, atom_b) + cell_v(1)
544 rb(2) = coord(2, atom_b) + cell_v(2)
545 rb(3) = coord(3, atom_b) + cell_v(3)
546 DO iatom_local = 1, subcell_a(a_i, a_j, a_k)%natom
547 atom_a = subcell_a(a_i, a_j, a_k)%atom_list(iatom_local)
548 ikind = particle_set(atom_a)%atomic_kind%kind_number
550 atom_order = (atom_a <= atom_b)
553 is_full = full_nl(ikind, jkind)
555 atom_order = (atom_a == atom_b)
558 IF (ik == 0 .AND. ij < 0) cycle
559 IF (ij == 0 .AND. ii < 0) cycle
562 IF (subcell000 .AND. atom_order) cycle
563 rab(1) = rb(1) - coord(1, atom_a)
564 rab(2) = rb(2) - coord(2, atom_a)
565 rab(3) = rb(3) - coord(3, atom_a)
566 rab2 = rab(1)*rab(1) + rab(2)*rab(2) + rab(3)*rab(3)
567 rab_max = r_max(ikind, jkind)
568 rab2_max = rab_max*rab_max
569 IF (rab2 < rab2_max)
THEN
571 j1 = min(ikind, jkind)
572 i1 = max(ikind, jkind) - j1 + 1
574 id_kind = nkind00 - (j1*(j1 + 1)/2) + i1
578 check_spline=check_spline, id_kind=id_kind, &
579 skip=(skip_kind(ikind) .AND. skip_kind(jkind)), &
580 cell=cell, ei_scale14=ei_scale14, &
581 vdw_scale14=vdw_scale14, exclusions=exclusions)
583 IF ((atom_a == atom_b) .AND. (ik_start == 0))
THEN
584 invcellmap = cellmap(-b_pi, -b_pj, -b_pk)
585 inv_neighbor_kind_pair => nonbonded%neighbor_kind_pairs(invcellmap)
586 rab = rab - 2.0_dp*cell_v
589 check_spline=check_spline, id_kind=id_kind, &
590 skip=(skip_kind(ikind) .AND. skip_kind(jkind)), &
591 cell=cell, ei_scale14=ei_scale14, &
592 vdw_scale14=vdw_scale14, exclusions=exclusions)
595 IF (check_spline)
THEN
596 rab2_min = r_minsq(ikind, jkind)
597 IF (rab2 < rab2_min)
THEN
599 WRITE (iw,
'(T2,A,2I7,2(A,F15.8),A)')
"WARNING| Particles: ", &
601 " at distance [au]:", sqrt(rab2),
" less than: ", &
603 "; increase EMAX_SPLINE."
604 IF (rab2 < rab2_min/(1.06_dp)**2)
THEN
606 cpabort(
"GEOMETRY wrong or EMAX_SPLINE too small!")
626 CALL timestop(handle)
627 END SUBROUTINE build_neighbor_lists
642 SUBROUTINE write_neighbor_lists(nonbonded, particle_set, cell, para_env, output_unit, &
649 INTEGER,
INTENT(IN) :: output_unit
650 CHARACTER(LEN=*),
INTENT(IN) :: name, unit_str
652 CHARACTER(LEN=default_string_length) :: string
653 INTEGER :: atom_a, atom_b, iab, ilist, nneighbor
654 LOGICAL :: print_headline
655 REAL(
dp) :: conv, dab
656 REAL(
dp),
DIMENSION(3) :: cell_v, ra, rab, rb
661 WRITE (unit=string, fmt=
"(A,I5,A)") &
662 trim(name)//
" IN "//trim(unit_str)//
" (PROCESS", para_env%mepos,
")"
664 IF (output_unit > 0)
WRITE (unit=output_unit, fmt=
"(/,/,T2,A)") trim(string)
666 print_headline = .true.
669 DO iab = 1,
SIZE(nonbonded%neighbor_kind_pairs)
670 neighbor_kind_pair => nonbonded%neighbor_kind_pairs(iab)
671 cell_v = matmul(cell%hmat, real(neighbor_kind_pair%cell_vector, kind=
dp))
672 DO ilist = 1, neighbor_kind_pair%npairs
673 nneighbor = nneighbor + 1
674 IF (output_unit > 0)
THEN
676 atom_a = neighbor_kind_pair%list(1, ilist)
677 atom_b = neighbor_kind_pair%list(2, ilist)
678 IF (print_headline)
THEN
679 WRITE (unit=output_unit, fmt=
"(T3,2(A6,3(5X,A,5X)),1X,A11,10X,A8,A5,A10,A9)") &
680 "Atom-A",
"X",
"Y",
"Z",
"Atom-B",
"X",
"Y",
"Z",
"Cell(i,j,k)", &
681 "Distance",
"ONFO",
"VDW-scale",
"EI-scale"
682 print_headline = .false.
685 ra(:) =
pbc(particle_set(atom_a)%r, cell)
686 rb(:) =
pbc(particle_set(atom_b)%r, cell)
687 rab = rb(:) - ra(:) + cell_v
688 dab = sqrt(dot_product(rab, rab))
689 IF (ilist <= neighbor_kind_pair%nscale)
THEN
690 WRITE (unit=output_unit, fmt=
"(T3,2(I6,3(1X,F10.6)),3(1X,I3),10X,F8.4,L4,F11.5,F9.5)") &
691 atom_a, ra(1:3)*conv, &
692 atom_b, rb(1:3)*conv, &
693 neighbor_kind_pair%cell_vector, &
695 neighbor_kind_pair%is_onfo(ilist), &
696 neighbor_kind_pair%vdw_scale(ilist), &
697 neighbor_kind_pair%ei_scale(ilist)
699 WRITE (unit=output_unit, fmt=
"(T3,2(I6,3(1X,F10.6)),3(1X,I3),10X,F8.4)") &
700 atom_a, ra(1:3)*conv, &
701 atom_b, rb(1:3)*conv, &
702 neighbor_kind_pair%cell_vector, &
710 WRITE (unit=string, fmt=
"(A,I12,A,I12)") &
711 "Total number of neighbor interactions for process", para_env%mepos,
":", &
714 IF (output_unit > 0)
WRITE (unit=output_unit, fmt=
"(/,T2,A)") trim(string)
716 END SUBROUTINE write_neighbor_lists
727 SUBROUTINE sort_neighbor_lists(nonbonded, nkinds)
730 INTEGER,
INTENT(IN) :: nkinds
732 CHARACTER(LEN=*),
PARAMETER :: routinen =
'sort_neighbor_lists'
734 INTEGER :: handle, iab, id_kind, ikind, ipair, &
735 jkind, max_alloc_size, npairs, nscale, &
737 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: indj
738 INTEGER,
DIMENSION(:),
POINTER :: work
739 INTEGER,
DIMENSION(:, :),
POINTER :: list_copy
742 NULLIFY (neighbor_kind_pair)
743 CALL timeset(routinen, handle)
745 ALLOCATE (indj(nkinds*(nkinds + 1)/2))
748 DO ikind = jkind, nkinds
749 id_kind = id_kind + 1
750 indj(id_kind) = jkind
754 DO iab = 1, nonbonded%nlists
755 neighbor_kind_pair => nonbonded%neighbor_kind_pairs(iab)
756 npairs = neighbor_kind_pair%npairs
757 nscale = neighbor_kind_pair%nscale
758 IF (npairs /= 0)
THEN
759 IF (npairs > nscale)
THEN
764 ALLOCATE (work(1:npairs - nscale))
765 ALLOCATE (list_copy(2, 1:npairs - nscale))
768 list_copy = neighbor_kind_pair%list(:, nscale + 1:npairs)
769 CALL sort(neighbor_kind_pair%id_kind(nscale + 1:npairs), npairs - nscale, work)
772 DO ipair = nscale + 1, npairs
773 tmp = work(ipair - nscale)
774 neighbor_kind_pair%list(1, ipair) = list_copy(1, tmp)
775 neighbor_kind_pair%list(2, ipair) = list_copy(2, tmp)
778 DEALLOCATE (list_copy)
788 max_alloc_size = nkinds*(nkinds + 1)/2 + nscale
789 IF (
ASSOCIATED(neighbor_kind_pair%grp_kind_start))
THEN
790 DEALLOCATE (neighbor_kind_pair%grp_kind_start)
792 ALLOCATE (neighbor_kind_pair%grp_kind_start(max_alloc_size))
793 IF (
ASSOCIATED(neighbor_kind_pair%grp_kind_end))
THEN
794 DEALLOCATE (neighbor_kind_pair%grp_kind_end)
796 ALLOCATE (neighbor_kind_pair%grp_kind_end(max_alloc_size))
797 IF (
ASSOCIATED(neighbor_kind_pair%ij_kind))
THEN
798 DEALLOCATE (neighbor_kind_pair%ij_kind)
800 ALLOCATE (neighbor_kind_pair%ij_kind(2, max_alloc_size))
803 neighbor_kind_pair%ngrp_kind = 1
804 neighbor_kind_pair%grp_kind_start(neighbor_kind_pair%ngrp_kind) = ipair
806 id_kind = neighbor_kind_pair%id_kind(ipair)
807 jkind = indj(id_kind)
809 ikind = nkinds + id_kind - nkinds*(nkinds + 1)/2 + (tmp*(tmp + 1)/2)
810 neighbor_kind_pair%ij_kind(1, neighbor_kind_pair%ngrp_kind) = ikind
811 neighbor_kind_pair%ij_kind(2, neighbor_kind_pair%ngrp_kind) = jkind
814 IF (neighbor_kind_pair%id_kind(ipair) /= neighbor_kind_pair%id_kind(ipair - 1))
THEN
815 neighbor_kind_pair%grp_kind_end(neighbor_kind_pair%ngrp_kind) = ipair - 1
816 neighbor_kind_pair%ngrp_kind = neighbor_kind_pair%ngrp_kind + 1
817 neighbor_kind_pair%grp_kind_start(neighbor_kind_pair%ngrp_kind) = ipair
819 id_kind = neighbor_kind_pair%id_kind(ipair)
820 jkind = indj(id_kind)
822 ikind = nkinds + id_kind - nkinds*(nkinds + 1)/2 + (tmp*(tmp + 1)/2)
823 neighbor_kind_pair%ij_kind(1, neighbor_kind_pair%ngrp_kind) = ikind
824 neighbor_kind_pair%ij_kind(2, neighbor_kind_pair%ngrp_kind) = jkind
828 neighbor_kind_pair%grp_kind_end(neighbor_kind_pair%ngrp_kind) = npairs
831 CALL reallocate(neighbor_kind_pair%grp_kind_start, 1, neighbor_kind_pair%ngrp_kind)
832 CALL reallocate(neighbor_kind_pair%grp_kind_end, 1, neighbor_kind_pair%ngrp_kind)
833 CALL reallocate(neighbor_kind_pair%ij_kind, 1, 2, 1, neighbor_kind_pair%ngrp_kind)
836 DEALLOCATE (neighbor_kind_pair%id_kind)
839 CALL timestop(handle)
840 END SUBROUTINE sort_neighbor_lists
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
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.
subroutine, public scaled_to_real(r, s, cell)
Transform scaled cell coordinates real coordinates. r=h*s.
subroutine, public get_cell(cell, alpha, beta, gamma, deth, orthorhombic, abc, periodic, h, h_inv, symmetry_id, tag)
Get informations about a simulation cell.
real(kind=dp) function, public plane_distance(h, k, l, cell)
Calculate the distance between two lattice planes as defined by a triple of Miller indices (hkl).
various routines to log and control the output. The idea is that decisions about where to log should ...
recursive integer function, public cp_logger_get_default_unit_nr(logger, local, skip_not_ionode)
asks the default unit number of the given logger. try to use cp_logger_get_unit_nr
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...
real(kind=dp) function, public cp_unit_from_cp2k(value, unit_str, defaults, power)
converts from the internal cp2k units to the given unit
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
Define the neighbor list data types and the corresponding functionality.
subroutine, public fist_neighbor_add(neighbor_kind_pair, atom_a, atom_b, rab, check_spline, id_kind, skip, cell, ei_scale14, vdw_scale14, exclusions)
...
subroutine, public fist_neighbor_init(fist_neighbor, ncell)
...
subroutine, public fist_neighbor_deallocate(fist_neighbor)
...
Generate the atomic neighbor lists for FIST.
subroutine, public build_fist_neighbor_lists(atomic_kind_set, particle_set, local_particles, cell, r_max, r_minsq, ei_scale14, vdw_scale14, nonbonded, para_env, build_from_scratch, geo_check, mm_section, full_nl, exclusions)
...
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.
logical function, public qmmm_ff_precond_only_qm(id1, id2, id3, id4, is_link)
This function handles the atom names and modifies the "_QM_" prefix, in order to find the parameters ...
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.
subcell types and allocation routines
subroutine, public deallocate_subcell(subcell)
Deallocate a subcell grid structure.
subroutine, public give_ijk_subcell(r, i, j, k, cell, nsubcell)
...
subroutine, public reorder_atoms_subcell(atom_list, kind_of, work)
...
subroutine, public allocate_subcell(subcell, nsubcell, maxatom, cell)
Allocate and initialize a subcell grid structure for the atomic neighbor search.
All kind of helpful little routines.
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...
structure to store local (to a processor) ordered lists of integers.
A type used to store lists of exclusions and onfos.
stores all the informations relevant to an mpi environment