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)) &
388 thermostat_info%map_loc_thermo_gen(natom_local) = thermolist(ipart)
403 nmol_local = local_molecules%n_el(ikind)
404 molecule_kind => molecule_kind_set(ikind)
408 IF (nshell == 0) nmol_local = 0
411 number = number + nmol_local
413 number = number + 3*nmol_local*natom
415 cpabort(
'Invalid region setup')
424 IF (
PRESENT(nfree))
THEN
431 thermostat_info%sum_of_thermostats = sum_of_thermostats
432 thermostat_info%number_of_thermostats = number
433 thermostat_info%dis_type = dis_type
435 DEALLOCATE (thermolist)
450 SUBROUTINE get_adiabatic_region_info(region_sections, sum_of_thermostats, &
451 thermolist, molecule_kind_set, molecules, particles, &
454 INTEGER,
INTENT(INOUT),
OPTIONAL :: sum_of_thermostats
455 INTEGER,
DIMENSION(:),
POINTER :: thermolist(:)
461 CHARACTER(LEN=default_string_length), &
462 DIMENSION(:),
POINTER :: tmpstringlist
463 INTEGER :: first_atom, i, ig, ikind, ilist, imol, &
464 ipart, itherm, jg, last_atom, &
465 mregions, n_rep, nregions, output_unit
466 INTEGER,
DIMENSION(:),
POINTER :: tmplist
472 NULLIFY (tmplist, tmpstringlist, thermolist, molecule_kind, molecule, molecule_set)
478 ALLOCATE (thermolist(particles%n_els))
480 molecule_set => molecules%els
486 CALL section_vals_val_get(region_sections,
"LIST", i_rep_section=ig, i_rep_val=jg, i_vals=tmplist)
487 DO i = 1,
SIZE(tmplist)
489 cpassert(((ipart > 0) .AND. (ipart <= particles%n_els)))
490 IF (thermolist(ipart) == huge(0))
THEN
492 thermolist(ipart) = itherm
500 CALL section_vals_val_get(region_sections,
"MOLNAME", i_rep_section=ig, i_rep_val=jg, c_vals=tmpstringlist)
501 DO ilist = 1,
SIZE(tmpstringlist)
502 DO ikind = 1,
SIZE(molecule_kind_set)
503 molecule_kind => molecule_kind_set(ikind)
504 IF (molecule_kind%name == tmpstringlist(ilist))
THEN
505 DO imol = 1,
SIZE(molecule_kind%molecule_list)
506 molecule => molecule_set(molecule_kind%molecule_list(imol))
507 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
508 DO ipart = first_atom, last_atom
509 IF (thermolist(ipart) == huge(0))
THEN
511 thermolist(ipart) = itherm
521 CALL setup_thermostat_subsys(region_sections, qmmm_env, thermolist, molecule_set, &
522 subsys_qm=.false., ig=ig, sum_of_thermostats=sum_of_thermostats, nregions=nregions)
523 CALL setup_thermostat_subsys(region_sections, qmmm_env, thermolist, molecule_set, &
524 subsys_qm=.true., ig=ig, sum_of_thermostats=sum_of_thermostats, nregions=nregions)
527 cpassert(.NOT. all(thermolist == huge(0)))
564 END SUBROUTINE get_adiabatic_region_info
581 molecules, particles, region, ensemble, nfree, shell, region_sections, qmmm_env)
587 INTEGER,
INTENT(IN) :: region, ensemble
588 INTEGER,
INTENT(INOUT),
OPTIONAL :: nfree
589 LOGICAL,
INTENT(IN),
OPTIONAL :: shell
593 INTEGER :: dis_type, i, ikind, natom, nkind, &
594 nmol_local, nmolecule, nshell, number, &
596 LOGICAL :: check, do_shell, nointer
599 NULLIFY (molecule_kind)
600 nkind =
SIZE(molecule_kind_set)
602 IF (
PRESENT(shell)) do_shell = shell
604 sum_of_thermostats = 0
611 SELECT CASE (ensemble)
613 cpabort(
'Unknown ensemble')
625 sum_of_thermostats = 1
629 molecule_kind => molecule_kind_set(i)
631 IF ((do_shell) .AND. (nshell == 0)) nmolecule = 0
632 sum_of_thermostats = sum_of_thermostats + nmolecule
636 IF ((nmolecule == 1) .AND. (nkind == 1)) nointer = .false.
640 molecule_kind => molecule_kind_set(i)
642 natom=natom, nshell=nshell)
643 IF (do_shell) natom = nshell
644 sum_of_thermostats = sum_of_thermostats + 3*natom*nmolecule
651 IF (sum_of_thermostats < 1) &
652 CALL cp_abort(__location__, &
653 "A thermostat type DEFINED is requested but no thermostat "// &
654 "regions are defined in THERMOSTAT/DEFINE_REGION.")
660 IF (sum_of_thermostats < 1) &
661 CALL cp_abort(__location__, &
662 "A thermostat type THERMAL is requested but no thermal "// &
663 "regions are defined in THERMAL_REGION/DEFINE_REGION.")
677 nmol_local = local_molecules%n_el(ikind)
678 molecule_kind => molecule_kind_set(ikind)
682 IF (nshell == 0) nmol_local = 0
685 number = number + nmol_local
687 number = number + 3*nmol_local*natom
689 cpabort(
'Invalid region setup')
698 CALL get_defined_region_info(region_sections, number, sum_of_thermostats, &
699 map_loc_thermo_gen=thermostat_info%map_loc_thermo_gen, &
700 local_molecules=local_molecules, molecule_kind_set=molecule_kind_set, &
701 molecules=molecules, particles=particles, qmmm_env=qmmm_env)
705 IF (
PRESENT(nfree))
THEN
715 thermostat_info%sum_of_thermostats = sum_of_thermostats
716 thermostat_info%number_of_thermostats = number
717 thermostat_info%dis_type = dis_type
733 SUBROUTINE get_defined_region_info(region_sections, number, sum_of_thermostats, &
734 map_loc_thermo_gen, local_molecules, molecule_kind_set, molecules, particles, &
737 INTEGER,
INTENT(OUT),
OPTIONAL :: number
738 INTEGER,
INTENT(INOUT),
OPTIONAL :: sum_of_thermostats
739 INTEGER,
DIMENSION(:),
POINTER :: map_loc_thermo_gen
746 CHARACTER(LEN=default_string_length), &
747 DIMENSION(:),
POINTER :: tmpstringlist
748 INTEGER :: first_atom, i, ig, ikind, ilist, imol, ipart, jg, last_atom, mregions, n_rep, &
749 natom_local, nmol_per_kind, nregions, output_unit
750 INTEGER,
DIMENSION(:),
POINTER :: thermolist, tmp, tmplist
756 NULLIFY (tmplist, tmpstringlist, thermolist, molecule_kind, molecule, molecule_set)
760 cpassert(.NOT. (
ASSOCIATED(map_loc_thermo_gen)))
762 ALLOCATE (thermolist(particles%n_els))
764 molecule_set => molecules%els
770 CALL section_vals_val_get(region_sections,
"LIST", i_rep_section=ig, i_rep_val=jg, i_vals=tmplist)
771 DO i = 1,
SIZE(tmplist)
773 cpassert(((ipart > 0) .AND. (ipart <= particles%n_els)))
774 IF (thermolist(ipart) == huge(0) .OR. thermolist(ipart) == ig)
THEN
775 thermolist(ipart) = ig
777 CALL cp_abort(__location__, &
779 "assigned to different thermostat regions "// &
789 CALL section_vals_val_get(region_sections,
"MOLNAME", i_rep_section=ig, i_rep_val=jg, c_vals=tmpstringlist)
790 DO ilist = 1,
SIZE(tmpstringlist)
791 DO ikind = 1,
SIZE(molecule_kind_set)
792 molecule_kind => molecule_kind_set(ikind)
793 IF (molecule_kind%name == tmpstringlist(ilist))
THEN
794 DO imol = 1,
SIZE(molecule_kind%molecule_list)
795 molecule => molecule_set(molecule_kind%molecule_list(imol))
796 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
797 DO ipart = first_atom, last_atom
798 IF (thermolist(ipart) == huge(0) .OR. thermolist(ipart) == ig)
THEN
799 thermolist(ipart) = ig
801 CALL cp_abort(__location__, &
803 "assigned to different thermostat regions "// &
814 CALL setup_thermostat_subsys(region_sections, qmmm_env, thermolist, molecule_set, &
815 subsys_qm=.false., ig=ig, sum_of_thermostats=sum_of_thermostats, nregions=nregions)
816 CALL setup_thermostat_subsys(region_sections, qmmm_env, thermolist, molecule_set, &
817 subsys_qm=.true., ig=ig, sum_of_thermostats=sum_of_thermostats, nregions=nregions)
821 IF (any(thermolist == huge(0)))
THEN
822 nregions = nregions + 1
823 sum_of_thermostats = sum_of_thermostats + 1
824 ALLOCATE (tmp(count(thermolist == huge(0))))
826 DO i = 1,
SIZE(thermolist)
827 IF (thermolist(i) == huge(0))
THEN
830 thermolist(i) = nregions
834 IF (output_unit > 0)
THEN
835 WRITE (output_unit,
'(/,T2,A)') &
836 "THERMOSTAT| Warning: No thermostats defined for the following atoms:"
838 WRITE (output_unit,
'(T2,A,T17,8I8)')
"THERMOSTAT|", tmp(i:min(i + 7, ilist))
840 WRITE (output_unit,
'(T2,A)') &
841 "THERMOSTAT| They will be included in a further unique thermostat!"
846 cpassert(all(thermolist /= huge(0)))
850 IF (output_unit > 0)
THEN
851 WRITE (output_unit,
'(/,T2,A)') &
852 "THERMOSTAT| Mapping of thermostat region indices to particles"
853 DO ipart = 1, particles%n_els, 16
854 WRITE (output_unit,
'(T2,A,T17,16(" ",I3))') &
855 "THERMOSTAT|", thermolist(ipart:min(ipart + 15, particles%n_els))
860 ALLOCATE (tmp(nregions))
863 DO ikind = 1,
SIZE(molecule_kind_set)
864 nmol_per_kind = local_molecules%n_el(ikind)
865 DO imol = 1, nmol_per_kind
866 i = local_molecules%list(ikind)%array(imol)
867 molecule => molecule_set(i)
868 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
869 DO ipart = first_atom, last_atom
870 natom_local = natom_local + 1
871 tmp(thermolist(ipart)) = 1
879 ALLOCATE (map_loc_thermo_gen(natom_local))
881 DO ikind = 1,
SIZE(molecule_kind_set)
882 nmol_per_kind = local_molecules%n_el(ikind)
883 DO imol = 1, nmol_per_kind
884 i = local_molecules%list(ikind)%array(imol)
885 molecule => molecule_set(i)
886 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
887 DO ipart = first_atom, last_atom
888 natom_local = natom_local + 1
889 map_loc_thermo_gen(natom_local) = thermolist(ipart)
894 DEALLOCATE (thermolist)
895 END SUBROUTINE get_defined_region_info
909 SUBROUTINE setup_thermostat_subsys(region_sections, qmmm_env, thermolist, &
910 molecule_set, subsys_qm, ig, sum_of_thermostats, nregions)
913 INTEGER,
DIMENSION(:),
POINTER :: thermolist
915 LOGICAL,
INTENT(IN) :: subsys_qm
916 INTEGER,
INTENT(IN) :: ig
917 INTEGER,
INTENT(INOUT) :: sum_of_thermostats, nregions
919 CHARACTER(LEN=default_string_length) :: label1, label2
920 INTEGER :: first_atom, i, imolecule, ipart, &
921 last_atom, nrep, thermo1
922 INTEGER,
DIMENSION(:),
POINTER :: atom_index1
933 n_rep_val=nrep, explicit=explicit)
934 IF (nrep == 1 .AND. explicit)
THEN
935 IF (
ASSOCIATED(qmmm_env))
THEN
936 atom_index1 => qmmm_env%qm%mm_atom_index
938 atom_index1 => qmmm_env%qm%qm_atom_index
941 SELECT CASE (thermo1)
943 DO i = 1,
SIZE(atom_index1)
944 ipart = atom_index1(i)
945 IF (subsys_qm .AND. qmmm_env%qm%qmmm_link .AND.
ASSOCIATED(qmmm_env%qm%mm_link_atoms))
THEN
946 IF (any(ipart == qmmm_env%qm%mm_link_atoms)) cycle
948 IF (thermolist(ipart) == huge(0))
THEN
949 thermolist(ipart) = ig
951 CALL cp_abort(__location__, &
953 trim(label1)//
' was already assigned to'// &
954 ' the thermostatting region Nr.'//
cp_to_string(thermolist(ipart))// &
955 '. Please check the input for inconsistencies!')
959 DO imolecule = 1,
SIZE(molecule_set)
960 molecule => molecule_set(imolecule)
961 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
962 IF (any(atom_index1 >= first_atom .AND. atom_index1 <= last_atom))
THEN
963 DO ipart = first_atom, last_atom
964 IF (thermolist(ipart) == huge(0))
THEN
965 thermolist(ipart) = ig
967 CALL cp_abort(__location__, &
969 trim(label1)//
' was already assigned to'// &
970 ' the thermostatting region Nr.'//
cp_to_string(thermolist(ipart))// &
971 '. Please check the input for inconsistencies!')
978 sum_of_thermostats = sum_of_thermostats - 1
979 nregions = nregions - 1
982 END SUBROUTINE setup_thermostat_subsys
997 INTEGER :: i, j, ncoef
999 map_info%v_scale = 1.0_dp
1000 map_info%s_kin = 0.0_dp
1002 DO i = 1,
SIZE(npt, 1)
1003 DO j = 1,
SIZE(npt, 2)
1005 map_info%p_kin(1, ncoef)%point = map_info%p_kin(1, ncoef)%point &
1006 + npt(i, j)%mass*npt(i, j)%v**2
1023 INTENT(INOUT) :: npt
1025 INTEGER :: i, j, ncoef
1028 DO i = 1,
SIZE(npt, 1)
1029 DO j = 1,
SIZE(npt, 2)
1031 npt(i, j)%v = npt(i, j)%v*map_info%p_scale(1, ncoef)%point
1049 local_molecules, molecule_set, group, vel)
1057 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: vel(:, :)
1059 INTEGER :: first_atom, ii, ikind, imol, imol_local, &
1060 ipart, last_atom, nmol_local
1061 LOGICAL :: present_vel
1062 REAL(kind=
dp) :: mass
1066 map_info%v_scale = 1.0_dp
1067 map_info%s_kin = 0.0_dp
1068 present_vel =
PRESENT(vel)
1070 DO ikind = 1,
SIZE(molecule_kind_set)
1071 nmol_local = local_molecules%n_el(ikind)
1072 DO imol_local = 1, nmol_local
1073 imol = local_molecules%list(ikind)%array(imol_local)
1074 molecule => molecule_set(imol)
1075 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
1076 DO ipart = first_atom, last_atom
1078 atomic_kind => particle_set(ipart)%atomic_kind
1080 IF (present_vel)
THEN
1081 IF (
ASSOCIATED(map_info%p_kin(1, ii)%point)) &
1082 map_info%p_kin(1, ii)%point = map_info%p_kin(1, ii)%point + mass*vel(1, ipart)**2
1083 IF (
ASSOCIATED(map_info%p_kin(2, ii)%point)) &
1084 map_info%p_kin(2, ii)%point = map_info%p_kin(2, ii)%point + mass*vel(2, ipart)**2
1085 IF (
ASSOCIATED(map_info%p_kin(3, ii)%point)) &
1086 map_info%p_kin(3, ii)%point = map_info%p_kin(3, ii)%point + mass*vel(3, ipart)**2
1088 IF (
ASSOCIATED(map_info%p_kin(1, ii)%point)) &
1089 map_info%p_kin(1, ii)%point = map_info%p_kin(1, ii)%point + mass*particle_set(ipart)%v(1)**2
1090 IF (
ASSOCIATED(map_info%p_kin(2, ii)%point)) &
1091 map_info%p_kin(2, ii)%point = map_info%p_kin(2, ii)%point + mass*particle_set(ipart)%v(2)**2
1092 IF (
ASSOCIATED(map_info%p_kin(3, ii)%point)) &
1093 map_info%p_kin(3, ii)%point = map_info%p_kin(3, ii)%point + mass*particle_set(ipart)%v(3)**2
1115 local_molecules, molecule_set, group, vel)
1123 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: vel(:, :)
1125 INTEGER :: first_atom, ii, ikind, imol, imol_local, &
1126 ipart, last_atom, nmol_local
1127 LOGICAL :: present_vel
1128 REAL(kind=
dp) :: mass
1132 map_info%v_scale = 1.0_dp
1133 map_info%s_kin = 0.0_dp
1134 present_vel =
PRESENT(vel)
1136 DO ikind = 1,
SIZE(molecule_kind_set)
1137 nmol_local = local_molecules%n_el(ikind)
1138 DO imol_local = 1, nmol_local
1139 imol = local_molecules%list(ikind)%array(imol_local)
1140 molecule => molecule_set(imol)
1141 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
1142 DO ipart = first_atom, last_atom
1144 atomic_kind => particle_set(ipart)%atomic_kind
1146 IF (present_vel)
THEN
1147 map_info%p_kin(1, ii)%point = map_info%p_kin(1, ii)%point + sqrt(mass)*vel(1, ipart)
1148 map_info%p_kin(2, ii)%point = map_info%p_kin(2, ii)%point + sqrt(mass)*vel(2, ipart)
1149 map_info%p_kin(3, ii)%point = map_info%p_kin(3, ii)%point + sqrt(mass)*vel(3, ipart)
1151 map_info%p_kin(1, ii)%point = map_info%p_kin(1, ii)%point + sqrt(mass)*particle_set(ipart)%v(1)
1152 map_info%p_kin(2, ii)%point = map_info%p_kin(2, ii)%point + sqrt(mass)*particle_set(ipart)%v(2)
1153 map_info%p_kin(3, ii)%point = map_info%p_kin(3, ii)%point + sqrt(mass)*particle_set(ipart)%v(3)
1179 particle_set, local_molecules, shell_adiabatic, shell_particle_set, &
1180 core_particle_set, vel, shell_vel, core_vel)
1187 LOGICAL,
INTENT(IN) :: shell_adiabatic
1188 TYPE(
particle_type),
OPTIONAL,
POINTER :: shell_particle_set(:), &
1189 core_particle_set(:)
1190 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: vel(:, :), shell_vel(:, :), &
1193 INTEGER :: first_atom, ii, ikind, imol, imol_local, &
1194 ipart, jj, last_atom, nmol_local, &
1196 LOGICAL :: present_vel
1197 REAL(kind=
dp) :: fac_massc, fac_masss, mass, vc(3), vs(3)
1204 present_vel =
PRESENT(vel)
1206 IF (present_vel)
THEN
1207 IF (shell_adiabatic)
THEN
1208 cpassert(
PRESENT(shell_vel))
1209 cpassert(
PRESENT(core_vel))
1212 IF (shell_adiabatic)
THEN
1213 cpassert(
PRESENT(shell_particle_set))
1214 cpassert(
PRESENT(core_particle_set))
1217 kind:
DO ikind = 1,
SIZE(molecule_kind_set)
1218 nmol_local = local_molecules%n_el(ikind)
1219 mol_local:
DO imol_local = 1, nmol_local
1220 imol = local_molecules%list(ikind)%array(imol_local)
1221 molecule => molecule_set(imol)
1222 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
1223 particle:
DO ipart = first_atom, last_atom
1225 IF (present_vel)
THEN
1226 vel(1, ipart) = vel(1, ipart)*map_info%p_scale(1, ii)%point
1227 vel(2, ipart) = vel(2, ipart)*map_info%p_scale(2, ii)%point
1228 vel(3, ipart) = vel(3, ipart)*map_info%p_scale(3, ii)%point
1230 particle_set(ipart)%v(1) = particle_set(ipart)%v(1)*map_info%p_scale(1, ii)%point
1231 particle_set(ipart)%v(2) = particle_set(ipart)%v(2)*map_info%p_scale(2, ii)%point
1232 particle_set(ipart)%v(3) = particle_set(ipart)%v(3)*map_info%p_scale(3, ii)%point
1235 IF (shell_adiabatic)
THEN
1236 shell_index = particle_set(ipart)%shell_index
1237 IF (shell_index /= 0)
THEN
1239 atomic_kind => particle_set(ipart)%atomic_kind
1241 fac_masss = shell%mass_shell/mass
1242 fac_massc = shell%mass_core/mass
1243 IF (present_vel)
THEN
1244 vs(1:3) = shell_vel(1:3, shell_index)
1245 vc(1:3) = core_vel(1:3, shell_index)
1246 shell_vel(1, shell_index) = vel(1, ipart) + fac_massc*(vs(1) - vc(1))
1247 shell_vel(2, shell_index) = vel(2, ipart) + fac_massc*(vs(2) - vc(2))
1248 shell_vel(3, shell_index) = vel(3, ipart) + fac_massc*(vs(3) - vc(3))
1249 core_vel(1, shell_index) = vel(1, ipart) + fac_masss*(vc(1) - vs(1))
1250 core_vel(2, shell_index) = vel(2, ipart) + fac_masss*(vc(2) - vs(2))
1251 core_vel(3, shell_index) = vel(3, ipart) + fac_masss*(vc(3) - vs(3))
1253 vs(1:3) = shell_particle_set(shell_index)%v(1:3)
1254 vc(1:3) = core_particle_set(shell_index)%v(1:3)
1255 shell_particle_set(shell_index)%v(1) = particle_set(ipart)%v(1) + fac_massc*(vs(1) - vc(1))
1256 shell_particle_set(shell_index)%v(2) = particle_set(ipart)%v(2) + fac_massc*(vs(2) - vc(2))
1257 shell_particle_set(shell_index)%v(3) = particle_set(ipart)%v(3) + fac_massc*(vs(3) - vc(3))
1258 core_particle_set(shell_index)%v(1) = particle_set(ipart)%v(1) + fac_masss*(vc(1) - vs(1))
1259 core_particle_set(shell_index)%v(2) = particle_set(ipart)%v(2) + fac_masss*(vc(2) - vs(2))
1260 core_particle_set(shell_index)%v(3) = particle_set(ipart)%v(3) + fac_masss*(vc(3) - vs(3))
1284 local_particles, group, core_particle_set, shell_particle_set, &
1285 core_vel, shell_vel)
1292 TYPE(
particle_type),
OPTIONAL,
POINTER :: core_particle_set(:), &
1293 shell_particle_set(:)
1294 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: core_vel(:, :), shell_vel(:, :)
1296 INTEGER :: ii, iparticle, iparticle_kind, &
1297 iparticle_local, nparticle_kind, &
1298 nparticle_local, shell_index
1299 LOGICAL :: is_shell, present_vel
1300 REAL(
dp) :: mass, mu_mass, v_sc(3)
1304 present_vel =
PRESENT(shell_vel)
1306 IF (present_vel)
THEN
1307 cpassert(
PRESENT(core_vel))
1309 cpassert(
PRESENT(shell_particle_set))
1310 cpassert(
PRESENT(core_particle_set))
1313 map_info%v_scale = 1.0_dp
1314 map_info%s_kin = 0.0_dp
1317 nparticle_kind =
SIZE(atomic_kind_set)
1318 DO iparticle_kind = 1, nparticle_kind
1319 atomic_kind => atomic_kind_set(iparticle_kind)
1320 CALL get_atomic_kind(atomic_kind=atomic_kind, mass=mass, shell_active=is_shell, shell=shell)
1322 mu_mass = shell%mass_shell*shell%mass_core/mass
1323 nparticle_local = local_particles%n_el(iparticle_kind)
1324 DO iparticle_local = 1, nparticle_local
1325 iparticle = local_particles%list(iparticle_kind)%array(iparticle_local)
1326 shell_index = particle_set(iparticle)%shell_index
1328 IF (present_vel)
THEN
1329 v_sc(1) = core_vel(1, shell_index) - shell_vel(1, shell_index)
1330 v_sc(2) = core_vel(2, shell_index) - shell_vel(2, shell_index)
1331 v_sc(3) = core_vel(3, shell_index) - shell_vel(3, shell_index)
1332 map_info%p_kin(1, ii)%point = map_info%p_kin(1, ii)%point + mu_mass*v_sc(1)**2
1333 map_info%p_kin(2, ii)%point = map_info%p_kin(2, ii)%point + mu_mass*v_sc(2)**2
1334 map_info%p_kin(3, ii)%point = map_info%p_kin(3, ii)%point + mu_mass*v_sc(3)**2
1336 v_sc(1) = core_particle_set(shell_index)%v(1) - shell_particle_set(shell_index)%v(1)
1337 v_sc(2) = core_particle_set(shell_index)%v(2) - shell_particle_set(shell_index)%v(2)
1338 v_sc(3) = core_particle_set(shell_index)%v(3) - shell_particle_set(shell_index)%v(3)
1339 map_info%p_kin(1, ii)%point = map_info%p_kin(1, ii)%point + mu_mass*v_sc(1)**2
1340 map_info%p_kin(2, ii)%point = map_info%p_kin(2, ii)%point + mu_mass*v_sc(2)**2
1341 map_info%p_kin(3, ii)%point = map_info%p_kin(3, ii)%point + mu_mass*v_sc(3)**2
1364 shell_particle_set, core_particle_set, shell_vel, core_vel, vel)
1370 TYPE(
particle_type),
OPTIONAL,
POINTER :: shell_particle_set(:), &
1371 core_particle_set(:)
1372 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: shell_vel(:, :), core_vel(:, :), &
1375 INTEGER :: ii, iparticle, iparticle_kind, &
1376 iparticle_local, nparticle_kind, &
1377 nparticle_local, shell_index
1378 LOGICAL :: is_shell, present_vel
1379 REAL(
dp) :: mass, massc, masss, umass, v(3), vc(3), &
1384 present_vel =
PRESENT(vel)
1386 IF (present_vel)
THEN
1387 cpassert(
PRESENT(shell_vel))
1388 cpassert(
PRESENT(core_vel))
1390 cpassert(
PRESENT(shell_particle_set))
1391 cpassert(
PRESENT(core_particle_set))
1394 nparticle_kind =
SIZE(atomic_kind_set)
1396 kind:
DO iparticle_kind = 1, nparticle_kind
1397 atomic_kind => atomic_kind_set(iparticle_kind)
1398 CALL get_atomic_kind(atomic_kind=atomic_kind, mass=mass, shell_active=is_shell, shell=shell)
1401 masss = shell%mass_shell*umass
1402 massc = shell%mass_core*umass
1404 nparticle_local = local_particles%n_el(iparticle_kind)
1405 particles:
DO iparticle_local = 1, nparticle_local
1406 iparticle = local_particles%list(iparticle_kind)%array(iparticle_local)
1407 shell_index = particle_set(iparticle)%shell_index
1409 IF (present_vel)
THEN
1410 vc(1:3) = core_vel(1:3, shell_index)
1411 vs(1:3) = shell_vel(1:3, shell_index)
1412 v(1:3) = vel(1:3, iparticle)
1413 shell_vel(1, shell_index) = v(1) + map_info%p_scale(1, ii)%point*massc*(vs(1) - vc(1))
1414 shell_vel(2, shell_index) = v(2) + map_info%p_scale(2, ii)%point*massc*(vs(2) - vc(2))
1415 shell_vel(3, shell_index) = v(3) + map_info%p_scale(3, ii)%point*massc*(vs(3) - vc(3))
1416 core_vel(1, shell_index) = v(1) + map_info%p_scale(1, ii)%point*masss*(vc(1) - vs(1))
1417 core_vel(2, shell_index) = v(2) + map_info%p_scale(2, ii)%point*masss*(vc(2) - vs(2))
1418 core_vel(3, shell_index) = v(3) + map_info%p_scale(3, ii)%point*masss*(vc(3) - vs(3))
1420 vc(1:3) = core_particle_set(shell_index)%v(1:3)
1421 vs(1:3) = shell_particle_set(shell_index)%v(1:3)
1422 v(1:3) = particle_set(iparticle)%v(1:3)
1423 shell_particle_set(shell_index)%v(1) = v(1) + map_info%p_scale(1, ii)%point*massc*(vs(1) - vc(1))
1424 shell_particle_set(shell_index)%v(2) = v(2) + map_info%p_scale(2, ii)%point*massc*(vs(2) - vc(2))
1425 shell_particle_set(shell_index)%v(3) = v(3) + map_info%p_scale(3, ii)%point*massc*(vs(3) - vc(3))
1426 core_particle_set(shell_index)%v(1) = v(1) + map_info%p_scale(1, ii)%point*masss*(vc(1) - vs(1))
1427 core_particle_set(shell_index)%v(2) = v(2) + map_info%p_scale(2, ii)%point*masss*(vc(2) - vs(2))
1428 core_particle_set(shell_index)%v(3) = v(3) + map_info%p_scale(3, ii)%point*masss*(vc(3) - vs(3))
1450 REAL(kind=
dp),
INTENT(OUT) :: nhc_pot, nhc_kin
1452 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: array_kin, array_pot
1454 INTEGER :: imap, l, n, number
1455 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: akin, vpot
1457 number = nhc%glob_num_nhc
1458 ALLOCATE (akin(number))
1459 ALLOCATE (vpot(number))
1462 DO n = 1, nhc%loc_num_nhc
1463 imap = nhc%map_info%index(n)
1464 DO l = 1, nhc%nhc_len
1465 akin(imap) = akin(imap) + 0.5_dp*nhc%nvt(l, n)%mass*nhc%nvt(l, n)%v**2
1466 vpot(imap) = vpot(imap) + nhc%nvt(l, n)%nkt*nhc%nvt(l, n)%eta
1472 CALL para_env%sum(akin)
1473 CALL para_env%sum(vpot)
1475 CALL communication_thermo_low1(akin, number, para_env)
1476 CALL communication_thermo_low1(vpot, number, para_env)
1482 IF (
PRESENT(array_pot))
THEN
1483 IF (
ASSOCIATED(array_pot))
THEN
1484 cpassert(
SIZE(array_pot) == number)
1486 ALLOCATE (array_pot(number))
1490 IF (
PRESENT(array_kin))
THEN
1491 IF (
ASSOCIATED(array_kin))
THEN
1492 cpassert(
SIZE(array_kin) == number)
1494 ALLOCATE (array_kin(number))
1517 para_env, array_pot, array_kin)
1520 INTEGER,
INTENT(IN) :: loc_num, glob_num
1521 REAL(
dp),
DIMENSION(:),
INTENT(IN) :: thermo_energy
1522 REAL(kind=
dp),
INTENT(OUT) :: thermostat_kin
1524 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: array_pot, array_kin
1526 INTEGER :: imap, n, number
1527 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: akin
1530 ALLOCATE (akin(number))
1533 imap = map_info%index(n)
1534 akin(imap) = thermo_energy(n)
1539 CALL para_env%sum(akin)
1541 CALL communication_thermo_low1(akin, number, para_env)
1543 thermostat_kin = sum(akin)
1546 IF (
PRESENT(array_pot))
THEN
1547 IF (
ASSOCIATED(array_pot))
THEN
1548 cpassert(
SIZE(array_pot) == number)
1550 ALLOCATE (array_pot(number))
1554 IF (
PRESENT(array_kin))
THEN
1555 IF (
ASSOCIATED(array_kin))
THEN
1556 cpassert(
SIZE(array_kin) == number)
1558 ALLOCATE (array_kin(number))
1579 SUBROUTINE get_temperatures(map_info, loc_num, glob_num, nkt, dof, para_env, &
1580 temp_tot, array_temp)
1582 INTEGER,
INTENT(IN) :: loc_num, glob_num
1583 REAL(
dp),
DIMENSION(:),
INTENT(IN) :: nkt, dof
1585 REAL(kind=
dp),
INTENT(OUT) :: temp_tot
1586 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: array_temp
1588 INTEGER :: i, imap, imap2, n, number
1589 REAL(kind=
dp) :: fdeg_of_free
1590 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: akin, deg_of_free
1593 ALLOCATE (akin(number))
1594 ALLOCATE (deg_of_free(number))
1596 deg_of_free = 0.0_dp
1598 imap = map_info%index(n)
1599 imap2 = map_info%map_index(n)
1600 IF (nkt(n) == 0.0_dp) cycle
1601 deg_of_free(imap) = real(dof(n), kind=
dp)
1602 akin(imap) = map_info%s_kin(imap2)
1607 CALL para_env%sum(akin)
1608 CALL para_env%sum(deg_of_free)
1610 CALL communication_thermo_low1(akin, number, para_env)
1611 CALL communication_thermo_low1(deg_of_free, number, para_env)
1613 temp_tot = sum(akin)
1614 fdeg_of_free = sum(deg_of_free)
1616 temp_tot = temp_tot/fdeg_of_free
1619 IF (
PRESENT(array_temp))
THEN
1620 IF (
ASSOCIATED(array_temp))
THEN
1621 cpassert(
SIZE(array_temp) == number)
1623 ALLOCATE (array_temp(number))
1626 array_temp(i) = akin(i)/deg_of_free(i)
1631 DEALLOCATE (deg_of_free)
1632 END SUBROUTINE get_temperatures
1645 array_pot, array_kin)
1647 REAL(kind=
dp),
INTENT(OUT) :: thermostat_pot, thermostat_kin
1649 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: array_pot, array_kin
1652 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: thermo_energy
1654 thermostat_pot = 0.0_dp
1655 thermostat_kin = 0.0_dp
1656 IF (
ASSOCIATED(thermostat))
THEN
1659 cpassert(
ASSOCIATED(thermostat%nhc))
1660 CALL get_nhc_energies(thermostat%nhc, thermostat_pot, thermostat_kin, para_env, &
1661 array_pot, array_kin)
1664 cpassert(
ASSOCIATED(thermostat%csvr))
1665 ALLOCATE (thermo_energy(thermostat%csvr%loc_num_csvr))
1666 DO i = 1, thermostat%csvr%loc_num_csvr
1667 thermo_energy(i) = thermostat%csvr%nvt(i)%thermostat_energy
1669 CALL get_kin_energies(thermostat%csvr%map_info, thermostat%csvr%loc_num_csvr, &
1670 thermostat%csvr%glob_num_csvr, thermo_energy, &
1671 thermostat_kin, para_env, array_pot, array_kin)
1672 DEALLOCATE (thermo_energy)
1674 ELSE IF (thermostat%type_of_thermostat ==
do_thermo_gle)
THEN
1676 cpassert(
ASSOCIATED(thermostat%gle))
1677 ALLOCATE (thermo_energy(thermostat%gle%loc_num_gle))
1678 DO i = 1, thermostat%gle%loc_num_gle
1679 thermo_energy(i) = thermostat%gle%nvt(i)%thermostat_energy
1681 CALL get_kin_energies(thermostat%gle%map_info, thermostat%gle%loc_num_gle, &
1682 thermostat%gle%glob_num_gle, thermo_energy, &
1683 thermostat_kin, para_env, array_pot, array_kin)
1684 DEALLOCATE (thermo_energy)
1701 SUBROUTINE get_region_temperatures(thermostat, tot_temperature, para_env, array_temp)
1703 REAL(kind=
dp),
INTENT(OUT) :: tot_temperature
1705 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: array_temp
1708 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: dof, nkt
1710 IF (
ASSOCIATED(thermostat))
THEN
1713 cpassert(
ASSOCIATED(thermostat%nhc))
1714 ALLOCATE (nkt(thermostat%nhc%loc_num_nhc))
1715 ALLOCATE (dof(thermostat%nhc%loc_num_nhc))
1716 DO i = 1, thermostat%nhc%loc_num_nhc
1717 nkt(i) = thermostat%nhc%nvt(1, i)%nkt
1718 dof(i) = real(thermostat%nhc%nvt(1, i)%degrees_of_freedom, kind=
dp)
1720 CALL get_temperatures(thermostat%nhc%map_info, thermostat%nhc%loc_num_nhc, &
1721 thermostat%nhc%glob_num_nhc, nkt, dof, para_env, tot_temperature, array_temp)
1726 cpassert(
ASSOCIATED(thermostat%csvr))
1728 ALLOCATE (nkt(thermostat%csvr%loc_num_csvr))
1729 ALLOCATE (dof(thermostat%csvr%loc_num_csvr))
1730 DO i = 1, thermostat%csvr%loc_num_csvr
1731 nkt(i) = thermostat%csvr%nvt(i)%nkt
1732 dof(i) = real(thermostat%csvr%nvt(i)%degrees_of_freedom, kind=
dp)
1734 CALL get_temperatures(thermostat%csvr%map_info, thermostat%csvr%loc_num_csvr, &
1735 thermostat%csvr%glob_num_csvr, nkt, dof, para_env, tot_temperature, array_temp)
1738 ELSE IF (thermostat%type_of_thermostat ==
do_thermo_al)
THEN
1740 cpassert(
ASSOCIATED(thermostat%al))
1742 ALLOCATE (nkt(thermostat%al%loc_num_al))
1743 ALLOCATE (dof(thermostat%al%loc_num_al))
1744 DO i = 1, thermostat%al%loc_num_al
1745 nkt(i) = thermostat%al%nvt(i)%nkt
1746 dof(i) = real(thermostat%al%nvt(i)%degrees_of_freedom, kind=
dp)
1748 CALL get_temperatures(thermostat%al%map_info, thermostat%al%loc_num_al, &
1749 thermostat%al%glob_num_al, nkt, dof, para_env, tot_temperature, array_temp)
1752 ELSE IF (thermostat%type_of_thermostat ==
do_thermo_gle)
THEN
1754 cpassert(
ASSOCIATED(thermostat%gle))
1756 ALLOCATE (nkt(thermostat%gle%loc_num_gle))
1757 ALLOCATE (dof(thermostat%gle%loc_num_gle))
1758 DO i = 1, thermostat%gle%loc_num_gle
1759 nkt(i) = thermostat%gle%nvt(i)%nkt
1760 dof(i) = real(thermostat%gle%nvt(i)%degrees_of_freedom, kind=
dp)
1762 CALL get_temperatures(thermostat%gle%map_info, thermostat%gle%loc_num_gle, &
1763 thermostat%gle%glob_num_gle, nkt, dof, para_env, tot_temperature, array_temp)
1769 END SUBROUTINE get_region_temperatures
1784 CHARACTER(LEN=default_string_length) :: my_pos, my_act
1785 INTEGER,
INTENT(IN) :: itimes
1786 REAL(kind=
dp),
INTENT(IN) :: time
1788 IF (
ASSOCIATED(thermostats))
THEN
1789 IF (
ASSOCIATED(thermostats%thermostat_part))
THEN
1790 CALL print_thermostat_status(thermostats%thermostat_part, para_env, my_pos, my_act, itimes, time)
1792 IF (
ASSOCIATED(thermostats%thermostat_shell))
THEN
1793 CALL print_thermostat_status(thermostats%thermostat_shell, para_env, my_pos, my_act, itimes, time)
1795 IF (
ASSOCIATED(thermostats%thermostat_coef))
THEN
1796 CALL print_thermostat_status(thermostats%thermostat_coef, para_env, my_pos, my_act, itimes, time)
1798 IF (
ASSOCIATED(thermostats%thermostat_baro))
THEN
1799 CALL print_thermostat_status(thermostats%thermostat_baro, para_env, my_pos, my_act, itimes, time)
1814 SUBROUTINE print_thermostat_status(thermostat, para_env, my_pos, my_act, itimes, time)
1817 CHARACTER(LEN=default_string_length) :: my_pos, my_act
1818 INTEGER,
INTENT(IN) :: itimes
1819 REAL(kind=
dp),
INTENT(IN) :: time
1823 REAL(kind=
dp) :: thermo_kin, thermo_pot, tot_temperature
1824 REAL(kind=
dp),
DIMENSION(:),
POINTER :: array_kin, array_pot, array_temp
1828 NULLIFY (logger, print_key, array_pot, array_kin, array_temp)
1831 IF (
ASSOCIATED(thermostat))
THEN
1837 extension=
"."//trim(thermostat%label)//
".tener", file_position=my_pos, &
1838 file_action=my_act, is_new_file=new_file)
1841 WRITE (unit,
'(A)')
"# Thermostat Potential and Kinetic Energies - Total and per Region"
1842 WRITE (unit,
'("#",3X,A,2X,A,13X,A,10X,A)')
"Step Nr.",
"Time[fs]",
"Kin.[a.u.]",
"Pot.[a.u.]"
1844 WRITE (unit=unit, fmt=
"(I8, F12.3,6X,2F20.10)") itimes, time*
femtoseconds, thermo_kin, thermo_pot
1845 WRITE (unit,
'(A,4F20.10)')
"# KINETIC ENERGY REGIONS: ", array_kin(1:min(4,
SIZE(array_kin)))
1846 DO i = 5,
SIZE(array_kin), 4
1847 WRITE (unit=unit, fmt=
'("#",25X,4F20.10)') array_kin(i:min(i + 3,
SIZE(array_kin)))
1849 WRITE (unit,
'(A,4F20.10)')
"# POTENT. ENERGY REGIONS: ", array_pot(1:min(4,
SIZE(array_pot)))
1850 DO i = 5,
SIZE(array_pot), 4
1851 WRITE (unit=unit, fmt=
'("#",25X,4F20.10)') array_pot(i:min(i + 3,
SIZE(array_pot)))
1855 DEALLOCATE (array_kin)
1856 DEALLOCATE (array_pot)
1862 CALL get_region_temperatures(thermostat, tot_temperature, para_env, array_temp)
1864 extension=
"."//trim(thermostat%label)//
".temp", file_position=my_pos, &
1865 file_action=my_act, is_new_file=new_file)
1868 WRITE (unit,
'(A)')
"# Temperature Total and per Region"
1869 WRITE (unit,
'("#",3X,A,2X,A,10X,A)')
"Step Nr.",
"Time[fs]",
"Temp.[K]"
1871 WRITE (unit=unit, fmt=
"(I8, F12.3,3X,F20.10)") itimes, time*
femtoseconds, tot_temperature
1872 WRITE (unit,
'(A,I10)')
"# TEMPERATURE REGIONS: ",
SIZE(array_temp)
1873 DO i = 1,
SIZE(array_temp), 4
1874 WRITE (unit=unit, fmt=
'("#",22X,4F20.10)') array_temp(i:min(i + 3,
SIZE(array_temp)))
1878 DEALLOCATE (array_temp)
1882 END SUBROUTINE print_thermostat_status
1891 SUBROUTINE communication_thermo_low1(array, number, para_env)
1892 REAL(kind=
dp),
DIMENSION(:),
INTENT(INOUT) :: array
1893 INTEGER,
INTENT(IN) :: number
1896 INTEGER :: i, icheck, ncheck
1897 REAL(kind=
dp),
DIMENSION(:),
POINTER :: work, work2
1899 ALLOCATE (work(para_env%num_pe))
1902 work(para_env%mepos + 1) = array(i)
1903 CALL para_env%sum(work)
1904 ncheck = count(work /= 0.0_dp)
1906 IF (ncheck /= 0)
THEN
1907 ALLOCATE (work2(ncheck))
1909 DO icheck = 1, para_env%num_pe
1910 IF (work(icheck) /= 0.0_dp)
THEN
1912 work2(ncheck) = work(icheck)
1915 cpassert(ncheck ==
SIZE(work2))
1916 cpassert(all(work2 == work2(1)))
1923 END SUBROUTINE communication_thermo_low1
1934 INTEGER,
DIMENSION(:, :),
INTENT(INOUT) :: array
1935 INTEGER,
INTENT(IN) :: number1, number2
1938 INTEGER :: i, icheck, j, ncheck
1939 INTEGER,
DIMENSION(:, :),
POINTER :: work, work2
1941 ALLOCATE (work(number1, para_env%num_pe))
1944 work(:, para_env%mepos + 1) = array(:, i)
1945 CALL para_env%sum(work)
1947 DO j = 1, para_env%num_pe
1948 IF (any(work(:, j) /= 0))
THEN
1953 IF (ncheck /= 0)
THEN
1954 ALLOCATE (work2(number1, ncheck))
1956 DO icheck = 1, para_env%num_pe
1957 IF (any(work(:, icheck) /= 0))
THEN
1959 work2(:, ncheck) = work(:, icheck)
1962 cpassert(ncheck ==
SIZE(work2, 2))
1964 cpassert(all(work2(:, j) == work2(:, 1)))
1966 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.