67#include "../../base/base_uses.f90"
89 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'thermostat_utils'
104 print_section, particles, gci)
113 INTEGER :: natom, nconstraint_ext, nconstraint_int, &
114 nrestraints_int, rot_dof, &
120 natom=natom, nconstraint=nconstraint_int, nrestraints=nrestraints_int)
123 CALL rot_ana(particles%els, dof=roto_trasl_dof, rot_dof=rot_dof, &
124 print_section=print_section, keep_rotations=.false., &
125 mass_weighted=.true., natoms=natom)
127 roto_trasl_dof = roto_trasl_dof - min(sum(cell%perd(1:3)), rot_dof)
130 simpar%nfree_rot_transl = roto_trasl_dof
133 nconstraint_ext = gci%ntot - gci%nrestraint
134 simpar%nfree = 3*natom - nconstraint_int - nconstraint_ext - roto_trasl_dof
155 local_molecules, molecules, particles, print_section, region_sections, gci, &
167 INTEGER,
INTENT(IN) :: region
170 INTEGER :: ic, iw, natom, nconstraint_ext, &
171 nconstraint_int, nrestraints_int, &
172 rot_dof, roto_trasl_dof
175 cpassert(
ASSOCIATED(gci))
179 natom=natom, nconstraint=nconstraint_int, nrestraints=nrestraints_int)
182 CALL rot_ana(particles%els, dof=roto_trasl_dof, rot_dof=rot_dof, &
183 print_section=print_section, keep_rotations=.false., &
184 mass_weighted=.true., natoms=natom)
186 roto_trasl_dof = roto_trasl_dof - min(sum(cell%perd(1:3)), rot_dof)
190 local_molecules, molecules, particles, region, simpar%ensemble, roto_trasl_dof, &
191 region_sections=region_sections, qmmm_env=qmmm_env)
194 simpar%nfree_rot_transl = roto_trasl_dof
197 nconstraint_ext = gci%ntot - gci%nrestraint
198 simpar%nfree = 3*natom - nconstraint_int - nconstraint_ext - roto_trasl_dof
204 WRITE (iw,
'(/,T2,A)') &
205 'DOF| Calculation of degrees of freedom'
206 WRITE (iw,
'(T2,A,T71,I10)') &
207 'DOF| Number of atoms', natom, &
208 'DOF| Number of intramolecular constraints', nconstraint_int, &
209 'DOF| Number of intermolecular constraints', nconstraint_ext, &
210 'DOF| Invariants (translations + rotations)', roto_trasl_dof, &
211 'DOF| Degrees of freedom', simpar%nfree
212 WRITE (iw,
'(/,T2,A)') &
213 'DOF| Restraints information'
214 WRITE (iw,
'(T2,A,T71,I10)') &
215 'DOF| Number of intramolecular restraints', nrestraints_int, &
216 'DOF| Number of intermolecular restraints', gci%nrestraint
217 IF (
ASSOCIATED(gci%colv_list))
THEN
218 DO ic = 1,
SIZE(gci%colv_list)
222 IF (
ASSOCIATED(gci%fixd_list))
THEN
223 DO ic = 1,
SIZE(gci%fixd_list)
227 IF (
ASSOCIATED(gci%g3x3_list))
THEN
228 DO ic = 1,
SIZE(gci%g3x3_list)
232 IF (
ASSOCIATED(gci%g4x6_list))
THEN
233 DO ic = 1,
SIZE(gci%g4x6_list)
237 IF (
ASSOCIATED(gci%vsite_list))
THEN
238 DO ic = 1,
SIZE(gci%vsite_list)
264 molecules, particles, region, ensemble, nfree, shell, region_sections, qmmm_env)
270 INTEGER,
INTENT(IN) :: region, ensemble
271 INTEGER,
INTENT(INOUT),
OPTIONAL :: nfree
272 LOGICAL,
INTENT(IN),
OPTIONAL :: shell
276 INTEGER :: dis_type, first_atom, i, ikind, imol, imol_global, ipart, itherm, katom, &
277 last_atom, natom, natom_local, nkind, nmol_local, nmol_per_kind, nmolecule, nshell, &
278 number, stat, sum_of_thermostats
279 INTEGER,
POINTER :: molecule_list(:), thermolist(:)
280 LOGICAL :: check, do_shell, nointer, on_therm
284 NULLIFY (molecule_kind, molecule, thermostat_info%map_loc_thermo_gen, thermolist)
285 nkind =
SIZE(molecule_kind_set)
287 IF (
PRESENT(shell)) do_shell = shell
289 sum_of_thermostats = 0
296 CALL get_adiabatic_region_info(region_sections, sum_of_thermostats, &
297 thermolist=thermolist, &
298 molecule_kind_set=molecule_kind_set, &
299 molecules=molecules, particles=particles, qmmm_env=qmmm_env)
302 molecule_set => molecules%els
303 SELECT CASE (ensemble)
305 cpabort(
'Unknown ensemble')
311 sum_of_thermostats = 1
316 molecule_kind => molecule_kind_set(ikind)
317 nmol_per_kind = local_molecules%n_el(ikind)
319 molecule_list=molecule_list)
321 DO imol_global = 1,
SIZE(molecule_list)
322 molecule => molecule_set(molecule_list(imol_global))
326 DO katom = first_atom, last_atom
327 IF (thermolist(katom) == huge(0))
THEN
334 DO katom = first_atom, last_atom
335 thermolist(katom) = itherm
341 molecule_kind => molecule_kind_set(i)
343 IF ((do_shell) .AND. (nshell == 0)) nmolecule = 0
344 sum_of_thermostats = sum_of_thermostats + nmolecule
348 IF ((nmolecule == 1) .AND. (nkind == 1)) nointer = .false.
352 molecule_kind => molecule_kind_set(i)
354 natom=natom, nshell=nshell)
355 IF (do_shell) natom = nshell
356 sum_of_thermostats = sum_of_thermostats + 3*natom*nmolecule
361 DO ikind = 1,
SIZE(molecule_kind_set)
362 nmol_per_kind = local_molecules%n_el(ikind)
363 DO imol = 1, nmol_per_kind
364 i = local_molecules%list(ikind)%array(imol)
365 molecule => molecule_set(i)
366 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
367 DO ipart = first_atom, last_atom
368 natom_local = natom_local + 1
374 ALLOCATE (thermostat_info%map_loc_thermo_gen(natom_local), stat=stat)
375 thermostat_info%map_loc_thermo_gen = huge(0)
378 DO ikind = 1,
SIZE(molecule_kind_set)
379 nmol_per_kind = local_molecules%n_el(ikind)
380 DO imol = 1, nmol_per_kind
381 i = local_molecules%list(ikind)%array(imol)
382 molecule => molecule_set(i)
383 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
384 DO ipart = first_atom, last_atom
385 natom_local = natom_local + 1
387 IF (thermolist(ipart) /= huge(0))
THEN
388 thermostat_info%map_loc_thermo_gen(natom_local) = thermolist(ipart)
404 nmol_local = local_molecules%n_el(ikind)
405 molecule_kind => molecule_kind_set(ikind)
409 IF (nshell == 0) nmol_local = 0
412 number = number + nmol_local
414 number = number + 3*nmol_local*natom
416 cpabort(
'Invalid region setup')
425 IF (
PRESENT(nfree))
THEN
432 thermostat_info%sum_of_thermostats = sum_of_thermostats
433 thermostat_info%number_of_thermostats = number
434 thermostat_info%dis_type = dis_type
436 DEALLOCATE (thermolist)
451 SUBROUTINE get_adiabatic_region_info(region_sections, sum_of_thermostats, &
452 thermolist, molecule_kind_set, molecules, particles, &
455 INTEGER,
INTENT(INOUT),
OPTIONAL :: sum_of_thermostats
456 INTEGER,
POINTER :: thermolist(:)
462 CHARACTER(LEN=default_string_length), &
463 DIMENSION(:),
POINTER :: tmpstringlist
464 INTEGER :: first_atom, i, ig, ikind, ilist, imol, &
465 ipart, itherm, jg, last_atom, &
466 mregions, n_rep, nregions, output_unit
467 INTEGER,
DIMENSION(:),
POINTER :: tmplist
473 NULLIFY (tmplist, tmpstringlist, thermolist, molecule_kind, molecule, molecule_set)
479 ALLOCATE (thermolist(particles%n_els))
481 molecule_set => molecules%els
487 CALL section_vals_val_get(region_sections,
"LIST", i_rep_section=ig, i_rep_val=jg, i_vals=tmplist)
488 DO i = 1,
SIZE(tmplist)
490 cpassert(((ipart > 0) .AND. (ipart <= particles%n_els)))
491 IF (thermolist(ipart) == huge(0))
THEN
493 thermolist(ipart) = itherm
495 CALL cp_abort(__location__, &
497 "assigned to different adiabatic regions!")
503 CALL section_vals_val_get(region_sections,
"MOLNAME", i_rep_section=ig, i_rep_val=jg, c_vals=tmpstringlist)
504 DO ilist = 1,
SIZE(tmpstringlist)
505 DO ikind = 1,
SIZE(molecule_kind_set)
506 molecule_kind => molecule_kind_set(ikind)
507 IF (molecule_kind%name == tmpstringlist(ilist))
THEN
508 DO imol = 1,
SIZE(molecule_kind%molecule_list)
509 molecule => molecule_set(molecule_kind%molecule_list(imol))
510 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
511 DO ipart = first_atom, last_atom
512 IF (thermolist(ipart) == huge(0))
THEN
514 thermolist(ipart) = itherm
516 CALL cp_abort(__location__, &
518 "assigned to different adiabatic regions!")
526 CALL setup_thermostat_subsys(region_sections, qmmm_env, thermolist, molecule_set, &
527 subsys_qm=.false., ig=ig, sum_of_thermostats=sum_of_thermostats, nregions=nregions)
528 CALL setup_thermostat_subsys(region_sections, qmmm_env, thermolist, molecule_set, &
529 subsys_qm=.true., ig=ig, sum_of_thermostats=sum_of_thermostats, nregions=nregions)
532 cpassert(.NOT. all(thermolist == huge(0)))
569 END SUBROUTINE get_adiabatic_region_info
586 molecules, particles, region, ensemble, nfree, shell, region_sections, qmmm_env)
592 INTEGER,
INTENT(IN) :: region, ensemble
593 INTEGER,
INTENT(INOUT),
OPTIONAL :: nfree
594 LOGICAL,
INTENT(IN),
OPTIONAL :: shell
598 INTEGER :: dis_type, i, ikind, natom, nkind, &
599 nmol_local, nmolecule, nshell, number, &
601 LOGICAL :: check, do_shell, nointer
604 NULLIFY (molecule_kind)
605 nkind =
SIZE(molecule_kind_set)
607 IF (
PRESENT(shell)) do_shell = shell
609 sum_of_thermostats = 0
616 SELECT CASE (ensemble)
618 cpabort(
'Unknown ensemble')
630 sum_of_thermostats = 1
634 molecule_kind => molecule_kind_set(i)
636 IF ((do_shell) .AND. (nshell == 0)) nmolecule = 0
637 sum_of_thermostats = sum_of_thermostats + nmolecule
641 IF ((nmolecule == 1) .AND. (nkind == 1)) nointer = .false.
645 molecule_kind => molecule_kind_set(i)
647 natom=natom, nshell=nshell)
648 IF (do_shell) natom = nshell
649 sum_of_thermostats = sum_of_thermostats + 3*natom*nmolecule
656 IF (sum_of_thermostats < 1)
THEN
657 CALL cp_abort(__location__, &
658 "A thermostat type DEFINED is requested but no thermostat "// &
659 "regions are defined in THERMOSTAT/DEFINE_REGION.")
666 IF (sum_of_thermostats < 1)
THEN
667 CALL cp_abort(__location__, &
668 "A thermostat type THERMAL is requested but no thermal "// &
669 "regions are defined in THERMAL_REGION/DEFINE_REGION.")
684 nmol_local = local_molecules%n_el(ikind)
685 molecule_kind => molecule_kind_set(ikind)
689 IF (nshell == 0) nmol_local = 0
692 number = number + nmol_local
694 number = number + 3*nmol_local*natom
696 cpabort(
'Invalid region setup')
705 CALL get_defined_region_info(region_sections, number, sum_of_thermostats, &
706 map_loc_thermo_gen=thermostat_info%map_loc_thermo_gen, &
707 local_molecules=local_molecules, molecule_kind_set=molecule_kind_set, &
708 molecules=molecules, particles=particles, qmmm_env=qmmm_env)
712 IF (
PRESENT(nfree))
THEN
722 thermostat_info%sum_of_thermostats = sum_of_thermostats
723 thermostat_info%number_of_thermostats = number
724 thermostat_info%dis_type = dis_type
740 SUBROUTINE get_defined_region_info(region_sections, number, sum_of_thermostats, &
741 map_loc_thermo_gen, local_molecules, molecule_kind_set, molecules, particles, &
744 INTEGER,
INTENT(OUT),
OPTIONAL :: number
745 INTEGER,
INTENT(INOUT),
OPTIONAL :: sum_of_thermostats
746 INTEGER,
DIMENSION(:),
POINTER :: map_loc_thermo_gen
753 CHARACTER(LEN=default_string_length), &
754 DIMENSION(:),
POINTER :: tmpstringlist
755 INTEGER :: first_atom, i, ig, ikind, ilist, imol, ipart, jg, last_atom, mregions, n_rep, &
756 natom_local, nmol_per_kind, nregions, output_unit
757 INTEGER,
DIMENSION(:),
POINTER :: thermolist, tmp, tmplist
763 NULLIFY (tmplist, tmpstringlist, thermolist, molecule_kind, molecule, molecule_set)
767 cpassert(.NOT. (
ASSOCIATED(map_loc_thermo_gen)))
769 ALLOCATE (thermolist(particles%n_els))
771 molecule_set => molecules%els
777 CALL section_vals_val_get(region_sections,
"LIST", i_rep_section=ig, i_rep_val=jg, i_vals=tmplist)
778 DO i = 1,
SIZE(tmplist)
780 cpassert(((ipart > 0) .AND. (ipart <= particles%n_els)))
781 IF (thermolist(ipart) == huge(0) .OR. thermolist(ipart) == ig)
THEN
782 thermolist(ipart) = ig
784 CALL cp_abort(__location__, &
786 "assigned to different thermostat regions "// &
796 CALL section_vals_val_get(region_sections,
"MOLNAME", i_rep_section=ig, i_rep_val=jg, c_vals=tmpstringlist)
797 DO ilist = 1,
SIZE(tmpstringlist)
798 DO ikind = 1,
SIZE(molecule_kind_set)
799 molecule_kind => molecule_kind_set(ikind)
800 IF (molecule_kind%name == tmpstringlist(ilist))
THEN
801 DO imol = 1,
SIZE(molecule_kind%molecule_list)
802 molecule => molecule_set(molecule_kind%molecule_list(imol))
803 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
804 DO ipart = first_atom, last_atom
805 IF (thermolist(ipart) == huge(0) .OR. thermolist(ipart) == ig)
THEN
806 thermolist(ipart) = ig
808 CALL cp_abort(__location__, &
810 "assigned to different thermostat regions "// &
821 CALL setup_thermostat_subsys(region_sections, qmmm_env, thermolist, molecule_set, &
822 subsys_qm=.false., ig=ig, sum_of_thermostats=sum_of_thermostats, nregions=nregions)
823 CALL setup_thermostat_subsys(region_sections, qmmm_env, thermolist, molecule_set, &
824 subsys_qm=.true., ig=ig, sum_of_thermostats=sum_of_thermostats, nregions=nregions)
828 IF (any(thermolist == huge(0)))
THEN
829 nregions = nregions + 1
830 sum_of_thermostats = sum_of_thermostats + 1
831 ALLOCATE (tmp(count(thermolist == huge(0))))
833 DO i = 1,
SIZE(thermolist)
834 IF (thermolist(i) == huge(0))
THEN
837 thermolist(i) = nregions
841 IF (output_unit > 0)
THEN
842 WRITE (output_unit,
'(/,T2,A)') &
843 "THERMOSTAT| Warning: No thermostats defined for the following atoms:"
845 WRITE (output_unit,
'(T2,A,T17,8I8)')
"THERMOSTAT|", tmp(i:min(i + 7, ilist))
847 WRITE (output_unit,
'(T2,A)') &
848 "THERMOSTAT| They will be included in a further unique thermostat!"
853 cpassert(all(thermolist /= huge(0)))
857 IF (output_unit > 0)
THEN
858 WRITE (output_unit,
'(/,T2,A)') &
859 "THERMOSTAT| Mapping of thermostat region indices to particles"
860 DO ipart = 1, particles%n_els, 16
861 WRITE (output_unit,
'(T2,A,T17,16(" ",I3))') &
862 "THERMOSTAT|", thermolist(ipart:min(ipart + 15, particles%n_els))
867 ALLOCATE (tmp(nregions))
870 DO ikind = 1,
SIZE(molecule_kind_set)
871 nmol_per_kind = local_molecules%n_el(ikind)
872 DO imol = 1, nmol_per_kind
873 i = local_molecules%list(ikind)%array(imol)
874 molecule => molecule_set(i)
875 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
876 DO ipart = first_atom, last_atom
877 natom_local = natom_local + 1
878 tmp(thermolist(ipart)) = 1
886 ALLOCATE (map_loc_thermo_gen(natom_local))
888 DO ikind = 1,
SIZE(molecule_kind_set)
889 nmol_per_kind = local_molecules%n_el(ikind)
890 DO imol = 1, nmol_per_kind
891 i = local_molecules%list(ikind)%array(imol)
892 molecule => molecule_set(i)
893 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
894 DO ipart = first_atom, last_atom
895 natom_local = natom_local + 1
896 map_loc_thermo_gen(natom_local) = thermolist(ipart)
901 DEALLOCATE (thermolist)
902 END SUBROUTINE get_defined_region_info
916 SUBROUTINE setup_thermostat_subsys(region_sections, qmmm_env, thermolist, &
917 molecule_set, subsys_qm, ig, sum_of_thermostats, nregions)
920 INTEGER,
DIMENSION(:),
POINTER :: thermolist
922 LOGICAL,
INTENT(IN) :: subsys_qm
923 INTEGER,
INTENT(IN) :: ig
924 INTEGER,
INTENT(INOUT) :: sum_of_thermostats, nregions
926 CHARACTER(LEN=default_string_length) :: label1, label2
927 INTEGER :: first_atom, i, imolecule, ipart, &
928 last_atom, nrep, thermo1
929 INTEGER,
DIMENSION(:),
POINTER :: atom_index1
940 n_rep_val=nrep, explicit=explicit)
941 IF (nrep == 1 .AND. explicit)
THEN
942 IF (
ASSOCIATED(qmmm_env))
THEN
943 atom_index1 => qmmm_env%qm%mm_atom_index
945 atom_index1 => qmmm_env%qm%qm_atom_index
948 SELECT CASE (thermo1)
950 DO i = 1,
SIZE(atom_index1)
951 ipart = atom_index1(i)
952 IF (subsys_qm .AND. qmmm_env%qm%qmmm_link .AND.
ASSOCIATED(qmmm_env%qm%mm_link_atoms))
THEN
953 IF (any(ipart == qmmm_env%qm%mm_link_atoms)) cycle
955 IF (thermolist(ipart) == huge(0))
THEN
956 thermolist(ipart) = ig
958 CALL cp_abort(__location__, &
960 trim(label1)//
' was already assigned to'// &
961 ' the thermostatting region Nr.'//
cp_to_string(thermolist(ipart))// &
962 '. Please check the input for inconsistencies!')
966 DO imolecule = 1,
SIZE(molecule_set)
967 molecule => molecule_set(imolecule)
968 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
969 IF (any(atom_index1 >= first_atom .AND. atom_index1 <= last_atom))
THEN
970 DO ipart = first_atom, last_atom
971 IF (thermolist(ipart) == huge(0))
THEN
972 thermolist(ipart) = ig
974 CALL cp_abort(__location__, &
976 trim(label1)//
' was already assigned to'// &
977 ' the thermostatting region Nr.'//
cp_to_string(thermolist(ipart))// &
978 '. Please check the input for inconsistencies!')
985 sum_of_thermostats = sum_of_thermostats - 1
986 nregions = nregions - 1
989 END SUBROUTINE setup_thermostat_subsys
1001 INTENT(INOUT) :: npt
1004 INTEGER :: i, j, ncoef
1006 map_info%v_scale = 1.0_dp
1007 map_info%s_kin = 0.0_dp
1009 DO i = 1,
SIZE(npt, 1)
1010 DO j = 1,
SIZE(npt, 2)
1012 map_info%p_kin(1, ncoef)%point = map_info%p_kin(1, ncoef)%point &
1013 + npt(i, j)%mass*npt(i, j)%v**2
1030 INTENT(INOUT) :: npt
1032 INTEGER :: i, j, ncoef
1035 DO i = 1,
SIZE(npt, 1)
1036 DO j = 1,
SIZE(npt, 2)
1038 npt(i, j)%v = npt(i, j)%v*map_info%p_scale(1, ncoef)%point
1056 local_molecules, molecule_set, group, vel)
1064 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: vel(:, :)
1066 INTEGER :: first_atom, ii, ikind, imol, imol_local, &
1067 ipart, last_atom, nmol_local
1068 LOGICAL :: present_vel
1069 REAL(kind=
dp) :: mass
1073 map_info%v_scale = 1.0_dp
1074 map_info%s_kin = 0.0_dp
1075 present_vel =
PRESENT(vel)
1077 DO ikind = 1,
SIZE(molecule_kind_set)
1078 nmol_local = local_molecules%n_el(ikind)
1079 DO imol_local = 1, nmol_local
1080 imol = local_molecules%list(ikind)%array(imol_local)
1081 molecule => molecule_set(imol)
1082 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
1083 DO ipart = first_atom, last_atom
1085 atomic_kind => particle_set(ipart)%atomic_kind
1087 IF (present_vel)
THEN
1088 IF (
ASSOCIATED(map_info%p_kin(1, ii)%point))
THEN
1089 map_info%p_kin(1, ii)%point = map_info%p_kin(1, ii)%point + mass*vel(1, ipart)**2
1091 IF (
ASSOCIATED(map_info%p_kin(2, ii)%point))
THEN
1092 map_info%p_kin(2, ii)%point = map_info%p_kin(2, ii)%point + mass*vel(2, ipart)**2
1094 IF (
ASSOCIATED(map_info%p_kin(3, ii)%point))
THEN
1095 map_info%p_kin(3, ii)%point = map_info%p_kin(3, ii)%point + mass*vel(3, ipart)**2
1098 IF (
ASSOCIATED(map_info%p_kin(1, ii)%point))
THEN
1099 map_info%p_kin(1, ii)%point = map_info%p_kin(1, ii)%point + mass*particle_set(ipart)%v(1)**2
1101 IF (
ASSOCIATED(map_info%p_kin(2, ii)%point))
THEN
1102 map_info%p_kin(2, ii)%point = map_info%p_kin(2, ii)%point + mass*particle_set(ipart)%v(2)**2
1104 IF (
ASSOCIATED(map_info%p_kin(3, ii)%point))
THEN
1105 map_info%p_kin(3, ii)%point = map_info%p_kin(3, ii)%point + mass*particle_set(ipart)%v(3)**2
1128 local_molecules, molecule_set, group, vel)
1136 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: vel(:, :)
1138 INTEGER :: first_atom, ii, ikind, imol, imol_local, &
1139 ipart, last_atom, nmol_local
1140 LOGICAL :: present_vel
1141 REAL(kind=
dp) :: mass
1145 map_info%v_scale = 1.0_dp
1146 map_info%s_kin = 0.0_dp
1147 present_vel =
PRESENT(vel)
1149 DO ikind = 1,
SIZE(molecule_kind_set)
1150 nmol_local = local_molecules%n_el(ikind)
1151 DO imol_local = 1, nmol_local
1152 imol = local_molecules%list(ikind)%array(imol_local)
1153 molecule => molecule_set(imol)
1154 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
1155 DO ipart = first_atom, last_atom
1157 atomic_kind => particle_set(ipart)%atomic_kind
1159 IF (present_vel)
THEN
1160 map_info%p_kin(1, ii)%point = map_info%p_kin(1, ii)%point + sqrt(mass)*vel(1, ipart)
1161 map_info%p_kin(2, ii)%point = map_info%p_kin(2, ii)%point + sqrt(mass)*vel(2, ipart)
1162 map_info%p_kin(3, ii)%point = map_info%p_kin(3, ii)%point + sqrt(mass)*vel(3, ipart)
1164 map_info%p_kin(1, ii)%point = map_info%p_kin(1, ii)%point + sqrt(mass)*particle_set(ipart)%v(1)
1165 map_info%p_kin(2, ii)%point = map_info%p_kin(2, ii)%point + sqrt(mass)*particle_set(ipart)%v(2)
1166 map_info%p_kin(3, ii)%point = map_info%p_kin(3, ii)%point + sqrt(mass)*particle_set(ipart)%v(3)
1192 particle_set, local_molecules, shell_adiabatic, shell_particle_set, &
1193 core_particle_set, vel, shell_vel, core_vel)
1200 LOGICAL,
INTENT(IN) :: shell_adiabatic
1201 TYPE(
particle_type),
OPTIONAL,
POINTER :: shell_particle_set(:), &
1202 core_particle_set(:)
1203 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: vel(:, :), shell_vel(:, :), &
1206 INTEGER :: first_atom, ii, ikind, imol, imol_local, &
1207 ipart, jj, last_atom, nmol_local, &
1209 LOGICAL :: present_vel
1210 REAL(kind=
dp) :: fac_massc, fac_masss, mass, vc(3), vs(3)
1217 present_vel =
PRESENT(vel)
1219 IF (present_vel)
THEN
1220 IF (shell_adiabatic)
THEN
1221 cpassert(
PRESENT(shell_vel))
1222 cpassert(
PRESENT(core_vel))
1225 IF (shell_adiabatic)
THEN
1226 cpassert(
PRESENT(shell_particle_set))
1227 cpassert(
PRESENT(core_particle_set))
1230 kind:
DO ikind = 1,
SIZE(molecule_kind_set)
1231 nmol_local = local_molecules%n_el(ikind)
1232 mol_local:
DO imol_local = 1, nmol_local
1233 imol = local_molecules%list(ikind)%array(imol_local)
1234 molecule => molecule_set(imol)
1235 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
1236 particle:
DO ipart = first_atom, last_atom
1238 IF (present_vel)
THEN
1239 vel(1, ipart) = vel(1, ipart)*map_info%p_scale(1, ii)%point
1240 vel(2, ipart) = vel(2, ipart)*map_info%p_scale(2, ii)%point
1241 vel(3, ipart) = vel(3, ipart)*map_info%p_scale(3, ii)%point
1243 particle_set(ipart)%v(1) = particle_set(ipart)%v(1)*map_info%p_scale(1, ii)%point
1244 particle_set(ipart)%v(2) = particle_set(ipart)%v(2)*map_info%p_scale(2, ii)%point
1245 particle_set(ipart)%v(3) = particle_set(ipart)%v(3)*map_info%p_scale(3, ii)%point
1248 IF (shell_adiabatic)
THEN
1249 shell_index = particle_set(ipart)%shell_index
1250 IF (shell_index /= 0)
THEN
1252 atomic_kind => particle_set(ipart)%atomic_kind
1254 fac_masss = shell%mass_shell/mass
1255 fac_massc = shell%mass_core/mass
1256 IF (present_vel)
THEN
1257 vs(1:3) = shell_vel(1:3, shell_index)
1258 vc(1:3) = core_vel(1:3, shell_index)
1259 shell_vel(1, shell_index) = vel(1, ipart) + fac_massc*(vs(1) - vc(1))
1260 shell_vel(2, shell_index) = vel(2, ipart) + fac_massc*(vs(2) - vc(2))
1261 shell_vel(3, shell_index) = vel(3, ipart) + fac_massc*(vs(3) - vc(3))
1262 core_vel(1, shell_index) = vel(1, ipart) + fac_masss*(vc(1) - vs(1))
1263 core_vel(2, shell_index) = vel(2, ipart) + fac_masss*(vc(2) - vs(2))
1264 core_vel(3, shell_index) = vel(3, ipart) + fac_masss*(vc(3) - vs(3))
1266 vs(1:3) = shell_particle_set(shell_index)%v(1:3)
1267 vc(1:3) = core_particle_set(shell_index)%v(1:3)
1268 shell_particle_set(shell_index)%v(1) = particle_set(ipart)%v(1) + fac_massc*(vs(1) - vc(1))
1269 shell_particle_set(shell_index)%v(2) = particle_set(ipart)%v(2) + fac_massc*(vs(2) - vc(2))
1270 shell_particle_set(shell_index)%v(3) = particle_set(ipart)%v(3) + fac_massc*(vs(3) - vc(3))
1271 core_particle_set(shell_index)%v(1) = particle_set(ipart)%v(1) + fac_masss*(vc(1) - vs(1))
1272 core_particle_set(shell_index)%v(2) = particle_set(ipart)%v(2) + fac_masss*(vc(2) - vs(2))
1273 core_particle_set(shell_index)%v(3) = particle_set(ipart)%v(3) + fac_masss*(vc(3) - vs(3))
1297 local_particles, group, core_particle_set, shell_particle_set, &
1298 core_vel, shell_vel)
1305 TYPE(
particle_type),
OPTIONAL,
POINTER :: core_particle_set(:), &
1306 shell_particle_set(:)
1307 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: core_vel(:, :), shell_vel(:, :)
1309 INTEGER :: ii, iparticle, iparticle_kind, &
1310 iparticle_local, nparticle_kind, &
1311 nparticle_local, shell_index
1312 LOGICAL :: is_shell, present_vel
1313 REAL(
dp) :: mass, mu_mass, v_sc(3)
1317 present_vel =
PRESENT(shell_vel)
1319 IF (present_vel)
THEN
1320 cpassert(
PRESENT(core_vel))
1322 cpassert(
PRESENT(shell_particle_set))
1323 cpassert(
PRESENT(core_particle_set))
1326 map_info%v_scale = 1.0_dp
1327 map_info%s_kin = 0.0_dp
1330 nparticle_kind =
SIZE(atomic_kind_set)
1331 DO iparticle_kind = 1, nparticle_kind
1332 atomic_kind => atomic_kind_set(iparticle_kind)
1333 CALL get_atomic_kind(atomic_kind=atomic_kind, mass=mass, shell_active=is_shell, shell=shell)
1335 mu_mass = shell%mass_shell*shell%mass_core/mass
1336 nparticle_local = local_particles%n_el(iparticle_kind)
1337 DO iparticle_local = 1, nparticle_local
1338 iparticle = local_particles%list(iparticle_kind)%array(iparticle_local)
1339 shell_index = particle_set(iparticle)%shell_index
1341 IF (present_vel)
THEN
1342 v_sc(1) = core_vel(1, shell_index) - shell_vel(1, shell_index)
1343 v_sc(2) = core_vel(2, shell_index) - shell_vel(2, shell_index)
1344 v_sc(3) = core_vel(3, shell_index) - shell_vel(3, shell_index)
1345 map_info%p_kin(1, ii)%point = map_info%p_kin(1, ii)%point + mu_mass*v_sc(1)**2
1346 map_info%p_kin(2, ii)%point = map_info%p_kin(2, ii)%point + mu_mass*v_sc(2)**2
1347 map_info%p_kin(3, ii)%point = map_info%p_kin(3, ii)%point + mu_mass*v_sc(3)**2
1349 v_sc(1) = core_particle_set(shell_index)%v(1) - shell_particle_set(shell_index)%v(1)
1350 v_sc(2) = core_particle_set(shell_index)%v(2) - shell_particle_set(shell_index)%v(2)
1351 v_sc(3) = core_particle_set(shell_index)%v(3) - shell_particle_set(shell_index)%v(3)
1352 map_info%p_kin(1, ii)%point = map_info%p_kin(1, ii)%point + mu_mass*v_sc(1)**2
1353 map_info%p_kin(2, ii)%point = map_info%p_kin(2, ii)%point + mu_mass*v_sc(2)**2
1354 map_info%p_kin(3, ii)%point = map_info%p_kin(3, ii)%point + mu_mass*v_sc(3)**2
1377 shell_particle_set, core_particle_set, shell_vel, core_vel, vel)
1383 TYPE(
particle_type),
OPTIONAL,
POINTER :: shell_particle_set(:), &
1384 core_particle_set(:)
1385 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: shell_vel(:, :), core_vel(:, :), &
1388 INTEGER :: ii, iparticle, iparticle_kind, &
1389 iparticle_local, nparticle_kind, &
1390 nparticle_local, shell_index
1391 LOGICAL :: is_shell, present_vel
1392 REAL(
dp) :: mass, massc, masss, umass, v(3), vc(3), &
1397 present_vel =
PRESENT(vel)
1399 IF (present_vel)
THEN
1400 cpassert(
PRESENT(shell_vel))
1401 cpassert(
PRESENT(core_vel))
1403 cpassert(
PRESENT(shell_particle_set))
1404 cpassert(
PRESENT(core_particle_set))
1407 nparticle_kind =
SIZE(atomic_kind_set)
1409 kind:
DO iparticle_kind = 1, nparticle_kind
1410 atomic_kind => atomic_kind_set(iparticle_kind)
1411 CALL get_atomic_kind(atomic_kind=atomic_kind, mass=mass, shell_active=is_shell, shell=shell)
1414 masss = shell%mass_shell*umass
1415 massc = shell%mass_core*umass
1417 nparticle_local = local_particles%n_el(iparticle_kind)
1418 particles:
DO iparticle_local = 1, nparticle_local
1419 iparticle = local_particles%list(iparticle_kind)%array(iparticle_local)
1420 shell_index = particle_set(iparticle)%shell_index
1422 IF (present_vel)
THEN
1423 vc(1:3) = core_vel(1:3, shell_index)
1424 vs(1:3) = shell_vel(1:3, shell_index)
1425 v(1:3) = vel(1:3, iparticle)
1426 shell_vel(1, shell_index) = v(1) + map_info%p_scale(1, ii)%point*massc*(vs(1) - vc(1))
1427 shell_vel(2, shell_index) = v(2) + map_info%p_scale(2, ii)%point*massc*(vs(2) - vc(2))
1428 shell_vel(3, shell_index) = v(3) + map_info%p_scale(3, ii)%point*massc*(vs(3) - vc(3))
1429 core_vel(1, shell_index) = v(1) + map_info%p_scale(1, ii)%point*masss*(vc(1) - vs(1))
1430 core_vel(2, shell_index) = v(2) + map_info%p_scale(2, ii)%point*masss*(vc(2) - vs(2))
1431 core_vel(3, shell_index) = v(3) + map_info%p_scale(3, ii)%point*masss*(vc(3) - vs(3))
1433 vc(1:3) = core_particle_set(shell_index)%v(1:3)
1434 vs(1:3) = shell_particle_set(shell_index)%v(1:3)
1435 v(1:3) = particle_set(iparticle)%v(1:3)
1436 shell_particle_set(shell_index)%v(1) = v(1) + map_info%p_scale(1, ii)%point*massc*(vs(1) - vc(1))
1437 shell_particle_set(shell_index)%v(2) = v(2) + map_info%p_scale(2, ii)%point*massc*(vs(2) - vc(2))
1438 shell_particle_set(shell_index)%v(3) = v(3) + map_info%p_scale(3, ii)%point*massc*(vs(3) - vc(3))
1439 core_particle_set(shell_index)%v(1) = v(1) + map_info%p_scale(1, ii)%point*masss*(vc(1) - vs(1))
1440 core_particle_set(shell_index)%v(2) = v(2) + map_info%p_scale(2, ii)%point*masss*(vc(2) - vs(2))
1441 core_particle_set(shell_index)%v(3) = v(3) + map_info%p_scale(3, ii)%point*masss*(vc(3) - vs(3))
1463 REAL(kind=
dp),
INTENT(OUT) :: nhc_pot, nhc_kin
1465 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: array_kin, array_pot
1467 INTEGER :: imap, l, n, number
1468 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: akin, vpot
1470 number = nhc%glob_num_nhc
1471 ALLOCATE (akin(number))
1472 ALLOCATE (vpot(number))
1475 DO n = 1, nhc%loc_num_nhc
1476 imap = nhc%map_info%index(n)
1477 DO l = 1, nhc%nhc_len
1478 akin(imap) = akin(imap) + 0.5_dp*nhc%nvt(l, n)%mass*nhc%nvt(l, n)%v**2
1479 vpot(imap) = vpot(imap) + nhc%nvt(l, n)%nkt*nhc%nvt(l, n)%eta
1485 CALL para_env%sum(akin)
1486 CALL para_env%sum(vpot)
1488 CALL communication_thermo_low1(akin, number, para_env)
1489 CALL communication_thermo_low1(vpot, number, para_env)
1495 IF (
PRESENT(array_pot))
THEN
1496 IF (
ASSOCIATED(array_pot))
THEN
1497 cpassert(
SIZE(array_pot) == number)
1499 ALLOCATE (array_pot(number))
1503 IF (
PRESENT(array_kin))
THEN
1504 IF (
ASSOCIATED(array_kin))
THEN
1505 cpassert(
SIZE(array_kin) == number)
1507 ALLOCATE (array_kin(number))
1530 para_env, array_pot, array_kin)
1533 INTEGER,
INTENT(IN) :: loc_num, glob_num
1534 REAL(
dp),
DIMENSION(:),
INTENT(IN) :: thermo_energy
1535 REAL(kind=
dp),
INTENT(OUT) :: thermostat_kin
1537 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: array_pot, array_kin
1539 INTEGER :: imap, n, number
1540 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: akin
1543 ALLOCATE (akin(number))
1546 imap = map_info%index(n)
1547 akin(imap) = thermo_energy(n)
1552 CALL para_env%sum(akin)
1554 CALL communication_thermo_low1(akin, number, para_env)
1556 thermostat_kin = sum(akin)
1559 IF (
PRESENT(array_pot))
THEN
1560 IF (
ASSOCIATED(array_pot))
THEN
1561 cpassert(
SIZE(array_pot) == number)
1563 ALLOCATE (array_pot(number))
1567 IF (
PRESENT(array_kin))
THEN
1568 IF (
ASSOCIATED(array_kin))
THEN
1569 cpassert(
SIZE(array_kin) == number)
1571 ALLOCATE (array_kin(number))
1592 SUBROUTINE get_temperatures(map_info, loc_num, glob_num, nkt, dof, para_env, &
1593 temp_tot, array_temp)
1595 INTEGER,
INTENT(IN) :: loc_num, glob_num
1596 REAL(
dp),
DIMENSION(:),
INTENT(IN) :: nkt, dof
1598 REAL(kind=
dp),
INTENT(OUT) :: temp_tot
1599 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: array_temp
1601 INTEGER :: i, imap, imap2, n, number
1602 REAL(kind=
dp) :: fdeg_of_free
1603 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: akin, deg_of_free
1606 ALLOCATE (akin(number))
1607 ALLOCATE (deg_of_free(number))
1609 deg_of_free = 0.0_dp
1611 imap = map_info%index(n)
1612 imap2 = map_info%map_index(n)
1613 IF (nkt(n) == 0.0_dp) cycle
1614 deg_of_free(imap) = real(dof(n), kind=
dp)
1615 akin(imap) = map_info%s_kin(imap2)
1620 CALL para_env%sum(akin)
1621 CALL para_env%sum(deg_of_free)
1623 CALL communication_thermo_low1(akin, number, para_env)
1624 CALL communication_thermo_low1(deg_of_free, number, para_env)
1626 temp_tot = sum(akin)
1627 fdeg_of_free = sum(deg_of_free)
1629 temp_tot = temp_tot/fdeg_of_free
1632 IF (
PRESENT(array_temp))
THEN
1633 IF (
ASSOCIATED(array_temp))
THEN
1634 cpassert(
SIZE(array_temp) == number)
1636 ALLOCATE (array_temp(number))
1639 array_temp(i) = akin(i)/deg_of_free(i)
1644 DEALLOCATE (deg_of_free)
1645 END SUBROUTINE get_temperatures
1658 array_pot, array_kin)
1660 REAL(kind=
dp),
INTENT(OUT) :: thermostat_pot, thermostat_kin
1662 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: array_pot, array_kin
1665 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: thermo_energy
1667 thermostat_pot = 0.0_dp
1668 thermostat_kin = 0.0_dp
1669 IF (
ASSOCIATED(thermostat))
THEN
1672 cpassert(
ASSOCIATED(thermostat%nhc))
1673 CALL get_nhc_energies(thermostat%nhc, thermostat_pot, thermostat_kin, para_env, &
1674 array_pot, array_kin)
1677 cpassert(
ASSOCIATED(thermostat%csvr))
1678 ALLOCATE (thermo_energy(thermostat%csvr%loc_num_csvr))
1679 DO i = 1, thermostat%csvr%loc_num_csvr
1680 thermo_energy(i) = thermostat%csvr%nvt(i)%thermostat_energy
1682 CALL get_kin_energies(thermostat%csvr%map_info, thermostat%csvr%loc_num_csvr, &
1683 thermostat%csvr%glob_num_csvr, thermo_energy, &
1684 thermostat_kin, para_env, array_pot, array_kin)
1685 DEALLOCATE (thermo_energy)
1687 ELSE IF (thermostat%type_of_thermostat ==
do_thermo_gle)
THEN
1689 cpassert(
ASSOCIATED(thermostat%gle))
1690 ALLOCATE (thermo_energy(thermostat%gle%loc_num_gle))
1691 DO i = 1, thermostat%gle%loc_num_gle
1692 thermo_energy(i) = thermostat%gle%nvt(i)%thermostat_energy
1694 CALL get_kin_energies(thermostat%gle%map_info, thermostat%gle%loc_num_gle, &
1695 thermostat%gle%glob_num_gle, thermo_energy, &
1696 thermostat_kin, para_env, array_pot, array_kin)
1697 DEALLOCATE (thermo_energy)
1714 SUBROUTINE get_region_temperatures(thermostat, tot_temperature, para_env, array_temp)
1716 REAL(kind=
dp),
INTENT(OUT) :: tot_temperature
1718 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: array_temp
1721 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: dof, nkt
1723 IF (
ASSOCIATED(thermostat))
THEN
1726 cpassert(
ASSOCIATED(thermostat%nhc))
1727 ALLOCATE (nkt(thermostat%nhc%loc_num_nhc))
1728 ALLOCATE (dof(thermostat%nhc%loc_num_nhc))
1729 DO i = 1, thermostat%nhc%loc_num_nhc
1730 nkt(i) = thermostat%nhc%nvt(1, i)%nkt
1731 dof(i) = real(thermostat%nhc%nvt(1, i)%degrees_of_freedom, kind=
dp)
1733 CALL get_temperatures(thermostat%nhc%map_info, thermostat%nhc%loc_num_nhc, &
1734 thermostat%nhc%glob_num_nhc, nkt, dof, para_env, tot_temperature, array_temp)
1739 cpassert(
ASSOCIATED(thermostat%csvr))
1741 ALLOCATE (nkt(thermostat%csvr%loc_num_csvr))
1742 ALLOCATE (dof(thermostat%csvr%loc_num_csvr))
1743 DO i = 1, thermostat%csvr%loc_num_csvr
1744 nkt(i) = thermostat%csvr%nvt(i)%nkt
1745 dof(i) = real(thermostat%csvr%nvt(i)%degrees_of_freedom, kind=
dp)
1747 CALL get_temperatures(thermostat%csvr%map_info, thermostat%csvr%loc_num_csvr, &
1748 thermostat%csvr%glob_num_csvr, nkt, dof, para_env, tot_temperature, array_temp)
1751 ELSE IF (thermostat%type_of_thermostat ==
do_thermo_al)
THEN
1753 cpassert(
ASSOCIATED(thermostat%al))
1755 ALLOCATE (nkt(thermostat%al%loc_num_al))
1756 ALLOCATE (dof(thermostat%al%loc_num_al))
1757 DO i = 1, thermostat%al%loc_num_al
1758 nkt(i) = thermostat%al%nvt(i)%nkt
1759 dof(i) = real(thermostat%al%nvt(i)%degrees_of_freedom, kind=
dp)
1761 CALL get_temperatures(thermostat%al%map_info, thermostat%al%loc_num_al, &
1762 thermostat%al%glob_num_al, nkt, dof, para_env, tot_temperature, array_temp)
1765 ELSE IF (thermostat%type_of_thermostat ==
do_thermo_gle)
THEN
1767 cpassert(
ASSOCIATED(thermostat%gle))
1769 ALLOCATE (nkt(thermostat%gle%loc_num_gle))
1770 ALLOCATE (dof(thermostat%gle%loc_num_gle))
1771 DO i = 1, thermostat%gle%loc_num_gle
1772 nkt(i) = thermostat%gle%nvt(i)%nkt
1773 dof(i) = real(thermostat%gle%nvt(i)%degrees_of_freedom, kind=
dp)
1775 CALL get_temperatures(thermostat%gle%map_info, thermostat%gle%loc_num_gle, &
1776 thermostat%gle%glob_num_gle, nkt, dof, para_env, tot_temperature, array_temp)
1782 END SUBROUTINE get_region_temperatures
1797 CHARACTER(LEN=default_string_length) :: my_pos, my_act
1798 INTEGER,
INTENT(IN) :: itimes
1799 REAL(kind=
dp),
INTENT(IN) :: time
1801 IF (
ASSOCIATED(thermostats))
THEN
1802 IF (
ASSOCIATED(thermostats%thermostat_part))
THEN
1803 CALL print_thermostat_status(thermostats%thermostat_part, para_env, my_pos, my_act, itimes, time)
1805 IF (
ASSOCIATED(thermostats%thermostat_shell))
THEN
1806 CALL print_thermostat_status(thermostats%thermostat_shell, para_env, my_pos, my_act, itimes, time)
1808 IF (
ASSOCIATED(thermostats%thermostat_coef))
THEN
1809 CALL print_thermostat_status(thermostats%thermostat_coef, para_env, my_pos, my_act, itimes, time)
1811 IF (
ASSOCIATED(thermostats%thermostat_baro))
THEN
1812 CALL print_thermostat_status(thermostats%thermostat_baro, para_env, my_pos, my_act, itimes, time)
1827 SUBROUTINE print_thermostat_status(thermostat, para_env, my_pos, my_act, itimes, time)
1830 CHARACTER(LEN=default_string_length) :: my_pos, my_act
1831 INTEGER,
INTENT(IN) :: itimes
1832 REAL(kind=
dp),
INTENT(IN) :: time
1836 REAL(kind=
dp) :: thermo_kin, thermo_pot, tot_temperature
1837 REAL(kind=
dp),
DIMENSION(:),
POINTER :: array_kin, array_pot, array_temp
1841 NULLIFY (logger, print_key, array_pot, array_kin, array_temp)
1844 IF (
ASSOCIATED(thermostat))
THEN
1850 extension=
"."//trim(thermostat%label)//
".tener", file_position=my_pos, &
1851 file_action=my_act, is_new_file=new_file)
1854 WRITE (unit,
'(A)')
"# Thermostat Potential and Kinetic Energies - Total and per Region"
1855 WRITE (unit,
'("#",3X,A,2X,A,13X,A,10X,A)')
"Step Nr.",
"Time[fs]",
"Kin.[a.u.]",
"Pot.[a.u.]"
1857 WRITE (unit=unit, fmt=
"(I8, F12.3,6X,2F20.10)") itimes, time*
femtoseconds, thermo_kin, thermo_pot
1858 WRITE (unit,
'(A,4F20.10)')
"# KINETIC ENERGY REGIONS: ", array_kin(1:min(4,
SIZE(array_kin)))
1859 DO i = 5,
SIZE(array_kin), 4
1860 WRITE (unit=unit, fmt=
'("#",25X,4F20.10)') array_kin(i:min(i + 3,
SIZE(array_kin)))
1862 WRITE (unit,
'(A,4F20.10)')
"# POTENT. ENERGY REGIONS: ", array_pot(1:min(4,
SIZE(array_pot)))
1863 DO i = 5,
SIZE(array_pot), 4
1864 WRITE (unit=unit, fmt=
'("#",25X,4F20.10)') array_pot(i:min(i + 3,
SIZE(array_pot)))
1868 DEALLOCATE (array_kin)
1869 DEALLOCATE (array_pot)
1875 CALL get_region_temperatures(thermostat, tot_temperature, para_env, array_temp)
1877 extension=
"."//trim(thermostat%label)//
".temp", file_position=my_pos, &
1878 file_action=my_act, is_new_file=new_file)
1881 WRITE (unit,
'(A)')
"# Temperature Total and per Region"
1882 WRITE (unit,
'("#",3X,A,2X,A,10X,A)')
"Step Nr.",
"Time[fs]",
"Temp.[K]"
1884 WRITE (unit=unit, fmt=
"(I8, F12.3,3X,F20.10)") itimes, time*
femtoseconds, tot_temperature
1885 WRITE (unit,
'(A,I10)')
"# TEMPERATURE REGIONS: ",
SIZE(array_temp)
1886 DO i = 1,
SIZE(array_temp), 4
1887 WRITE (unit=unit, fmt=
'("#",22X,4F20.10)') array_temp(i:min(i + 3,
SIZE(array_temp)))
1891 DEALLOCATE (array_temp)
1895 END SUBROUTINE print_thermostat_status
1904 SUBROUTINE communication_thermo_low1(array, number, para_env)
1905 REAL(kind=
dp),
DIMENSION(:),
INTENT(INOUT) :: array
1906 INTEGER,
INTENT(IN) :: number
1909 INTEGER :: i, icheck, ncheck
1910 REAL(kind=
dp),
DIMENSION(:),
POINTER :: work, work2
1912 ALLOCATE (work(para_env%num_pe))
1915 work(para_env%mepos + 1) = array(i)
1916 CALL para_env%sum(work)
1917 ncheck = count(work /= 0.0_dp)
1919 IF (ncheck /= 0)
THEN
1920 ALLOCATE (work2(ncheck))
1922 DO icheck = 1, para_env%num_pe
1923 IF (work(icheck) /= 0.0_dp)
THEN
1925 work2(ncheck) = work(icheck)
1928 cpassert(ncheck ==
SIZE(work2))
1929 cpassert(all(work2 == work2(1)))
1936 END SUBROUTINE communication_thermo_low1
1947 INTEGER,
DIMENSION(:, :),
INTENT(INOUT) :: array
1948 INTEGER,
INTENT(IN) :: number1, number2
1951 INTEGER :: i, icheck, j, ncheck
1952 INTEGER,
DIMENSION(:, :),
POINTER :: work, work2
1954 ALLOCATE (work(number1, para_env%num_pe))
1957 work(:, para_env%mepos + 1) = array(:, i)
1958 CALL para_env%sum(work)
1960 DO j = 1, para_env%num_pe
1961 IF (any(work(:, j) /= 0))
THEN
1966 IF (ncheck /= 0)
THEN
1967 ALLOCATE (work2(number1, ncheck))
1969 DO icheck = 1, para_env%num_pe
1970 IF (any(work(:, icheck) /= 0))
THEN
1972 work2(:, ncheck) = work(:, icheck)
1975 cpassert(ncheck ==
SIZE(work2, 2))
1977 cpassert(all(work2(:, j) == work2(:, 1)))
1979 array(:, i) = work2(:, 1)
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 ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
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...
Lumps all possible extended system variables into one type for easy access and passing.
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Machine interface based on Fortran 2003 and POSIX.
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
Interface to the message passing library MPI.
Define the molecule kind structure types and the corresponding functionality.
subroutine, public get_molecule_kind(molecule_kind, atom_list, bond_list, bend_list, ub_list, impr_list, opbend_list, colv_list, fixd_list, g3x3_list, g4x6_list, vsite_list, torsion_list, shell_list, name, mass, charge, kind_number, natom, nbend, nbond, nub, nimpr, nopbend, nconstraint, nconstraint_fixd, nfixd, ncolv, ng3x3, ng4x6, nvsite, nfixd_restraint, ng3x3_restraint, ng4x6_restraint, nvsite_restraint, nrestraints, nmolecule, nsgf, nshell, ntorsion, molecule_list, nelectron, nelectron_alpha, nelectron_beta, bond_kind_set, bend_kind_set, ub_kind_set, impr_kind_set, opbend_kind_set, torsion_kind_set, molname_generated)
Get informations about a molecule kind.
subroutine, public write_g4x6_constraint(g4x6_constraint, ig4x6, iw)
Write G4x6 constraint information to output unit.
subroutine, public get_molecule_kind_set(molecule_kind_set, maxatom, natom, nbond, nbend, nub, ntorsion, nimpr, nopbend, nconstraint, nconstraint_fixd, nmolecule, nrestraints)
Get informations about a molecule kind set.
subroutine, public write_g3x3_constraint(g3x3_constraint, ig3x3, iw)
Write G3x3 constraint information to output unit.
subroutine, public write_fixd_constraint(fixd_constraint, ifixd, iw)
Write fix atom constraint information to output unit.
subroutine, public write_colvar_constraint(colvar_constraint, icolv, iw)
Write collective variable constraint information to output unit.
subroutine, public write_vsite_constraint(vsite_constraint, ivsite, iw)
Write virtual site constraint information to output unit.
represent a simple array based list of the given type
Define the data structure for the molecule information.
subroutine, public get_molecule(molecule, molecule_kind, lmi, lci, lg3x3, lg4x6, lcolv, first_atom, last_atom, first_shell, last_shell)
Get components from a molecule data set.
Output Utilities for MOTION_SECTION.
subroutine, public rot_ana(particles, mat, dof, print_section, keep_rotations, mass_weighted, natoms, rot_dof, inertia)
Performs an analysis of the principal inertia axis Getting back the generators of the translating and...
represent a simple array based list of the given type
Define the data structure for the particle information.
Definition of physical constants:
real(kind=dp), parameter, public femtoseconds
Basic container type for QM/MM.
Type for storing MD parameters.
Thermostat structure: module containing thermostat available for MD.
Utilities for thermostats.
subroutine, public setup_adiabatic_thermostat_info(thermostat_info, molecule_kind_set, local_molecules, molecules, particles, region, ensemble, nfree, shell, region_sections, qmmm_env)
...
subroutine, public compute_nfree(cell, simpar, molecule_kind_set, print_section, particles, gci)
...
subroutine, public momentum_region_particles(map_info, particle_set, molecule_kind_set, local_molecules, molecule_set, group, vel)
...
subroutine, public vel_rescale_shells(map_info, atomic_kind_set, particle_set, local_particles, shell_particle_set, core_particle_set, shell_vel, core_vel, vel)
...
subroutine, public communication_thermo_low2(array, number1, number2, para_env)
Handles the communication for thermostats (2D array)
subroutine, public print_thermostats_status(thermostats, para_env, my_pos, my_act, itimes, time)
Prints status of all thermostats during an MD run.
subroutine, public vel_rescale_particles(map_info, molecule_kind_set, molecule_set, particle_set, local_molecules, shell_adiabatic, shell_particle_set, core_particle_set, vel, shell_vel, core_vel)
...
subroutine, public ke_region_shells(map_info, particle_set, atomic_kind_set, local_particles, group, core_particle_set, shell_particle_set, core_vel, shell_vel)
...
subroutine, public get_thermostat_energies(thermostat, thermostat_pot, thermostat_kin, para_env, array_pot, array_kin)
Calculates energy associated with a thermostat.
subroutine, public ke_region_baro(map_info, npt, group)
...
subroutine, public vel_rescale_baro(map_info, npt)
...
subroutine, public ke_region_particles(map_info, particle_set, molecule_kind_set, local_molecules, molecule_set, group, vel)
...
subroutine, public get_nhc_energies(nhc, nhc_pot, nhc_kin, para_env, array_kin, array_pot)
Calculates kinetic energy and potential energy of the nhc variables.
subroutine, public setup_thermostat_info(thermostat_info, molecule_kind_set, local_molecules, molecules, particles, region, ensemble, nfree, shell, region_sections, qmmm_env)
...
subroutine, public compute_degrees_of_freedom(thermostats, cell, simpar, molecule_kind_set, local_molecules, molecules, particles, print_section, region_sections, gci, region, qmmm_env)
...
subroutine, public get_kin_energies(map_info, loc_num, glob_num, thermo_energy, thermostat_kin, para_env, array_pot, array_kin)
Calculates kinetic energy and potential energy of the csvr and gle thermostats.
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.
stores all the informations relevant to an mpi environment
represent a list of objects
represent a list of objects
Simulation parameter type for molecular dynamics.