113 TYPE(debug_variables_type),
INTENT(INOUT), &
116 CHARACTER(len=*),
PARAMETER :: routinen =
'fist_calc_energy_force'
118 INTEGER :: do_ipol, ewald_type, fg_coulomb_size, handle, i, ii, ikind, iparticle_kind, &
119 iparticle_local, iw, iw2, j, natoms, nlocal_particles, node, nparticle_kind, &
120 nparticle_local, nshell, shell_index
121 LOGICAL :: do_multipoles, shell_model_ad, &
122 shell_present, use_virial
123 REAL(kind=
dp) :: ef_ener, fc, fs, mass, pot_bend, pot_bond, pot_imptors, pot_manybody, &
124 pot_nonbond, pot_opbend, pot_shell, pot_torsion, pot_urey_bradley, vg_coulomb, xdum1, &
126 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: ef_f, f_nonbond, f_total, fcore_nonbond, &
127 fcore_shell_bonded, fcore_total, fg_coulomb, fgcore_coulomb, fgshell_coulomb, &
128 fshell_nonbond, fshell_total
129 REAL(kind=
dp),
DIMENSION(3, 3) :: ef_pv, ident, pv_bc, pv_bend, pv_bond, &
130 pv_g, pv_imptors, pv_nonbond, &
131 pv_opbend, pv_torsion, pv_urey_bradley
132 REAL(kind=
dp),
DIMENSION(:),
POINTER :: e_coulomb
150 TYPE(
particle_type),
DIMENSION(:),
POINTER :: core_particle_set, particle_set, &
157 CALL timeset(routinen, handle)
159 NULLIFY (subsys, virial, atprop_env, para_env, force_env_section)
165 input=force_env_section)
171 use_virial = virial%pv_availability .AND. (.NOT. virial%pv_numer)
172 NULLIFY (atomic_kind, atomic_kind_set, cell, ewald_pw, ewald_env, &
173 fist_nonbond_env, mm_section, local_molecules, local_particles, &
174 molecule_kind_set, molecule_set, particle_set, print_section, &
175 shell, shell_particle_set, core_particle_set, thermo, multipoles, &
184 CALL fist_env_get(fist_env, ewald_pw=ewald_pw, ewald_env=ewald_env, &
185 local_particles=local_particles, particle_set=particle_set, &
186 atomic_kind_set=atomic_kind_set, molecule_set=molecule_set, &
187 local_molecules=local_molecules, thermo=thermo, &
188 molecule_kind_set=molecule_kind_set, fist_nonbond_env=fist_nonbond_env, &
189 cell=cell, shell_model=shell_present, shell_model_ad=shell_model_ad, &
190 multipoles=multipoles, exclusions=exclusions, efield=efield)
192 CALL ewald_env_get(ewald_env, ewald_type=ewald_type, do_multipoles=do_multipoles, &
199 natoms =
SIZE(particle_set)
201 nparticle_kind =
SIZE(atomic_kind_set)
202 DO ikind = 1, nparticle_kind
203 nlocal_particles = nlocal_particles + local_particles%n_el(ikind)
206 ALLOCATE (f_nonbond(3, natoms))
210 IF (shell_present)
THEN
211 CALL fist_env_get(fist_env, shell_particle_set=shell_particle_set, &
212 core_particle_set=core_particle_set)
213 cpassert(
ASSOCIATED(shell_particle_set))
214 cpassert(
ASSOCIATED(core_particle_set))
215 nshell =
SIZE(shell_particle_set)
216 ALLOCATE (fshell_nonbond(3, nshell))
217 fshell_nonbond = 0.0_dp
218 ALLOCATE (fcore_nonbond(3, nshell))
219 fcore_nonbond = 0.0_dp
221 NULLIFY (shell_particle_set, core_particle_set)
224 IF (fist_nonbond_env%do_nonbonded)
THEN
226 IF (
ASSOCIATED(exclusions))
THEN
227 CALL list_control(atomic_kind_set, particle_set, local_particles, &
228 cell, fist_nonbond_env, para_env, mm_section, shell_particle_set, &
229 core_particle_set, exclusions=exclusions)
231 CALL list_control(atomic_kind_set, particle_set, local_particles, &
232 cell, fist_nonbond_env, para_env, mm_section, shell_particle_set, &
239 particle_set(i)%f(1) = 0.0_dp
240 particle_set(i)%f(2) = 0.0_dp
241 particle_set(i)%f(3) = 0.0_dp
245 shell_particle_set(i)%f(1) = 0.0_dp
246 shell_particle_set(i)%f(2) = 0.0_dp
247 shell_particle_set(i)%f(3) = 0.0_dp
248 core_particle_set(i)%f(1) = 0.0_dp
249 core_particle_set(i)%f(2) = 0.0_dp
250 core_particle_set(i)%f(3) = 0.0_dp
261 pv_urey_bradley = 0.0_dp
264 virial%pv_virial = 0.0_dp
268 pot_manybody = 0.0_dp
274 pot_urey_bradley = 0.0_dp
278 thermo%harm_shell = 0.0_dp
282 WRITE (iw,
'(A)')
" FIST:: FORCES IN INPUT..."
283 WRITE (iw,
'(3f15.9)') ((particle_set(i)%f(j), j=1, 3), i=1,
SIZE(particle_set))
286 IF (fist_nonbond_env%do_nonbonded)
THEN
291 CALL energy_manybody(fist_nonbond_env, atomic_kind_set, local_particles, particle_set, &
292 cell, pot_manybody, para_env, mm_section, use_virial)
295 IF (shell_present)
THEN
296 CALL force_nonbond(fist_nonbond_env, ewald_env, particle_set, cell, &
297 pot_nonbond, f_nonbond, pv_nonbond, &
298 fshell_nonbond=fshell_nonbond, fcore_nonbond=fcore_nonbond, &
299 atprop_env=atprop_env, &
300 atomic_kind_set=atomic_kind_set, use_virial=use_virial)
302 CALL force_nonbond(fist_nonbond_env, ewald_env, particle_set, cell, &
303 pot_nonbond, f_nonbond, pv_nonbond, atprop_env=atprop_env, &
304 atomic_kind_set=atomic_kind_set, use_virial=use_virial)
306 use_virial=use_virial)
311 WRITE (iw,
'(A)')
" FIST:: NONBOND + R-SPACE ELECTROSTATIC FORCES ..."
312 WRITE (iw,
'(3f15.9)') f_nonbond
313 IF (shell_present .AND. shell_model_ad)
THEN
314 WRITE (iw,
'(A)')
" FIST:: SHELL NONBOND + R-SPACE ELECTROSTATIC FORCES ..."
315 WRITE (iw,
'(3f15.9)') fshell_nonbond
316 WRITE (iw,
'(A)')
" FIST:: CORE NONBOND + R-SPACE ELECTROSTATIC FORCES ..."
317 WRITE (iw,
'(3f15.9)') fcore_nonbond
324 SELECT CASE (ewald_type)
326 fg_coulomb_size = nlocal_particles
328 fg_coulomb_size = natoms
331 ALLOCATE (fg_coulomb(3, fg_coulomb_size))
333 IF (shell_present)
THEN
334 ALLOCATE (fgshell_coulomb(3, nshell))
335 ALLOCATE (fgcore_coulomb(3, nshell))
336 fgshell_coulomb = 0.0_dp
337 fgcore_coulomb = 0.0_dp
339 IF (shell_present .AND. do_multipoles)
THEN
340 cpabort(
"Multipoles and Core-Shell model not implemented.")
344 IF (.NOT. do_multipoles)
THEN
345 CALL ewald_self(ewald_env, cell, atomic_kind_set, local_particles, &
346 thermo%e_self, thermo%e_neut, fist_nonbond_env%charges)
347 IF (atprop_env%energy)
THEN
349 atprop_env%atener, fist_nonbond_env%charges)
350 atprop_env%atener = atprop_env%atener + thermo%e_neut/
SIZE(atprop_env%atener)
357 IF (
ASSOCIATED(fist_nonbond_env%charges))
THEN
358 cpabort(
"Polarizable force field and array charges not implemented!")
362 ewald_pw, fist_nonbond_env, cell, particle_set, &
363 local_particles, thermo, vg_coulomb, pot_nonbond, f_nonbond, &
364 fg_coulomb, use_virial, pv_g, pv_nonbond, mm_section, do_ipol)
367 SELECT CASE (ewald_type)
370 IF (shell_present)
THEN
372 IF (
ASSOCIATED(fist_nonbond_env%charges))
THEN
373 cpabort(
"Core-Shell and array charges not implemented!")
375 IF (do_multipoles)
THEN
376 cpabort(
"Multipole Ewald and CORE-SHELL not yet implemented within Ewald sum!")
378 cpabort(
"Core-Shell model not yet implemented within Ewald sums.")
381 IF (do_multipoles)
THEN
383 IF (
ASSOCIATED(fist_nonbond_env%charges))
THEN
384 cpabort(
"Multipole Ewald and array charges not implemented!")
387 particle_set, local_particles, vg_coulomb, pot_nonbond, thermo%e_neut, &
388 thermo%e_self, multipoles%task, do_correction_bonded=.true., do_forces=.true., &
389 do_stress=use_virial, do_efield=.false., radii=multipoles%radii, &
390 charges=multipoles%charges, dipoles=multipoles%dipoles, &
391 quadrupoles=multipoles%quadrupoles, forces_local=fg_coulomb, &
392 forces_glob=f_nonbond, pv_local=pv_g, pv_glob=pv_nonbond, iw=iw2, &
393 do_debug=.true., atomic_kind_set=atomic_kind_set, mm_section=mm_section)
395 IF (atprop_env%energy)
THEN
396 ALLOCATE (e_coulomb(fg_coulomb_size))
398 CALL ewald_evaluate(ewald_env, ewald_pw, cell, atomic_kind_set, particle_set, &
399 local_particles, fg_coulomb, vg_coulomb, pv_g, use_virial=use_virial, &
400 charges=fist_nonbond_env%charges, e_coulomb=e_coulomb)
405 IF (shell_present)
THEN
407 IF (
ASSOCIATED(fist_nonbond_env%charges))
THEN
408 cpabort(
"Core-Shell and array charges not implemented!")
410 IF (do_multipoles)
THEN
411 cpabort(
"Multipole Ewald and CORE-SHELL not yet implemented within a PME scheme!")
413 CALL pme_evaluate(ewald_env, ewald_pw, cell, particle_set, vg_coulomb, fg_coulomb, &
414 pv_g, shell_particle_set=shell_particle_set, core_particle_set=core_particle_set, &
415 fgshell_coulomb=fgshell_coulomb, fgcore_coulomb=fgcore_coulomb, use_virial=use_virial, &
417 CALL para_env%sum(fgshell_coulomb)
418 CALL para_env%sum(fgcore_coulomb)
421 IF (do_multipoles)
THEN
422 cpabort(
"Multipole Ewald not yet implemented within a PME scheme!")
424 CALL pme_evaluate(ewald_env, ewald_pw, cell, particle_set, vg_coulomb, fg_coulomb, &
425 pv_g, use_virial=use_virial, charges=fist_nonbond_env%charges, &
429 CALL para_env%sum(fg_coulomb)
432 IF (shell_present)
THEN
434 IF (
ASSOCIATED(fist_nonbond_env%charges))
THEN
435 cpabort(
"Core-Shell and array charges not implemented!")
437 IF (do_multipoles)
THEN
438 cpabort(
"Multipole Ewald and CORE-SHELL not yet implemented within a SPME scheme!")
440 CALL spme_evaluate(ewald_env, ewald_pw, cell, particle_set, fg_coulomb, vg_coulomb, &
441 pv_g, shell_particle_set=shell_particle_set, core_particle_set=core_particle_set, &
442 fgshell_coulomb=fgshell_coulomb, fgcore_coulomb=fgcore_coulomb, use_virial=use_virial, &
444 CALL para_env%sum(fgshell_coulomb)
445 CALL para_env%sum(fgcore_coulomb)
448 IF (do_multipoles)
THEN
449 cpabort(
"Multipole Ewald not yet implemented within a SPME scheme!")
451 CALL spme_evaluate(ewald_env, ewald_pw, cell, particle_set, fg_coulomb, vg_coulomb, &
452 pv_g, use_virial=use_virial, charges=fist_nonbond_env%charges, &
456 CALL para_env%sum(fg_coulomb)
463 IF (fist_nonbond_env%do_nonbonded)
THEN
465 IF (shell_present)
THEN
467 local_particles, particle_set, ewald_env, thermo%e_bonded, &
468 pv_bc, shell_particle_set=shell_particle_set, &
469 core_particle_set=core_particle_set, atprop_env=atprop_env, cell=cell, &
470 use_virial=use_virial)
472 IF (.NOT. do_multipoles)
THEN
474 atomic_kind_set, local_particles, particle_set, &
475 ewald_env, thermo%e_bonded, pv_bc=pv_bc, atprop_env=atprop_env, cell=cell, &
476 use_virial=use_virial)
481 IF (.NOT. do_multipoles)
THEN
483 CALL ewald_print(iw2, pot_nonbond, vg_coulomb, thermo%e_self, thermo%e_neut, &
491 thermo%e_neut = 0.0_dp
495 IF (
ALLOCATED(fg_coulomb))
THEN
496 WRITE (iw,
'(A)')
" FIST:: NONBONDED ELECTROSTATIC FORCES IN G-SPACE..."
497 WRITE (iw,
'(3f15.9)') ((fg_coulomb(j, i), j=1, 3), i=1,
SIZE(fg_coulomb, 2))
499 IF (shell_present .AND. shell_model_ad .AND.
ALLOCATED(fgshell_coulomb))
THEN
500 WRITE (iw,
'(A)')
" FIST:: SHELL NONBONDED ELECTROSTATIC FORCES IN G-SPACE..."
501 WRITE (iw,
'(3f15.9)') ((fgshell_coulomb(j, i), j=1, 3), i=1,
SIZE(fgshell_coulomb, 2))
502 WRITE (iw,
'(A)')
" FIST:: CORE NONBONDED ELECTROSTATIC FORCES IN G-SPACE..."
503 WRITE (iw,
'(3f15.9)') ((fgcore_coulomb(j, i), j=1, 3), i=1,
SIZE(fgcore_coulomb, 2))
508 IF (efield%apply_field)
THEN
509 ALLOCATE (ef_f(3, natoms))
511 efield, use_virial=use_virial, iunit=iw, charges=fist_nonbond_env%charges)
515 IF (
PRESENT(debug))
THEN
517 local_molecules, particle_set, shell_particle_set, &
518 core_particle_set, pot_bond, pot_bend, pot_urey_bradley, &
519 pot_torsion, pot_imptors, pot_opbend, pot_shell, pv_bond, pv_bend, &
520 pv_urey_bradley, pv_torsion, pv_imptors, pv_opbend, &
521 debug%f_bond, debug%f_bend, debug%f_torsion, debug%f_ub, &
522 debug%f_imptors, debug%f_opbend, cell, use_virial, atprop_env)
526 local_molecules, particle_set, shell_particle_set, &
527 core_particle_set, pot_bond, pot_bend, pot_urey_bradley, &
528 pot_torsion, pot_imptors, pot_opbend, pot_shell, pv_bond, pv_bend, &
529 pv_urey_bradley, pv_torsion, pv_imptors, pv_opbend, &
530 cell=cell, use_virial=use_virial, atprop_env=atprop_env)
534 IF (shell_present .AND. shell_model_ad)
THEN
535 ALLOCATE (fcore_shell_bonded(3, nshell))
536 fcore_shell_bonded = 0.0_dp
538 shell_index = particle_set(i)%shell_index
539 IF (shell_index /= 0)
THEN
540 fcore_shell_bonded(1:3, shell_index) = particle_set(i)%f(1:3)
543 CALL para_env%sum(fcore_shell_bonded)
545 shell_index = particle_set(i)%shell_index
546 IF (shell_index /= 0)
THEN
547 particle_set(i)%f(1:3) = fcore_shell_bonded(1:3, shell_index)
550 DEALLOCATE (fcore_shell_bonded)
557 WRITE (iw,
'(A)')
" FIST energy contributions in kcal/mol:"
558 WRITE (iw,
'(1x,"BOND = ",f13.4,'// &
559 '2x,"ANGLE = ",f13.4,'// &
560 '2x,"UBRAD = ",f13.4)') xdum1, xdum2, xdum3
564 WRITE (iw,
'(1x,"TORSION = ",f13.4,'// &
565 '2x,"IMPTORS = ",f13.4,'// &
566 '2x,"OPBEND = ",f13.4)') xdum1, xdum2, xdum3
568 WRITE (iw,
'(A)')
" FIST:: CORRECTED BONDED ELECTROSTATIC FORCES + INTERNAL FORCES..."
569 WRITE (iw,
'(3f15.9)') ((particle_set(i)%f(j), j=1, 3), i=1,
SIZE(particle_set))
570 IF (shell_present .AND. shell_model_ad)
THEN
571 WRITE (iw,
'(A)')
" FIST:: SHELL CORRECTED BONDED ELECTROSTATIC FORCES + INTERNAL FORCES..."
572 WRITE (iw,
'(3f15.9)') ((shell_particle_set(i)%f(j), j=1, 3), i=1,
SIZE(shell_particle_set))
573 WRITE (iw,
'(A)')
" FIST:: CORE CORRECTED BONDED ELECTROSTATIC FORCES + INTERNAL FORCES..."
574 WRITE (iw,
'(3f15.9)') ((core_particle_set(i)%f(j), j=1, 3), i=1,
SIZE(core_particle_set))
579 thermo%pot = pot_nonbond + pot_bond + pot_bend + pot_torsion + pot_opbend + &
580 pot_imptors + pot_urey_bradley + pot_manybody + pot_shell
582 CALL para_env%sum(thermo%pot)
584 IF (shell_present)
THEN
585 thermo%harm_shell = pot_shell
586 CALL para_env%sum(thermo%harm_shell)
592 thermo%e_gspace = vg_coulomb
593 thermo%pot = thermo%pot + thermo%e_self + thermo%e_neut
594 thermo%pot = thermo%pot + vg_coulomb + thermo%e_bonded
596 IF (do_ipol /=
do_fist_pol_none) thermo%pot = thermo%pot + thermo%e_induction
605 ALLOCATE (f_total(3, natoms))
608 f_total(1, i) = particle_set(i)%f(1) + f_nonbond(1, i)
609 f_total(2, i) = particle_set(i)%f(2) + f_nonbond(2, i)
610 f_total(3, i) = particle_set(i)%f(3) + f_nonbond(3, i)
612 IF (shell_present)
THEN
613 ALLOCATE (fshell_total(3, nshell))
614 fshell_total = 0.0_dp
615 ALLOCATE (fcore_total(3, nshell))
618 fcore_total(1, i) = core_particle_set(i)%f(1) + fcore_nonbond(1, i)
619 fcore_total(2, i) = core_particle_set(i)%f(2) + fcore_nonbond(2, i)
620 fcore_total(3, i) = core_particle_set(i)%f(3) + fcore_nonbond(3, i)
621 fshell_total(1, i) = shell_particle_set(i)%f(1) + fshell_nonbond(1, i)
622 fshell_total(2, i) = shell_particle_set(i)%f(2) + fshell_nonbond(2, i)
623 fshell_total(3, i) = shell_particle_set(i)%f(3) + fshell_nonbond(3, i)
628 WRITE (iw,
'(A)')
" FIST::(1)INTERNAL + ELECTROSTATIC BONDED + NONBONDED"
629 WRITE (iw,
'(3f15.9)') ((f_total(j, i), j=1, 3), i=1, natoms)
630 IF (shell_present .AND. shell_model_ad)
THEN
631 WRITE (iw,
'(A)')
" FIST::(1)SHELL INTERNAL + ELECTROSTATIC BONDED + NONBONDED"
632 WRITE (iw,
'(3f15.9)') ((fshell_total(j, i), j=1, 3), i=1, nshell)
633 WRITE (iw,
'(A)')
" FIST::(1)CORE INTERNAL + ELECTROSTATIC BONDED + NONBONDED"
634 WRITE (iw,
'(3f15.9)') ((fcore_total(j, i), j=1, 3), i=1, nshell)
641 DO iparticle_kind = 1, nparticle_kind
642 nparticle_local = local_particles%n_el(iparticle_kind)
643 DO iparticle_local = 1, nparticle_local
644 ii = local_particles%list(iparticle_kind)%array(iparticle_local)
646 f_total(1, ii) = f_total(1, ii) + fg_coulomb(1, node)
647 f_total(2, ii) = f_total(2, ii) + fg_coulomb(2, node)
648 f_total(3, ii) = f_total(3, ii) + fg_coulomb(3, node)
649 IF (
PRESENT(debug))
THEN
650 debug%f_g(1, ii) = debug%f_g(1, ii) + fg_coulomb(1, node)
651 debug%f_g(2, ii) = debug%f_g(2, ii) + fg_coulomb(2, node)
652 debug%f_g(3, ii) = debug%f_g(3, ii) + fg_coulomb(3, node)
654 IF (atprop_env%energy)
THEN
655 atprop_env%atener(ii) = atprop_env%atener(ii) + e_coulomb(node)
659 IF (atprop_env%energy)
THEN
660 DEALLOCATE (e_coulomb)
665 WRITE (iw,
'(A)')
" FIST::(2)TOTAL FORCES(1)+ ELECTROSTATIC FORCES"
666 WRITE (iw,
'(3f15.9)') ((f_total(j, i), j=1, 3), i=1, natoms)
667 IF (shell_present .AND. shell_model_ad)
THEN
668 WRITE (iw,
'(A)')
" FIST::(2)SHELL TOTAL FORCES(1)+ ELECTROSTATIC FORCES "
669 WRITE (iw,
'(3f15.9)') ((fshell_total(j, i), j=1, 3), i=1, nshell)
670 WRITE (iw,
'(A)')
" FIST::(2)CORE TOTAL FORCES(1)+ ELECTROSTATIC FORCES"
671 WRITE (iw,
'(3f15.9)') ((fcore_total(j, i), j=1, 3), i=1, nshell)
678 virial%pv_virial = pv_nonbond + pv_bond + pv_bend + pv_torsion + pv_imptors + pv_urey_bradley
679 CALL para_env%sum(virial%pv_virial)
686 virial%pv_virial = pv_nonbond + pv_bond + pv_bend + pv_torsion + pv_imptors + pv_urey_bradley + pv_bc
687 CALL para_env%sum(virial%pv_virial)
689 virial%pv_virial = virial%pv_virial + ident*thermo%e_neut
690 virial%pv_virial = virial%pv_virial + pv_g
695 CALL para_env%sum(f_total)
696 IF (shell_present .AND. shell_model_ad)
THEN
697 CALL para_env%sum(fcore_total)
698 CALL para_env%sum(fshell_total)
702 IF (efield%apply_field)
THEN
703 thermo%pot = thermo%pot + ef_ener
704 f_total(1:3, 1:natoms) = f_total(1:3, 1:natoms) + ef_f(1:3, 1:natoms)
706 virial%pv_virial(1:3, 1:3) = virial%pv_virial(1:3, 1:3) + ef_pv(1:3, 1:3)
712 SELECT CASE (ewald_type)
714 IF (shell_present .AND. shell_model_ad)
THEN
716 shell_index = particle_set(i)%shell_index
717 IF (shell_index == 0)
THEN
718 particle_set(i)%f(1:3) = f_total(1:3, i) + fg_coulomb(1:3, i)
720 atomic_kind => particle_set(i)%atomic_kind
722 fc = shell%mass_core/mass
723 fcore_total(1:3, shell_index) = fcore_total(1:3, shell_index) + particle_set(i)%f(1:3)*fc
724 fs = shell%mass_shell/mass
725 fshell_total(1:3, shell_index) = fshell_total(1:3, shell_index) + particle_set(i)%f(1:3)*fs
730 core_particle_set(i)%f(1) = fcore_total(1, i) + fgcore_coulomb(1, i)
731 core_particle_set(i)%f(2) = fcore_total(2, i) + fgcore_coulomb(2, i)
732 core_particle_set(i)%f(3) = fcore_total(3, i) + fgcore_coulomb(3, i)
733 shell_particle_set(i)%f(1) = fshell_total(1, i) + fgshell_coulomb(1, i)
734 shell_particle_set(i)%f(2) = fshell_total(2, i) + fgshell_coulomb(2, i)
735 shell_particle_set(i)%f(3) = fshell_total(3, i) + fgshell_coulomb(3, i)
738 ELSEIF (shell_present .AND. .NOT. shell_model_ad)
THEN
739 cpabort(
"Non adiabatic shell-model not implemented.")
742 particle_set(i)%f(1) = f_total(1, i) + fg_coulomb(1, i)
743 particle_set(i)%f(2) = f_total(2, i) + fg_coulomb(2, i)
744 particle_set(i)%f(3) = f_total(3, i) + fg_coulomb(3, i)
748 IF (shell_present .AND. shell_model_ad)
THEN
750 shell_index = particle_set(i)%shell_index
751 IF (shell_index == 0)
THEN
752 particle_set(i)%f(1:3) = f_total(1:3, i)
754 atomic_kind => particle_set(i)%atomic_kind
756 fc = shell%mass_core/mass
757 fcore_total(1:3, shell_index) = fcore_total(1:3, shell_index) + particle_set(i)%f(1:3)*fc
758 fs = shell%mass_shell/mass
759 fshell_total(1:3, shell_index) = fshell_total(1:3, shell_index) + particle_set(i)%f(1:3)*fs
763 core_particle_set(i)%f(1) = fcore_total(1, i)
764 core_particle_set(i)%f(2) = fcore_total(2, i)
765 core_particle_set(i)%f(3) = fcore_total(3, i)
766 shell_particle_set(i)%f(1) = fshell_total(1, i)
767 shell_particle_set(i)%f(2) = fshell_total(2, i)
768 shell_particle_set(i)%f(3) = fshell_total(3, i)
770 ELSEIF (shell_present .AND. .NOT. shell_model_ad)
THEN
771 cpabort(
"Non adiabatic shell-model not implemented.")
774 particle_set(i)%f(1) = f_total(1, i)
775 particle_set(i)%f(2) = f_total(2, i)
776 particle_set(i)%f(3) = f_total(3, i)
782 WRITE (iw,
'(A)')
" FIST::(3)TOTAL FORCES - THE END..."
783 WRITE (iw,
'(3f15.9)') ((particle_set(i)%f(j), j=1, 3), i=1, natoms)
784 IF (shell_present .AND. shell_model_ad)
THEN
785 WRITE (iw,
'(A)')
" FIST::(3)SHELL TOTAL FORCES - THE END..."
786 WRITE (iw,
'(3f15.9)') ((shell_particle_set(i)%f(j), j=1, 3), i=1, nshell)
787 WRITE (iw,
'(A)')
" FIST::(3)CORE TOTAL FORCES - THE END..."
788 WRITE (iw,
'(3f15.9)') ((core_particle_set(i)%f(j), j=1, 3), i=1, nshell)
790 WRITE (iw,
'(A,f15.9)')
"Energy after FIST calculation.. exiting now ::", thermo%pot
795 IF (
PRESENT(debug))
THEN
796 CALL para_env%sum(pot_manybody)
797 debug%pot_manybody = pot_manybody
798 CALL para_env%sum(pot_nonbond)
799 debug%pot_nonbond = pot_nonbond
800 CALL para_env%sum(pot_bond)
801 debug%pot_bond = pot_bond
802 CALL para_env%sum(pot_bend)
803 debug%pot_bend = pot_bend
804 CALL para_env%sum(pot_torsion)
805 debug%pot_torsion = pot_torsion
806 CALL para_env%sum(pot_imptors)
807 debug%pot_imptors = pot_imptors
808 CALL para_env%sum(pot_opbend)
809 debug%pot_opbend = pot_opbend
810 CALL para_env%sum(pot_urey_bradley)
811 debug%pot_urey_bradley = pot_urey_bradley
812 CALL para_env%sum(f_nonbond)
813 debug%f_nonbond = f_nonbond
815 CALL para_env%sum(pv_nonbond)
816 debug%pv_nonbond = pv_nonbond
817 CALL para_env%sum(pv_bond)
818 debug%pv_bond = pv_bond
819 CALL para_env%sum(pv_bend)
820 debug%pv_bend = pv_bend
821 CALL para_env%sum(pv_torsion)
822 debug%pv_torsion = pv_torsion
823 CALL para_env%sum(pv_imptors)
824 debug%pv_imptors = pv_imptors
825 CALL para_env%sum(pv_urey_bradley)
826 debug%pv_ub = pv_urey_bradley
828 SELECT CASE (ewald_type)
830 debug%pot_g = vg_coulomb
832 debug%f_g = fg_coulomb
834 debug%pot_g = vg_coulomb
835 IF (use_virial) debug%pv_g = pv_g
839 IF (use_virial) debug%pv_g = 0.0_dp
845 CALL print_fist(fist_env, print_section, atomic_kind_set, particle_set, cell)
848 IF (
ALLOCATED(fg_coulomb))
THEN
849 DEALLOCATE (fg_coulomb)
851 IF (
ALLOCATED(f_total))
THEN
854 DEALLOCATE (f_nonbond)
855 IF (shell_present)
THEN
856 DEALLOCATE (fshell_total)
858 DEALLOCATE (fgshell_coulomb)
860 DEALLOCATE (fshell_nonbond)
864 CALL timestop(handle)