24 neighbor_kind_pairs_type
31 pair_potential_pp_type,&
32 pair_potential_single_type
35 #include "./base/base_uses.f90"
43 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'manybody_gal'
59 SUBROUTINE gal_energy(pot_loc, gal, r_last_update_pbc, iparticle, jparticle, &
60 cell, particle_set, mm_section)
62 REAL(kind=
dp),
INTENT(OUT) :: pot_loc
63 TYPE(gal_pot_type),
POINTER :: gal
64 TYPE(pos_type),
DIMENSION(:),
POINTER :: r_last_update_pbc
65 INTEGER,
INTENT(IN) :: iparticle, jparticle
66 TYPE(cell_type),
POINTER :: cell
67 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
68 TYPE(section_vals_type),
POINTER :: mm_section
70 CHARACTER(LEN=2) :: element_symbol
71 INTEGER :: index_outfile
72 REAL(kind=
dp) :: anglepart, cosalpha, drji2, gcn_weight, &
73 gcn_weight2, nvec(3), rji(3), &
74 sinalpha, sum_weight, vang, vgaussian, &
76 TYPE(cp_logger_type),
POINTER :: logger
80 element_symbol=element_symbol)
82 IF (element_symbol ==
"O")
THEN
84 rji(:) =
pbc(r_last_update_pbc(jparticle)%r(:), r_last_update_pbc(iparticle)%r(:), cell)
86 IF (.NOT.
ALLOCATED(gal%n_vectors))
THEN
87 ALLOCATE (gal%n_vectors(3,
SIZE(particle_set)))
88 gal%n_vectors(:, :) = 0.0_dp
93 IF (gal%gcn(jparticle) < 9.0_dp) gcn_weight = 1.0_dp
95 IF (gal%gcn(jparticle) < 11.5_dp) gcn_weight2 = 1.0_dp
99 IF (gcn_weight2 .NE. 0.0)
THEN
102 IF (gal%n_vectors(1, jparticle) == 0.0_dp .AND. &
103 gal%n_vectors(2, jparticle) == 0.0_dp .AND. &
104 gal%n_vectors(3, jparticle) == 0.0_dp)
THEN
105 gal%n_vectors(:, jparticle) = normale(gal, r_last_update_pbc, jparticle, &
109 nvec(:) = gal%n_vectors(:, jparticle)
112 sum_weight = somme(gal, r_last_update_pbc, iparticle, particle_set, cell)
115 weight = exp(-sqrt(dot_product(rji, rji))/gal%r1)
118 anglepart = angular(gal, r_last_update_pbc, iparticle, cell, particle_set, nvec, &
122 IF (weight /= 0)
THEN
123 vang = gcn_weight2*weight*weight*anglepart/sum_weight
124 IF (gal%express)
THEN
127 "PRINT%PROGRAM_RUN_INFO", extension=
".mmLog")
128 IF (index_outfile > 0)
WRITE (index_outfile, *)
"Fermi", gcn_weight2*weight*weight/sum_weight
130 "PRINT%PROGRAM_RUN_INFO")
138 drji2 = dot_product(rji, rji)
139 IF (gcn_weight .NE. 0.0)
THEN
142 cosalpha = dot_product(rji, nvec)/sqrt(drji2)
143 IF (cosalpha < -1.0_dp) cosalpha = -1.0_dp
144 IF (cosalpha > +1.0_dp) cosalpha = +1.0_dp
145 sinalpha = sin(acos(cosalpha))
148 vgaussian = gcn_weight*(-1.0_dp*gal%epsilon*exp(-gal%bz*drji2*cosalpha*cosalpha &
149 - gal%bxy*drji2*sinalpha*sinalpha))
154 vtt = gal%a*exp(-gal%b*sqrt(drji2)) - (1.0 - exp(-gal%b*sqrt(drji2)) &
155 - gal%b*sqrt(drji2)*exp(-gal%b*sqrt(drji2)) &
156 - (((gal%b*sqrt(drji2))**2)/2)*exp(-gal%b*sqrt(drji2)) &
157 - (((gal%b*sqrt(drji2))**3)/6)*exp(-gal%b*sqrt(drji2)) &
158 - (((gal%b*sqrt(drji2))**4)/24)*exp(-gal%b*sqrt(drji2)) &
159 - (((gal%b*sqrt(drji2))**5)/120)*exp(-gal%b*sqrt(drji2)) &
160 - (((gal%b*sqrt(drji2))**6)/720)*exp(-gal%b*sqrt(drji2))) &
161 *gal%c/(sqrt(drji2)**6)
164 IF (gal%express)
THEN
167 "PRINT%PROGRAM_RUN_INFO", extension=
".mmLog")
168 IF (index_outfile > 0)
WRITE (index_outfile, *)
"Gau", gcn_weight*(-1.0_dp*exp(-gal%bz*drji2*cosalpha*cosalpha &
169 - gal%bxy*drji2*sinalpha*sinalpha))
170 IF (weight == 0 .AND. index_outfile > 0)
WRITE (index_outfile, *)
"Fermi 0"
171 IF (index_outfile > 0)
WRITE (index_outfile, *)
"expO", exp(-gal%b*sqrt(drji2))
172 IF (index_outfile > 0)
WRITE (index_outfile, *)
"cstpart", -(1.0 - exp(-gal%b*sqrt(drji2)) &
173 - gal%b*sqrt(drji2)*exp(-gal%b*sqrt(drji2)) &
174 - (((gal%b*sqrt(drji2))**2)/2)*exp(-gal%b*sqrt(drji2)) &
175 - (((gal%b*sqrt(drji2))**3)/6)*exp(-gal%b*sqrt(drji2)) &
176 - (((gal%b*sqrt(drji2))**4)/24)*exp(-gal%b*sqrt(drji2)) &
177 - (((gal%b*sqrt(drji2))**5)/120)*exp(-gal%b*sqrt(drji2)) &
178 - (((gal%b*sqrt(drji2))**6)/720)*exp(-gal%b*sqrt(drji2))) &
179 *gal%c/(sqrt(drji2)**6)
181 "PRINT%PROGRAM_RUN_INFO")
184 pot_loc = vgaussian + vang + vtt
204 FUNCTION normale(gal, r_last_update_pbc, jparticle, particle_set, cell)
205 TYPE(gal_pot_type),
POINTER :: gal
206 TYPE(pos_type),
DIMENSION(:),
POINTER :: r_last_update_pbc
207 INTEGER,
INTENT(IN) :: jparticle
208 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
209 TYPE(cell_type),
POINTER :: cell
210 REAL(kind=
dp) :: normale(3)
212 CHARACTER(LEN=2) :: element_symbol_k
213 INTEGER :: kparticle, natom
214 REAL(kind=
dp) :: drjk2, rjk(3)
216 natom =
SIZE(particle_set)
219 DO kparticle = 1, natom
220 IF (kparticle == jparticle) cycle
221 CALL get_atomic_kind(atomic_kind=particle_set(kparticle)%atomic_kind, &
222 element_symbol=element_symbol_k)
223 IF (element_symbol_k /= gal%met1 .AND. element_symbol_k /= gal%met2) cycle
224 rjk(:) =
pbc(r_last_update_pbc(jparticle)%r(:), r_last_update_pbc(kparticle)%r(:), cell)
225 drjk2 = dot_product(rjk, rjk)
226 IF (drjk2 > gal%rcutsq) cycle
227 normale(:) = normale(:) - rjk(:)
231 normale(:) = normale(:)/sqrt(dot_product(normale, normale))
247 FUNCTION somme(gal, r_last_update_pbc, iparticle, particle_set, cell)
248 TYPE(gal_pot_type),
POINTER :: gal
249 TYPE(pos_type),
DIMENSION(:),
POINTER :: r_last_update_pbc
250 INTEGER,
INTENT(IN) :: iparticle
251 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
252 TYPE(cell_type),
POINTER :: cell
253 REAL(kind=
dp) :: somme
255 CHARACTER(LEN=2) :: element_symbol_k
256 INTEGER :: kparticle, natom
257 REAL(kind=
dp) :: rki(3)
259 natom =
SIZE(particle_set)
262 DO kparticle = 1, natom
263 CALL get_atomic_kind(atomic_kind=particle_set(kparticle)%atomic_kind, &
264 element_symbol=element_symbol_k)
265 IF (element_symbol_k /= gal%met1 .AND. element_symbol_k /= gal%met2) cycle
266 rki(:) =
pbc(r_last_update_pbc(kparticle)%r(:), r_last_update_pbc(iparticle)%r(:), cell)
267 IF (sqrt(dot_product(rki, rki)) > gal%rcutsq) cycle
268 IF (element_symbol_k == gal%met1) somme = somme + exp(-sqrt(dot_product(rki, rki))/gal%r1)
269 IF (element_symbol_k == gal%met2) somme = somme + exp(-sqrt(dot_product(rki, rki))/gal%r2)
291 FUNCTION angular(gal, r_last_update_pbc, iparticle, cell, particle_set, nvec, energy, mm_section)
292 TYPE(gal_pot_type),
POINTER :: gal
293 TYPE(pos_type),
DIMENSION(:),
POINTER :: r_last_update_pbc
294 INTEGER,
INTENT(IN) :: iparticle
295 TYPE(cell_type),
POINTER :: cell
296 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
297 REAL(kind=
dp),
DIMENSION(3) :: nvec
299 TYPE(section_vals_type),
POINTER :: mm_section
300 REAL(kind=
dp) :: angular
302 CHARACTER(LEN=2) :: element_symbol
303 INTEGER :: count_h, iatom, index_h1, index_h2, &
305 REAL(kind=
dp) :: costheta, h_max_dist, rih(3), rih1(3), &
306 rih2(3), rix(3), theta
307 TYPE(cp_logger_type),
POINTER :: logger
313 natom =
SIZE(particle_set)
317 element_symbol=element_symbol)
318 IF (element_symbol /=
"H") cycle
319 rih(:) =
pbc(r_last_update_pbc(iparticle)%r(:), r_last_update_pbc(iatom)%r(:), cell)
320 IF (sqrt(dot_product(rih, rih)) >= h_max_dist) cycle
321 count_h = count_h + 1
322 IF (count_h == 1)
THEN
324 ELSEIF (count_h == 2)
THEN
330 IF (count_h /= 2)
THEN
331 CALL cp_abort(__location__, &
332 " Error: Found "//cp_to_string(count_h)//
" H atoms for O atom "//cp_to_string(iparticle))
335 rih1(:) =
pbc(r_last_update_pbc(iparticle)%r(:), r_last_update_pbc(index_h1)%r(:), cell)
336 rih2(:) =
pbc(r_last_update_pbc(iparticle)%r(:), r_last_update_pbc(index_h2)%r(:), cell)
337 rix(:) = rih1(:) + rih2(:)
338 costheta = dot_product(rix, nvec)/sqrt(dot_product(rix, rix))
339 IF (costheta < -1.0_dp) costheta = -1.0_dp
340 IF (costheta > +1.0_dp) costheta = +1.0_dp
341 theta = acos(costheta)
342 angular = gal%a1*costheta + gal%a2*cos(2.0_dp*theta) + gal%a3*cos(3.0_dp*theta) &
343 + gal%a4*cos(4.0_dp*theta)
346 IF (gal%express .AND. energy)
THEN
349 "PRINT%PROGRAM_RUN_INFO", extension=
".mmLog")
351 IF (index_outfile > 0)
WRITE (index_outfile, *)
"Fourier", costheta, cos(2.0_dp*theta), cos(3.0_dp*theta), &
355 "PRINT%PROGRAM_RUN_INFO")
372 SUBROUTINE gal_forces(gal, r_last_update_pbc, iparticle, jparticle, f_nonbond, use_virial, cell, particle_set)
373 TYPE(gal_pot_type),
POINTER :: gal
374 TYPE(pos_type),
DIMENSION(:),
POINTER :: r_last_update_pbc
375 INTEGER,
INTENT(IN) :: iparticle, jparticle
376 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(INOUT) :: f_nonbond
377 LOGICAL,
INTENT(IN) :: use_virial
378 TYPE(cell_type),
POINTER :: cell
379 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
381 CHARACTER(LEN=2) :: element_symbol
382 REAL(kind=
dp) :: anglepart, cosalpha, dgauss(3), drji, drjicosalpha(3), drjisinalpha(3), &
383 dtt(3), dweight(3), gcn_weight, gcn_weight2, nvec(3), prefactor, rji(3), rji_hat(3), &
384 sinalpha, sum_weight, vgaussian, weight
385 TYPE(section_vals_type),
POINTER :: mm_section
387 CALL get_atomic_kind(atomic_kind=particle_set(iparticle)%atomic_kind, &
388 element_symbol=element_symbol)
390 IF (element_symbol ==
"O")
THEN
392 rji(:) =
pbc(r_last_update_pbc(jparticle)%r(:), r_last_update_pbc(iparticle)%r(:), cell)
393 drji = sqrt(dot_product(rji, rji))
394 rji_hat(:) = rji(:)/drji
396 IF (.NOT.
ALLOCATED(gal%n_vectors))
THEN
397 ALLOCATE (gal%n_vectors(3,
SIZE(particle_set)))
398 gal%n_vectors(:, :) = 0.0_dp
403 IF (gal%gcn(jparticle) < 9.0_dp) gcn_weight = 1.0_dp
405 IF (gal%gcn(jparticle) < 11.5_dp) gcn_weight2 = 1.0_dp
408 IF (gcn_weight2 .NE. 0.0)
THEN
411 IF (gal%n_vectors(1, jparticle) == 0.0_dp .AND. &
412 gal%n_vectors(2, jparticle) == 0.0_dp .AND. &
413 gal%n_vectors(3, jparticle) == 0.0_dp)
THEN
414 gal%n_vectors(:, jparticle) = normale(gal, r_last_update_pbc, jparticle, &
418 nvec(:) = gal%n_vectors(:, jparticle)
421 sum_weight = somme(gal, r_last_update_pbc, iparticle, particle_set, cell)
424 weight = exp(-drji/gal%r1)
425 dweight(:) = 1.0_dp/gal%r1*weight*rji_hat(:)
429 anglepart = angular(gal, r_last_update_pbc, iparticle, cell, particle_set, nvec, .false., mm_section)
432 IF (weight /= 0)
THEN
434 f_nonbond(1:3, iparticle) = gcn_weight2*f_nonbond(1:3, iparticle) + 2.0_dp*dweight(1:3)*weight* &
438 CALL somme_d(gal, r_last_update_pbc, iparticle, jparticle, &
439 f_nonbond, particle_set, cell, anglepart, sum_weight)
441 prefactor = (-1.0_dp)*gcn_weight2*weight*weight/sum_weight
444 CALL angular_d(gal, r_last_update_pbc, iparticle, jparticle, &
445 f_nonbond, prefactor, cell, particle_set, nvec)
452 IF (gcn_weight .NE. 0.0)
THEN
454 cosalpha = dot_product(rji, nvec)/drji
455 IF (cosalpha < -1.0_dp) cosalpha = -1.0_dp
456 IF (cosalpha > +1.0_dp) cosalpha = +1.0_dp
457 sinalpha = sin(acos(cosalpha))
460 vgaussian = gcn_weight*(-1.0_dp*gal%epsilon*exp(-gal%bz*dot_product(rji, rji)*cosalpha*cosalpha &
461 - gal%bxy*dot_product(rji, rji)*sinalpha*sinalpha))
464 drjicosalpha(:) = rji_hat(:)*cosalpha + nvec(:) - cosalpha*rji_hat(:)
465 drjisinalpha(:) = rji_hat(:)*sinalpha - (cosalpha/sinalpha)*(nvec(:) - cosalpha*rji_hat(:))
466 dgauss(:) = (-1.0_dp*gal%bz*2*drji*cosalpha*drjicosalpha - &
467 1.0_dp*gal%bxy*2*drji*sinalpha*drjisinalpha)*vgaussian*(-1.0_dp)
470 f_nonbond(1:3, iparticle) = f_nonbond(1:3, iparticle) + dgauss(1:3)
476 dtt(:) = (-(gal%a*gal%b + (gal%b**7)*gal%c/720)*exp(-gal%b*drji) + 6*(gal%c/drji**7)* &
477 (1.0 - exp(-gal%b*drji) &
478 - gal%b*drji*exp(-gal%b*drji) &
479 - (((gal%b*drji)**2)/2)*exp(-gal%b*drji) &
480 - (((gal%b*drji)**3)/6)*exp(-gal%b*drji) &
481 - (((gal%b*drji)**4)/24)*exp(-gal%b*drji) &
482 - (((gal%b*drji)**5)/120)*exp(-gal%b*drji) &
483 - (((gal%b*drji)**6)/720)*exp(-gal%b*drji)) &
487 f_nonbond(1:3, iparticle) = f_nonbond(1:3, iparticle) - dtt(1:3)
489 IF (use_virial)
CALL cp_abort(__location__,
"using virial with gal"// &
511 SUBROUTINE somme_d(gal, r_last_update_pbc, iparticle, jparticle, &
512 f_nonbond, particle_set, cell, anglepart, sum_weight)
513 TYPE(gal_pot_type),
POINTER :: gal
514 TYPE(pos_type),
DIMENSION(:),
POINTER :: r_last_update_pbc
515 INTEGER,
INTENT(IN) :: iparticle, jparticle
516 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(INOUT) :: f_nonbond
517 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
518 TYPE(cell_type),
POINTER :: cell
519 REAL(kind=
dp),
INTENT(IN) :: anglepart, sum_weight
521 CHARACTER(LEN=2) :: element_symbol_k
522 INTEGER :: kparticle, natom
523 REAL(kind=
dp) :: drki, dwdr(3), rji(3), rki(3), &
524 rki_hat(3), weight_rji
526 rji(:) =
pbc(r_last_update_pbc(jparticle)%r(:), r_last_update_pbc(iparticle)%r(:), cell)
527 weight_rji = exp(-sqrt(dot_product(rji, rji))/gal%r1)
529 natom =
SIZE(particle_set)
530 DO kparticle = 1, natom
531 CALL get_atomic_kind(atomic_kind=particle_set(kparticle)%atomic_kind, &
532 element_symbol=element_symbol_k)
533 IF (element_symbol_k /= gal%met1 .AND. element_symbol_k /= gal%met2) cycle
534 rki(:) =
pbc(r_last_update_pbc(kparticle)%r(:), r_last_update_pbc(iparticle)%r(:), cell)
535 IF (sqrt(dot_product(rki, rki)) > gal%rcutsq) cycle
536 drki = sqrt(dot_product(rki, rki))
537 rki_hat(:) = rki(:)/drki
539 IF (element_symbol_k == gal%met1) dwdr(:) = (-1.0_dp)*(1.0_dp/gal%r1)*exp(-drki/gal%r1)*rki_hat(:)
540 IF (element_symbol_k == gal%met2) dwdr(:) = (-1.0_dp)*(1.0_dp/gal%r2)*exp(-drki/gal%r2)*rki_hat(:)
542 f_nonbond(1:3, iparticle) = f_nonbond(1:3, iparticle) + dwdr(1:3)*weight_rji &
543 *weight_rji*anglepart/(sum_weight**2)
546 END SUBROUTINE somme_d
562 SUBROUTINE angular_d(gal, r_last_update_pbc, iparticle, jparticle, f_nonbond, &
563 prefactor, cell, particle_set, nvec)
564 TYPE(gal_pot_type),
POINTER :: gal
565 TYPE(pos_type),
DIMENSION(:),
POINTER :: r_last_update_pbc
566 INTEGER,
INTENT(IN) :: iparticle, jparticle
567 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(INOUT) :: f_nonbond
568 REAL(kind=
dp),
INTENT(IN) :: prefactor
569 TYPE(cell_type),
POINTER :: cell
570 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
571 REAL(kind=
dp),
DIMENSION(3) :: nvec
573 CHARACTER(LEN=2) :: element_symbol
574 INTEGER :: count_h, iatom, index_h1, index_h2, natom
575 REAL(kind=
dp) :: costheta, dsumdtheta, h_max_dist, theta
576 REAL(kind=
dp),
DIMENSION(3) :: dangular, dcostheta, rih, rih1, rih2, &
577 rix, rix_hat, rji, rji_hat
583 natom =
SIZE(particle_set)
587 element_symbol=element_symbol)
588 IF (element_symbol /=
"H") cycle
589 rih(:) =
pbc(r_last_update_pbc(iparticle)%r(:), r_last_update_pbc(iatom)%r(:), cell)
590 IF (sqrt(dot_product(rih, rih)) >= h_max_dist) cycle
591 count_h = count_h + 1
592 IF (count_h == 1)
THEN
594 ELSEIF (count_h == 2)
THEN
600 IF (count_h /= 2)
THEN
601 CALL cp_abort(__location__, &
602 " Error: Found "//cp_to_string(count_h)//
" H atoms for O atom "//cp_to_string(iparticle))
605 rji(:) =
pbc(r_last_update_pbc(jparticle)%r(:), r_last_update_pbc(iparticle)%r(:), cell)
606 rji_hat(:) = rji(:)/sqrt(dot_product(rji, rji))
609 rih1(:) =
pbc(r_last_update_pbc(iparticle)%r(:), r_last_update_pbc(index_h1)%r(:), cell)
610 rih2(:) =
pbc(r_last_update_pbc(iparticle)%r(:), r_last_update_pbc(index_h2)%r(:), cell)
611 rix(:) = rih1(:) + rih2(:)
612 rix_hat(:) = rix(:)/sqrt(dot_product(rix, rix))
613 costheta = dot_product(rix, nvec)/sqrt(dot_product(rix, rix))
614 IF (costheta < -1.0_dp) costheta = -1.0_dp
615 IF (costheta > +1.0_dp) costheta = +1.0_dp
616 theta = acos(costheta)
619 dsumdtheta = -1.0_dp*gal%a1*sin(theta) - gal%a2*2.0_dp*sin(2.0_dp*theta) - &
620 gal%a3*3.0_dp*sin(3.0_dp*theta) - gal%a4*4.0_dp*sin(4.0_dp*theta)
621 dcostheta(:) = (1.0_dp/sqrt(dot_product(rix, rix)))*(nvec(:) - costheta*rix_hat(:))
622 dangular(:) = prefactor*dsumdtheta*(-1.0_dp/sin(theta))*dcostheta(:)
625 f_nonbond(1:3, iparticle) = f_nonbond(1:3, iparticle) - dangular(1:3)*2.0_dp
626 f_nonbond(1:3, index_h1) = f_nonbond(1:3, index_h1) + dangular(1:3)
627 f_nonbond(1:3, index_h2) = f_nonbond(1:3, index_h2) + dangular(1:3)
629 END SUBROUTINE angular_d
642 glob_loc_list_a, cell)
643 TYPE(fist_neighbor_type),
POINTER :: nonbonded
644 TYPE(pair_potential_pp_type),
POINTER :: potparm
645 INTEGER,
DIMENSION(:, :),
POINTER :: glob_loc_list
646 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: glob_cell_v
647 INTEGER,
DIMENSION(:),
POINTER :: glob_loc_list_a
648 TYPE(cell_type),
POINTER :: cell
650 CHARACTER(LEN=*),
PARAMETER :: routinen =
'setup_gal_arrays'
652 INTEGER :: handle, i, iend, igrp, ikind, ilist, &
653 ipair, istart, jkind, nkinds, npairs, &
655 INTEGER,
DIMENSION(:),
POINTER :: work_list, work_list2
656 INTEGER,
DIMENSION(:, :),
POINTER ::
list
657 REAL(kind=
dp),
DIMENSION(3) :: cell_v, cvi
658 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: rwork_list
659 TYPE(neighbor_kind_pairs_type),
POINTER :: neighbor_kind_pair
660 TYPE(pair_potential_single_type),
POINTER :: pot
662 cpassert(.NOT.
ASSOCIATED(glob_loc_list))
663 cpassert(.NOT.
ASSOCIATED(glob_loc_list_a))
664 cpassert(.NOT.
ASSOCIATED(glob_cell_v))
665 CALL timeset(routinen, handle)
667 nkinds =
SIZE(potparm%pot, 1)
668 DO ilist = 1, nonbonded%nlists
669 neighbor_kind_pair => nonbonded%neighbor_kind_pairs(ilist)
670 npairs = neighbor_kind_pair%npairs
671 IF (npairs == 0) cycle
672 kind_group_loop1:
DO igrp = 1, neighbor_kind_pair%ngrp_kind
673 istart = neighbor_kind_pair%grp_kind_start(igrp)
674 iend = neighbor_kind_pair%grp_kind_end(igrp)
675 ikind = neighbor_kind_pair%ij_kind(1, igrp)
676 jkind = neighbor_kind_pair%ij_kind(2, igrp)
677 pot => potparm%pot(ikind, jkind)%pot
678 npairs = iend - istart + 1
680 DO i = 1,
SIZE(pot%type)
681 IF (pot%type(i) ==
gal_type) npairs_tot = npairs_tot + npairs
683 END DO kind_group_loop1
685 ALLOCATE (work_list(npairs_tot))
686 ALLOCATE (work_list2(npairs_tot))
687 ALLOCATE (glob_loc_list(2, npairs_tot))
688 ALLOCATE (glob_cell_v(3, npairs_tot))
691 DO ilist = 1, nonbonded%nlists
692 neighbor_kind_pair => nonbonded%neighbor_kind_pairs(ilist)
693 npairs = neighbor_kind_pair%npairs
694 IF (npairs == 0) cycle
695 kind_group_loop2:
DO igrp = 1, neighbor_kind_pair%ngrp_kind
696 istart = neighbor_kind_pair%grp_kind_start(igrp)
697 iend = neighbor_kind_pair%grp_kind_end(igrp)
698 ikind = neighbor_kind_pair%ij_kind(1, igrp)
699 jkind = neighbor_kind_pair%ij_kind(2, igrp)
700 list => neighbor_kind_pair%list
701 cvi = neighbor_kind_pair%cell_vector
702 pot => potparm%pot(ikind, jkind)%pot
703 npairs = iend - istart + 1
705 cell_v = matmul(cell%hmat, cvi)
706 DO i = 1,
SIZE(pot%type)
710 glob_loc_list(:, npairs_tot + ipair) =
list(:, istart - 1 + ipair)
711 glob_cell_v(1:3, npairs_tot + ipair) = cell_v(1:3)
713 npairs_tot = npairs_tot + npairs
716 END DO kind_group_loop2
719 CALL sort(glob_loc_list(1, :), npairs_tot, work_list)
720 DO ipair = 1, npairs_tot
721 work_list2(ipair) = glob_loc_list(2, work_list(ipair))
723 glob_loc_list(2, :) = work_list2
724 DEALLOCATE (work_list2)
725 ALLOCATE (rwork_list(3, npairs_tot))
726 DO ipair = 1, npairs_tot
727 rwork_list(:, ipair) = glob_cell_v(:, work_list(ipair))
729 glob_cell_v = rwork_list
730 DEALLOCATE (rwork_list)
731 DEALLOCATE (work_list)
732 ALLOCATE (glob_loc_list_a(npairs_tot))
733 glob_loc_list_a = glob_loc_list(1, :)
734 CALL timestop(handle)
744 INTEGER,
DIMENSION(:, :),
POINTER :: glob_loc_list
745 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: glob_cell_v
746 INTEGER,
DIMENSION(:),
POINTER :: glob_loc_list_a
748 IF (
ASSOCIATED(glob_loc_list))
THEN
749 DEALLOCATE (glob_loc_list)
751 IF (
ASSOCIATED(glob_loc_list_a))
THEN
752 DEALLOCATE (glob_loc_list_a)
754 IF (
ASSOCIATED(glob_cell_v))
THEN
755 DEALLOCATE (glob_cell_v)
771 INTEGER,
INTENT(INOUT) :: nr_ions
772 TYPE(section_vals_type),
POINTER :: mm_section
773 TYPE(mp_para_env_type),
OPTIONAL,
POINTER :: para_env
774 LOGICAL,
INTENT(IN) :: print_oh, print_h3o, print_o
777 TYPE(cp_logger_type),
POINTER :: logger
781 CALL para_env%sum(nr_ions)
787 IF (iw > 0 .AND. nr_ions > 0 .AND. print_oh)
THEN
788 WRITE (iw,
'(/,A,T71,I10,/)')
" gal: number of OH- ions at surface", nr_ions
790 IF (iw > 0 .AND. nr_ions > 0 .AND. print_h3o)
THEN
791 WRITE (iw,
'(/,A,T71,I10,/)')
" gal: number of H3O+ ions at surface", nr_ions
793 IF (iw > 0 .AND. nr_ions > 0 .AND. print_o)
THEN
794 WRITE (iw,
'(/,A,T71,I10,/)')
" gal: number of O^2- ions at surface", nr_ions
subroutine pbc(r, r_pbc, s, s_pbc, a, b, c, alpha, beta, gamma, debug, info, pbc0, h, hinv)
...
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,...
Define the neighbor list data types and the corresponding functionality.
Defines the basic variable types.
integer, parameter, public dp
An array-based list which grows on demand. When the internal array is full, a new array of twice the ...
Implementation of the GAL19 potential.
subroutine, public print_nr_ions_gal(nr_ions, mm_section, para_env, print_oh, print_h3o, print_o)
prints the number of OH- ions or H3O+ ions near surface
subroutine, public destroy_gal_arrays(glob_loc_list, glob_cell_v, glob_loc_list_a)
...
subroutine, public setup_gal_arrays(nonbonded, potparm, glob_loc_list, glob_cell_v, glob_loc_list_a, cell)
...
subroutine, public gal_energy(pot_loc, gal, r_last_update_pbc, iparticle, jparticle, cell, particle_set, mm_section)
Main part of the energy evaluation of GAL19.
subroutine, public gal_forces(gal, r_last_update_pbc, iparticle, jparticle, f_nonbond, use_virial, cell, particle_set)
forces generated by the GAL19 potential
Interface to the message passing library MPI.
integer, parameter, public gal_type
Define the data structure for the particle information.
All kind of helpful little routines.