145#include "../base/base_uses.f90"
150 LOGICAL,
PARAMETER,
PRIVATE :: debug_this_module = .true.
151 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'pint_methods'
173 SUBROUTINE pint_create(pint_env, input, input_declaration, para_env)
175 TYPE(pint_env_type),
INTENT(OUT) :: pint_env
176 TYPE(section_vals_type),
POINTER :: input
177 TYPE(section_type),
POINTER :: input_declaration
178 TYPE(mp_para_env_type),
POINTER :: para_env
180 CHARACTER(len=*),
PARAMETER :: routineN =
'pint_create'
182 CHARACTER(len=2*default_string_length) :: msg
183 CHARACTER(len=default_path_length) :: output_file_name, project_name
184 INTEGER :: handle, iat, ibead, icont, idim, idir, &
185 ierr, ig, itmp, nrep, prep
186 LOGICAL :: explicit, ltmp
187 REAL(kind=
dp) :: dt, mass, omega
188 TYPE(cp_subsys_type),
POINTER :: subsys
189 TYPE(f_env_type),
POINTER :: f_env
190 TYPE(global_constraint_type),
POINTER :: gci
191 TYPE(particle_list_type),
POINTER :: particles
192 TYPE(replica_env_type),
POINTER :: rep_env
193 TYPE(section_vals_type),
POINTER :: constraint_section, gle_section, nose_section, &
194 piglet_section, pile_section, pint_section, qtb_section, transform_section
196 CALL timeset(routinen, handle)
198 NULLIFY (f_env, subsys, particles, nose_section, gle_section, gci)
200 cpassert(
ASSOCIATED(input))
201 cpassert(input%ref_count > 0)
209 IF ((prep < 1) .OR. (prep > para_env%num_pe) .OR. &
210 (mod(prep*nrep, para_env%num_pe) /= 0))
THEN
211 prep = para_env%num_pe/
gcd(para_env%num_pe, nrep)
212 IF (para_env%is_source())
THEN
213 WRITE (unit=msg, fmt=*)
"PINT WARNING: Adjusting number of processors per replica to ", prep
228 input_declaration=input_declaration, nrep=nrep, prep=prep, row_force=.true.)
230 IF (len_trim(output_file_name) > 0)
THEN
235 IF (.NOT.
ASSOCIATED(rep_env))
RETURN
237 NULLIFY (pint_env%logger)
241 NULLIFY (pint_env%replicas, pint_env%input, pint_env%staging_env, &
242 pint_env%normalmode_env, pint_env%propagator)
244 pint_env%replicas => rep_env
245 pint_env%ndim = rep_env%ndim
246 pint_env%input => input
253 pint_env%first_step = itmp
259 pint_env%last_step = itmp
260 pint_env%num_steps = pint_env%last_step - pint_env%first_step
264 pint_env%num_steps = itmp
265 pint_env%last_step = pint_env%first_step + pint_env%num_steps
270 pint_env%t = pint_env%first_step*pint_env%dt
275 r_val=pint_env%t_tol)
279 ALLOCATE (pint_env%propagator)
281 i_val=pint_env%propagator%prop_kind)
285 pint_env%propagator%temp_phys2sim = real(pint_env%p,
dp)
286 pint_env%propagator%physpotscale = 1.0_dp
288 pint_env%propagator%temp_phys2sim = 1.0_dp
289 pint_env%propagator%physpotscale = 1.0_dp/real(pint_env%p,
dp)
291 pint_env%propagator%temp_sim2phys = 1.0_dp/pint_env%propagator%temp_phys2sim
292 pint_env%kT = pint_env%kT*pint_env%propagator%temp_phys2sim
295 i_val=pint_env%transform)
299 cpabort(
"CMD propagator without normal modes not implemented!")
304 cpabort(
"BCMD propagator without normal modes not implemented!")
307 NULLIFY (pint_env%tx, pint_env%tv, pint_env%tv_t, pint_env%tv_old, pint_env%tv_new, pint_env%tf)
315 cpabort(
"RPMD propagator with Nose-thermostat not implemented!")
318 cpabort(
"BCMD propagator with Nose-thermostat not implemented!")
321 IF (pint_env%nnos > 0)
THEN
324 pint_env%tx(pint_env%nnos, pint_env%p, pint_env%ndim), &
325 pint_env%tv(pint_env%nnos, pint_env%p, pint_env%ndim), &
326 pint_env%tv_t(pint_env%nnos, pint_env%p, pint_env%ndim), &
327 pint_env%tv_old(pint_env%nnos, pint_env%p, pint_env%ndim), &
328 pint_env%tv_new(pint_env%nnos, pint_env%p, pint_env%ndim), &
329 pint_env%tf(pint_env%nnos, pint_env%p, pint_env%ndim))
332 pint_env%tv_t = 0._dp
333 pint_env%tv_old = 0._dp
334 pint_env%tv_new = 0._dp
339 pint_env%beta = 1._dp/(pint_env%kT*pint_env%propagator%temp_sim2phys)
345 pint_env%v_tol = 0.0_dp
348 name=
"pint_randomG", &
350 extended_precision=.true.)
352 ALLOCATE (pint_env%e_pot_bead(pint_env%p))
353 pint_env%e_pot_bead = 0._dp
354 pint_env%e_pot_h = 0._dp
355 pint_env%e_kin_beads = 0._dp
356 pint_env%e_pot_t = 0._dp
357 pint_env%e_gle = 0._dp
358 pint_env%e_pile = 0._dp
359 pint_env%e_piglet = 0._dp
360 pint_env%e_qtb = 0._dp
361 pint_env%e_kin_t = 0._dp
362 pint_env%energy(:) = 0.0_dp
367 pint_env%x(pint_env%p, pint_env%ndim), &
368 pint_env%v(pint_env%p, pint_env%ndim), &
369 pint_env%f(pint_env%p, pint_env%ndim), &
370 pint_env%external_f(pint_env%p, pint_env%ndim), &
371 pint_env%ux(pint_env%p, pint_env%ndim), &
372 pint_env%ux_t(pint_env%p, pint_env%ndim), &
373 pint_env%uv(pint_env%p, pint_env%ndim), &
374 pint_env%uv_t(pint_env%p, pint_env%ndim), &
375 pint_env%uv_new(pint_env%p, pint_env%ndim), &
376 pint_env%uf(pint_env%p, pint_env%ndim), &
377 pint_env%uf_h(pint_env%p, pint_env%ndim), &
378 pint_env%centroid(pint_env%ndim), &
379 pint_env%rtmp_ndim(pint_env%ndim), &
380 pint_env%rtmp_natom(pint_env%ndim/3))
384 pint_env%external_f = 0._dp
386 pint_env%ux_t = 0._dp
388 pint_env%uv_t = 0._dp
389 pint_env%uv_new = 0._dp
391 pint_env%uf_h = 0._dp
392 pint_env%centroid(:) = 0.0_dp
393 pint_env%rtmp_ndim = 0._dp
394 pint_env%rtmp_natom = 0._dp
395 pint_env%time_per_step = 0.0_dp
399 "MOTION%PINT%STAGING")
400 ALLOCATE (pint_env%staging_env)
402 p=pint_env%p, kt=pint_env%kT)
405 "MOTION%PINT%NORMALMODE")
410 r_val=sqrt(2.0_dp/(pint_env%p*pint_env%dt*pint_env%kT)))
413 r_val=0.5_dp*pint_env%p*pint_env%dt*pint_env%kT)
416 ALLOCATE (pint_env%normalmode_env)
418 transform_section, p=pint_env%p, kt=pint_env%kT, propagator=pint_env%propagator%prop_kind)
419 IF (para_env%is_source())
THEN
421 IF (10.0_dp*pint_env%dt/real(pint_env%nrespa,
dp) > &
422 twopi/(pint_env%p*sqrt(maxval(pint_env%normalmode_env%lambda))* &
423 pint_env%normalmode_env%modefactor))
THEN
424 msg =
"PINT WARNING| Number of RESPA steps to small "// &
425 "to integrate the harmonic springs."
431 ALLOCATE (pint_env%mass(pint_env%ndim))
439 DO iat = 1, pint_env%ndim/3
443 pint_env%mass(idim) = mass
449 ALLOCATE (pint_env%Q(pint_env%p), &
450 pint_env%mass_beads(pint_env%p, pint_env%ndim), &
451 pint_env%mass_fict(pint_env%p, pint_env%ndim))
454 mass_beads=pint_env%mass_beads, mass_fict=pint_env%mass_fict, &
458 mass=pint_env%mass, mass_beads=pint_env%mass_beads, &
459 mass_fict=pint_env%mass_fict, q=pint_env%Q)
462 NULLIFY (pint_env%gle)
466 ALLOCATE (pint_env%gle)
467 CALL gle_init(pint_env%gle, dt=pint_env%dt/pint_env%nrespa, temp=pint_env%kT, &
469 IF (pint_env%pimd_thermostat ==
thermostat_none .AND. pint_env%gle%ndim > 0)
THEN
474 pint_env%gle%loc_num_gle = pint_env%p*pint_env%ndim
475 pint_env%gle%glob_num_gle = pint_env%gle%loc_num_gle
476 ALLOCATE (pint_env%gle%map_info%index(pint_env%gle%loc_num_gle))
477 DO itmp = 1, pint_env%gle%loc_num_gle
478 pint_env%gle%map_info%index(itmp) = itmp
485 CALL gle_matrix_exp((-pint_env%dt/pint_env%nrespa*0.5_dp)*pint_env%gle%a_mat, &
486 pint_env%gle%ndim, 15, 15, pint_env%gle%gle_t)
489 matmul(pint_env%gle%c_mat, transpose(pint_env%gle%gle_t))), &
490 pint_env%gle%gle_s, pint_env%gle%ndim)
497 NULLIFY (pint_env%pile_therm)
503 "MOTION%PINT%INIT%THERMOSTAT_SEED", &
504 i_val=pint_env%thermostat_rng_seed)
507 ALLOCATE (pint_env%pile_therm)
510 normalmode_env=pint_env%normalmode_env, &
511 section=pile_section)
513 cpabort(
"PILE thermostat can't be used with another thermostat.")
518 NULLIFY (pint_env%piglet_therm)
524 "MOTION%PINT%INIT%THERMOSTAT_SEED", &
525 i_val=pint_env%thermostat_rng_seed)
528 ALLOCATE (pint_env%piglet_therm)
535 dt=pint_env%dt, para_env=para_env)
537 cpabort(
"PIGLET thermostat can't be used with another thermostat.")
542 NULLIFY (pint_env%qtb_therm)
548 "MOTION%PINT%INIT%THERMOSTAT_SEED", &
549 i_val=pint_env%thermostat_rng_seed)
554 normalmode_env=pint_env%normalmode_env, &
557 cpabort(
"QTB thermostat can't be used with another thermostat.")
567 IF (.NOT. explicit)
THEN
571 "MOTION%PINT%INIT%THERMOSTAT_SEED", &
572 i_val=pint_env%thermostat_rng_seed)
574 ALLOCATE (pint_env%pile_therm)
577 normalmode_env=pint_env%normalmode_env, &
578 section=pile_section)
581 cpabort(
"PILE/no thermostat currently needed for BCMD")
590 WRITE (unit=msg, fmt=*)
"PINT WARNING| Nose Thermostat only available in "// &
591 "the numeric harmonic integrator. Switching to numeric harmonic integrator."
596 WRITE (unit=msg, fmt=*)
"PINT WARNING| GLE Thermostat only available in "// &
597 "the numeric harmonic integrator. Switching to numeric harmonic integrator."
603 WRITE (unit=msg, fmt=*)
"PINT WARNING| PILE Thermostat only available in "// &
604 "the exact harmonic integrator. Switching to exact harmonic integrator."
609 WRITE (unit=msg, fmt=*)
"PINT WARNING| PIGLET Thermostat only available in "// &
610 "the exact harmonic integrator. Switching to exact harmonic integrator."
615 WRITE (unit=msg, fmt=*)
"PINT WARNING| QTB Thermostat only available in "// &
616 "the exact harmonic integrator. Switching to exact harmonic integrator."
621 WRITE (unit=msg, fmt=*)
"PINT WARNING| BCMD needs the exact harmonic "// &
622 "integrator. Switching to exact harmonic integrator."
629 IF (pint_env%nrespa /= 1)
THEN
631 WRITE (unit=msg, fmt=*)
"PINT WARNING| Adjusting NRESPA to 1 for exact harmonic integration."
634 NULLIFY (pint_env%wsinex)
635 ALLOCATE (pint_env%wsinex(pint_env%p))
636 NULLIFY (pint_env%iwsinex)
637 ALLOCATE (pint_env%iwsinex(pint_env%p))
638 NULLIFY (pint_env%cosex)
639 ALLOCATE (pint_env%cosex(pint_env%p))
640 dt = pint_env%dt/real(pint_env%nrespa, kind=
dp)
642 pint_env%wsinex(1) = 0.0_dp
643 pint_env%iwsinex(1) = dt
644 pint_env%cosex(1) = 1.0_dp
645 DO ibead = 2, pint_env%p
646 omega = sqrt(pint_env%normalmode_env%lambda(ibead))
647 pint_env%wsinex(ibead) = sin(omega*dt)*omega
648 pint_env%iwsinex(ibead) = sin(omega*dt)/omega
649 pint_env%cosex(ibead) = cos(omega*dt)
656 pint_env%first_propagated_mode = 2
658 pint_env%first_propagated_mode = 1
662 NULLIFY (pint_env%simpar)
667 pint_env%simpar%constraint = explicit
668 pint_env%kTcorr = 1.0_dp
671 pint_env%beadwise_constraints = .false.
673 l_val=pint_env%beadwise_constraints)
674 IF (pint_env%simpar%constraint)
THEN
675 IF (pint_env%beadwise_constraints)
THEN
686 cpabort(
"Constraints are not supported for staging transformation")
691 WRITE (unit=msg, fmt=*)
"GLE Thermostat not supported for "// &
692 "constraints. Switch to NOSE for numeric integration."
698 IF (pint_env%beadwise_constraints)
THEN
699 cpabort(
"Beadwise constraints are not supported for NOSE Thermostat.")
702 WRITE (unit=msg, fmt=*)
"PINT WARNING| Nose Thermostat set to "// &
703 "zero for constrained atoms. Careful interpretation of temperature."
705 WRITE (unit=msg, fmt=*)
"PINT WARNING| Lagrange multipliers are "// &
706 "are printed every RESPA step and need to be treated carefully."
712 r_val=pint_env%simpar%shake_tol)
714 constraint_section, &
716 extension=
".shakeLog", &
717 log_filename=.false.)
719 constraint_section, &
720 "LAGRANGE_MULTIPLIERS", &
721 extension=
".LagrangeMultLog", &
722 log_filename=.false.)
723 pint_env%simpar%dump_lm = &
725 constraint_section, &
729 pint_env%n_atoms_constraints = 0
730 DO ig = 1, gci%ncolv%ntot
732 pint_env%n_atoms_constraints = pint_env%n_atoms_constraints +
SIZE(gci%colv_list(ig)%i_atoms)
735 ALLOCATE (pint_env%atoms_constraints(pint_env%n_atoms_constraints))
737 DO ig = 1, gci%ncolv%ntot
738 DO iat = 1,
SIZE(gci%colv_list(ig)%i_atoms)
740 pint_env%atoms_constraints(icont) = gci%colv_list(ig)%i_atoms(iat)
748 pint_env%kTcorr = 1.0_dp + real(3*pint_env%n_atoms_constraints,
dp)/(real(pint_env%ndim,
dp)*real(pint_env%p,
dp))
752 CALL timestop(handle)
754 END SUBROUTINE pint_create
763 SUBROUTINE pint_release(pint_env)
764 TYPE(pint_env_type),
INTENT(INOUT) :: pint_env
768 IF (
ASSOCIATED(pint_env%staging_env))
THEN
770 DEALLOCATE (pint_env%staging_env)
772 IF (
ASSOCIATED(pint_env%normalmode_env))
THEN
774 DEALLOCATE (pint_env%normalmode_env)
777 DEALLOCATE (pint_env%mass)
778 DEALLOCATE (pint_env%e_pot_bead)
780 DEALLOCATE (pint_env%x)
781 DEALLOCATE (pint_env%v)
782 DEALLOCATE (pint_env%f)
783 DEALLOCATE (pint_env%external_f)
784 DEALLOCATE (pint_env%mass_beads)
785 DEALLOCATE (pint_env%mass_fict)
786 DEALLOCATE (pint_env%ux)
787 DEALLOCATE (pint_env%ux_t)
788 DEALLOCATE (pint_env%uv)
789 DEALLOCATE (pint_env%uv_t)
790 DEALLOCATE (pint_env%uv_new)
791 DEALLOCATE (pint_env%uf)
792 DEALLOCATE (pint_env%uf_h)
793 DEALLOCATE (pint_env%centroid)
794 DEALLOCATE (pint_env%rtmp_ndim)
795 DEALLOCATE (pint_env%rtmp_natom)
796 DEALLOCATE (pint_env%propagator)
798 IF (pint_env%simpar%constraint)
THEN
799 DEALLOCATE (pint_env%atoms_constraints)
804 DEALLOCATE (pint_env%wsinex)
805 DEALLOCATE (pint_env%iwsinex)
806 DEALLOCATE (pint_env%cosex)
809 SELECT CASE (pint_env%pimd_thermostat)
811 DEALLOCATE (pint_env%tx)
812 DEALLOCATE (pint_env%tv)
813 DEALLOCATE (pint_env%tv_t)
814 DEALLOCATE (pint_env%tv_old)
815 DEALLOCATE (pint_env%tv_new)
816 DEALLOCATE (pint_env%tf)
821 DEALLOCATE (pint_env%pile_therm)
824 DEALLOCATE (pint_env%piglet_therm)
827 DEALLOCATE (pint_env%qtb_therm)
830 DEALLOCATE (pint_env%Q)
832 END SUBROUTINE pint_release
841 SUBROUTINE pint_test(para_env, input, input_declaration)
842 TYPE(mp_para_env_type),
POINTER :: para_env
843 TYPE(section_vals_type),
POINTER :: input
844 TYPE(section_type),
POINTER :: input_declaration
846 INTEGER :: i, ib, idim, unit_nr
847 REAL(kind=
dp) :: c, e_h, err
848 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: x1
849 TYPE(pint_env_type) :: pint_env
851 cpassert(
ASSOCIATED(para_env))
852 cpassert(
ASSOCIATED(input))
853 cpassert(para_env%is_valid())
854 cpassert(input%ref_count > 0)
856 CALL pint_create(pint_env, input, input_declaration, para_env)
857 ALLOCATE (x1(pint_env%ndim, pint_env%p))
858 x1(:, :) = pint_env%x
863 DO i = 1, pint_env%ndim
864 err = max(err, abs(x1(1, i) - pint_env%x(1, i)))
866 IF (unit_nr > 0)
WRITE (unit_nr, *)
"diff_r1="//
cp_to_string(err)
868 CALL pint_calc_uf_h(pint_env, e_h=e_h)
869 c = -pint_env%staging_env%w_p**2
871 DO idim = 1, pint_env%ndim
872 DO ib = 1, pint_env%p
873 pint_env%f(ib, idim) = pint_env%f(ib, idim) + &
874 c*(2._dp*pint_env%x(ib, idim) &
875 - pint_env%x(
modulo(ib - 2, pint_env%p) + 1, idim) &
876 - pint_env%x(
modulo(ib, pint_env%p) + 1, idim))
881 DO idim = 1, pint_env%ndim
882 DO ib = 1, pint_env%p
883 err = max(err, abs(pint_env%uf(ib, idim) - pint_env%uf_h(ib, idim)))
886 IF (unit_nr > 0)
WRITE (unit_nr, *)
"diff_f_h="//
cp_to_string(err)
888 END SUBROUTINE pint_test
903 SUBROUTINE do_pint_run(para_env, input, input_declaration, globenv)
909 CHARACTER(len=*),
PARAMETER :: routinen =
'do_pint_run'
910 INTEGER,
PARAMETER :: helium_only_mid = 1, &
911 int_pot_scan_mid = 4, &
912 solute_only_mid = 2, &
913 solute_with_helium_mid = 3
915 CHARACTER(len=default_string_length) :: stmp
916 INTEGER :: handle, mode
917 LOGICAL :: explicit, helium_only, int_pot_scan, &
923 CALL timeset(routinen, handle)
925 cpassert(
ASSOCIATED(para_env))
926 cpassert(
ASSOCIATED(input))
927 cpassert(para_env%is_valid())
928 cpassert(input%ref_count > 0)
931 NULLIFY (helium_section)
933 "MOTION%PINT%HELIUM")
937 l_val=solvent_present)
939 solvent_present = .false.
943 IF (solvent_present)
THEN
947 helium_only = .false.
951 IF (solvent_present)
THEN
955 int_pot_scan = .false.
959 IF (helium_only .AND. int_pot_scan)
THEN
960 stmp =
"Options HELIUM_ONLY and INTERACTION_POT_SCAN are exclusive"
966 IF (solvent_present)
THEN
967 IF (helium_only)
THEN
968 mode = helium_only_mid
970 IF (int_pot_scan)
THEN
971 mode = int_pot_scan_mid
973 mode = solute_with_helium_mid
977 mode = solute_only_mid
983 CASE (helium_only_mid)
989 CASE (solute_only_mid)
990 CALL pint_create(pint_env, input, input_declaration, para_env)
991 CALL pint_init(pint_env)
992 CALL pint_do_run(pint_env, globenv)
993 CALL pint_release(pint_env)
995 CASE (int_pot_scan_mid)
996 CALL pint_create(pint_env, input, input_declaration, para_env)
1000 CALL pint_init(pint_env)
1002 CALL pint_run_scan(pint_env, helium_env)
1004 CALL pint_release(pint_env)
1006 CASE (solute_with_helium_mid)
1007 CALL pint_create(pint_env, input, input_declaration, para_env)
1009 CALL pint_init(pint_env)
1014 CALL pint_init_f(pint_env, helium_env=helium_env)
1016 CALL pint_do_run(pint_env, globenv, helium_env=helium_env)
1018 CALL pint_release(pint_env)
1021 cpabort(
"Unknown mode ("//trim(adjustl(
cp_to_string(mode)))//
")")
1024 CALL timestop(handle)
1037 SUBROUTINE pint_init(pint_env)
1041 CALL pint_init_x(pint_env)
1042 CALL pint_init_v(pint_env)
1043 CALL pint_init_t(pint_env)
1044 CALL pint_init_f(pint_env)
1046 END SUBROUTINE pint_init
1063 SUBROUTINE pint_init_x(pint_env)
1067 CHARACTER(len=5*default_string_length) :: msg, tmp
1068 INTEGER :: ia, ib, ic, idim, input_seed, n_rep_val
1069 LOGICAL :: done_init, done_levy, done_rand, &
1070 explicit, levycorr, ltmp
1071 REAL(kind=
dp) :: tcorr, var
1072 REAL(kind=
dp),
DIMENSION(3) :: x0
1073 REAL(kind=
dp),
DIMENSION(3, 2) :: seed
1074 REAL(kind=
dp),
DIMENSION(:),
POINTER :: bx, r_vals
1078 DO idim = 1, pint_env%ndim
1079 DO ib = 1, pint_env%p
1080 pint_env%x(ib, idim) = pint_env%replicas%r(idim, ib)
1086 "MOTION%PINT%INIT%LEVY_POS_SAMPLE", &
1089 "MOTION%PINT%INIT%LEVY_TEMP_FACTOR", &
1093 IF (pint_env%beadwise_constraints)
THEN
1094 WRITE (unit=msg, fmt=*)
"Beadwise constraints are not supported for "// &
1095 "the initialization of the beads as free particles. "// &
1096 "Please use hot start (default)."
1101 ALLOCATE (bx(3*pint_env%p))
1103 "MOTION%PINT%INIT%LEVY_SEED", i_val=input_seed)
1104 seed(:, :) = real(input_seed, kind=
dp)
1107 name=
"tmp_rng_gaussian", &
1109 extended_precision=.true., &
1113 "MOTION%PINT%INIT%LEVY_CORRELATED", &
1119 x0 = [0.0_dp, 0.0_dp, 0.0_dp]
1122 DO ia = 1, pint_env%ndim/3
1123 var = sqrt(1.0_dp/(pint_env%kT*tcorr*pint_env%mass(3*ia)))
1126 DO ib = 1, pint_env%p
1127 pint_env%x(ib, idim) = pint_env%x(ib, idim) + bx(3*(ib - 1) + ic)*var
1136 DO ia = 1, pint_env%ndim/3
1137 x0(1) = pint_env%x(1, 3*(ia - 1) + 1)
1138 x0(2) = pint_env%x(1, 3*(ia - 1) + 2)
1139 x0(3) = pint_env%x(1, 3*(ia - 1) + 3)
1140 var = sqrt(1.0_dp/(pint_env%kT*tcorr*pint_env%mass(3*ia)))
1144 DO ib = 1, pint_env%p
1145 pint_env%x(ib, idim) = pint_env%x(ib, idim) + bx(3*(ib - 1) + ic)
1157 NULLIFY (input_section)
1159 "MOTION%PINT%BEADS%COORD")
1163 n_rep_val=n_rep_val)
1164 IF (n_rep_val > 0)
THEN
1165 cpassert(n_rep_val == 1)
1168 IF (
SIZE(r_vals) /= pint_env%p*pint_env%ndim)
THEN
1169 cpabort(
"Invalid size of MOTION%PINT%BEADS%COORD")
1172 DO idim = 1, pint_env%ndim
1173 DO ib = 1, pint_env%p
1175 pint_env%x(ib, idim) = r_vals(ic)
1184 "MOTION%PINT%INIT%RANDOMIZE_POS", &
1188 IF (pint_env%beadwise_constraints)
THEN
1189 WRITE (unit=msg, fmt=*)
"Beadwise constraints are not supported if "// &
1190 "a random noise is applied to the initialization of the bead positions. "// &
1191 "Please use hot start (default)."
1195 DO idim = 1, pint_env%ndim
1196 DO ib = 1, pint_env%p
1197 pint_env%x(ib, idim) = pint_env%x(ib, idim) + &
1198 pint_env%randomG%next(variance=pint_env%beta/ &
1199 sqrt(12.0_dp*pint_env%mass(idim)))
1205 WRITE (tmp,
'(A)')
"Bead positions initialization:"
1207 WRITE (msg,
'(A,A)') trim(tmp),
" input structure"
1208 ELSE IF (done_levy)
THEN
1209 WRITE (msg,
'(A,A)') trim(tmp),
" Levy random walk"
1211 WRITE (msg,
'(A,A)') trim(tmp),
" hot start"
1216 WRITE (msg,
'(A,F6.3)')
"Levy walk at effective temperature: ", tcorr
1220 WRITE (msg,
'(A)')
"Added gaussian noise to the positions of the beads."
1224 END SUBROUTINE pint_init_x
1247 SUBROUTINE pint_init_v(pint_env)
1250 CHARACTER(len=default_string_length) :: msg, stmp, stmp1, stmp2, unit_str
1251 INTEGER :: first_mode, i, ia, ib, ic, idim, ierr, &
1252 itmp, j, n_rep_val, nparticle, &
1254 LOGICAL :: done_init, done_quench, done_scale, &
1255 done_sped, explicit, ltmp, vels_present
1256 REAL(kind=
dp) :: actual_t, ek, factor, rtmp, target_t, &
1258 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: vel
1259 REAL(kind=
dp),
DIMENSION(:),
POINTER :: r_vals
1282 IF (pint_env%simpar%constraint)
THEN
1283 NULLIFY (subsys, cell)
1284 NULLIFY (atomic_kinds, local_particles, particles)
1285 NULLIFY (local_molecules, molecules, molecule_kinds, gci)
1286 NULLIFY (atomic_kind_set, molecule_kind_set, particle_set, molecule_set)
1289 CALL force_env_get(force_env=f_env%force_env, subsys=subsys)
1296 atomic_kinds=atomic_kinds, &
1297 local_particles=local_particles, &
1298 particles=particles, &
1299 local_molecules=local_molecules, &
1300 molecules=molecules, &
1301 molecule_kinds=molecule_kinds, &
1304 nparticle_kind = atomic_kinds%n_els
1305 atomic_kind_set => atomic_kinds%els
1306 molecule_kind_set => molecule_kinds%els
1307 nparticle = particles%n_els
1308 particle_set => particles%els
1309 molecule_set => molecules%els
1312 ALLOCATE (vel(3, nparticle))
1314 CALL getold(gci, local_molecules, molecule_set, &
1315 molecule_kind_set, particle_set, cell)
1319 vels_present = .false.
1320 NULLIFY (input_section)
1322 "FORCE_EVAL%SUBSYS%VELOCITY")
1333 n_rep_val=n_rep_val)
1335 WRITE (stmp, *) n_rep_val
1336 msg =
"Invalid number of atoms in FORCE_EVAL%SUBSYS%VELOCITY ("// &
1337 trim(adjustl(stmp))//
")."
1338 IF (3*n_rep_val /= pint_env%ndim)
THEN
1341 DO ia = 1, pint_env%ndim/3
1343 i_rep_val=ia, r_vals=r_vals)
1346 WRITE (stmp, *) itmp
1347 msg =
"Number of coordinates != 3 in FORCE_EVAL%SUBSYS%VELOCITY ("// &
1348 trim(adjustl(stmp))//
")."
1352 DO ib = 1, pint_env%p
1354 idim = 3*(ia - 1) + ic
1355 pint_env%v(ib, idim) = r_vals(ic)*unit_conv
1360 vels_present = .true.
1364 IF (vels_present)
THEN
1367 DO ia = 1, pint_env%ndim/3
1370 idim = 3*(ia - 1) + ic
1371 rtmp = rtmp + pint_env%v(1, idim)*pint_env%v(1, idim)
1373 ek = ek + 0.5_dp*pint_env%mass(idim)*rtmp
1375 actual_t = 2.0_dp*ek/pint_env%ndim
1378 actual_t = pint_env%kT
1382 target_t = pint_env%kT
1384 "MOTION%PINT%INIT%VELOCITY_SCALE", &
1386 IF (vels_present)
THEN
1387 IF (done_scale)
THEN
1389 rtmp = sqrt(target_t/actual_t)
1390 DO ia = 1, pint_env%ndim/3
1391 DO ib = 1, pint_env%p
1393 idim = 3*(ia - 1) + ic
1394 pint_env%v(ib, idim) = rtmp*pint_env%v(ib, idim)
1404 IF (vels_present)
THEN
1406 CALL pint_x2u(pint_env, ux=pint_env%uv, x=pint_env%v)
1412 DO idim = 1,
SIZE(pint_env%uv, 2)
1413 DO ib = first_mode,
SIZE(pint_env%uv, 1)
1414 pint_env%uv(ib, idim) = &
1415 pint_env%randomG%next(variance=target_t/pint_env%mass_fict(ib, idim))
1422 "MOTION%PINT%INIT%CENTROID_SPEED", &
1425 CALL pint_u2x(pint_env, ux=pint_env%uv, x=pint_env%v)
1426 DO idim = 1, pint_env%ndim
1427 rtmp = pint_env%randomG%next(variance=pint_env%mass(idim)*pint_env%kT) &
1428 /pint_env%mass(idim)
1429 DO ib = 1, pint_env%p
1430 pint_env%v(ib, idim) = pint_env%v(ib, idim) + rtmp
1433 CALL pint_x2u(pint_env, ux=pint_env%uv, x=pint_env%v)
1439 done_quench = .false.
1441 "MOTION%PINT%INIT%VELOCITY_QUENCH", &
1444 DO idim = 1, pint_env%ndim
1445 DO ib = 1, pint_env%p
1446 pint_env%v(ib, idim) = 0.0_dp
1449 CALL pint_x2u(pint_env, ux=pint_env%uv, x=pint_env%v)
1450 done_quench = .true.
1456 NULLIFY (input_section)
1458 "MOTION%PINT%BEADS%VELOCITY")
1462 n_rep_val=n_rep_val)
1463 IF (n_rep_val > 0)
THEN
1464 cpassert(n_rep_val == 1)
1467 IF (
SIZE(r_vals) /= pint_env%p*pint_env%ndim)
THEN
1468 cpabort(
"Invalid size of MOTION%PINT%BEAD%VELOCITY")
1471 DO idim = 1, pint_env%ndim
1472 DO ib = 1, pint_env%p
1474 pint_env%v(ib, idim) = r_vals(itmp)
1477 CALL pint_x2u(pint_env, ux=pint_env%uv, x=pint_env%v)
1483 WRITE (stmp1,
'(F10.2)') target_t*pint_env%propagator%temp_sim2phys*unit_conv
1484 msg =
"Bead velocities initialization:"
1486 msg = trim(msg)//
" input structure"
1487 ELSE IF (done_quench)
THEN
1488 msg = trim(msg)//
" quenching (set to 0.0)"
1490 IF (vels_present)
THEN
1491 msg = trim(adjustl(msg))//
" centroid +"
1493 msg = trim(adjustl(msg))//
" Maxwell-Boltzmann at "//trim(adjustl(stmp1))//
" K."
1497 IF (done_init .AND. done_quench)
THEN
1498 msg =
"WARNING: exclusive options requested (velocity restart and quenching)"
1500 msg =
"WARNING: velocity restart took precedence"
1504 IF ((.NOT. done_init) .AND. (.NOT. done_quench))
THEN
1505 IF (vels_present .AND. done_scale)
THEN
1506 WRITE (stmp1,
'(F10.2)') actual_t*unit_conv
1507 WRITE (stmp2,
'(F10.2)') target_t*unit_conv
1508 msg =
"Scaled initial velocities from "//trim(adjustl(stmp1))// &
1509 " to "//trim(adjustl(stmp2))//
" K as requested."
1513 msg =
"Added random component to the initial centroid velocities."
1519 IF (pint_env%simpar%constraint)
THEN
1522 factor = sqrt(real(pint_env%p,
dp))
1528 IF (pint_env%beadwise_constraints)
THEN
1529 IF (pint_env%logger%para_env%is_source())
THEN
1530 CALL pint_u2x(pint_env, ux=pint_env%uv, x=pint_env%v)
1531 DO ib = 1, pint_env%p
1537 particle_set(i)%r(j) = pint_env%x(1, j + (i - 1)*3)/factor
1538 vel(j, i) = pint_env%v(ib, j + (i - 1)*3)
1543 molecule_kind_set, pint_env%dt, &
1544 f_env%force_env%root_section)
1546 molecule_kind_set, particle_set, &
1547 vel, pint_env%dt, pint_env%simpar%shake_tol, &
1548 pint_env%simpar%info_constraint, &
1549 pint_env%simpar%lagrange_multipliers, &
1555 pint_env%v(ib, j + (i - 1)*3) = vel(j, i)
1560 CALL pint_x2u(pint_env, ux=pint_env%uv, x=pint_env%v)
1563 CALL pint_env%logger%para_env%bcast(pint_env%uv)
1567 IF (pint_env%logger%para_env%is_source())
THEN
1570 particle_set(i)%r(j) = pint_env%x(1, j + (i - 1)*3)/factor
1571 vel(j, i) = pint_env%uv(1, j + (i - 1)*3)/factor
1576 molecule_kind_set, pint_env%dt, &
1577 f_env%force_env%root_section)
1579 molecule_kind_set, particle_set, &
1580 vel, pint_env%dt, pint_env%simpar%shake_tol, &
1581 pint_env%simpar%info_constraint, &
1582 pint_env%simpar%lagrange_multipliers, &
1588 CALL pint_env%logger%para_env%bcast(vel)
1592 pint_env%uv(1, j + (i - 1)*3) = vel(j, i)*factor
1598 END SUBROUTINE pint_init_v
1608 SUBROUTINE pint_init_t(pint_env, kT)
1611 REAL(kind=
dp),
INTENT(in),
OPTIONAL :: kt
1613 INTEGER :: ib, idim, ii, inos, n_rep_val
1614 LOGICAL :: explicit, gle_restart
1615 REAL(kind=
dp) :: mykt
1616 REAL(kind=
dp),
DIMENSION(:),
POINTER :: r_vals
1622 IF (
PRESENT(kt)) mykt = kt
1623 DO idim = 1,
SIZE(pint_env%tv, 3)
1624 DO ib = 1,
SIZE(pint_env%tv, 2)
1625 DO inos = 1,
SIZE(pint_env%tv, 1)
1626 pint_env%tv(inos, ib, idim) = &
1627 pint_env%randomG%next(variance=mykt/pint_env%Q(ib))
1632 pint_env%tv(:, 1, :) = 0.0_dp
1635 NULLIFY (input_section)
1637 "MOTION%PINT%NOSE%COORD")
1641 n_rep_val=n_rep_val)
1642 IF (n_rep_val > 0)
THEN
1643 cpassert(n_rep_val == 1)
1646 IF (
SIZE(r_vals) /= pint_env%p*pint_env%ndim*pint_env%nnos)
THEN
1647 cpabort(
"Invalid size of MOTION%PINT%NOSE%COORD")
1650 DO idim = 1, pint_env%ndim
1651 DO ib = 1, pint_env%p
1652 DO inos = 1, pint_env%nnos
1654 pint_env%tx(inos, ib, idim) = r_vals(ii)
1661 pint_env%tx(:, 1, :) = 0.0_dp
1664 NULLIFY (input_section)
1666 "MOTION%PINT%NOSE%VELOCITY")
1670 n_rep_val=n_rep_val)
1671 IF (n_rep_val > 0)
THEN
1672 cpassert(n_rep_val == 1)
1675 IF (
SIZE(r_vals) /= pint_env%p*pint_env%ndim*pint_env%nnos)
THEN
1676 cpabort(
"Invalid size of MOTION%PINT%NOSE%VELOCITY")
1679 DO idim = 1, pint_env%ndim
1680 DO ib = 1, pint_env%p
1681 DO inos = 1, pint_env%nnos
1683 pint_env%tv(inos, ib, idim) = r_vals(ii)
1689 pint_env%tv(:, 1, :) = 0.0_dp
1694 NULLIFY (input_section)
1699 CALL restart_gle(pint_env%gle, input_section, save_mem=.false., &
1700 restart=gle_restart)
1704 END SUBROUTINE pint_init_t
1716 SUBROUTINE pint_init_f(pint_env, helium_env)
1719 OPTIONAL,
POINTER :: helium_env
1721 INTEGER :: ib, idim, inos
1722 REAL(kind=
dp) :: e_h
1729 CALL cp_iterate(logger%iter_info, iter_nr=pint_env%first_step)
1730 CALL cp_iterate(pint_env%logger%iter_info, iter_nr=pint_env%first_step)
1733 CALL pint_calc_uf_h(pint_env=pint_env, e_h=e_h)
1734 CALL pint_calc_f(pint_env)
1739 IF (
PRESENT(helium_env))
THEN
1740 IF (logger%para_env%is_source())
THEN
1741 pint_env%f(:, :) = pint_env%f(:, :) + helium_env(1)%helium%force_avrg(:, :)
1743 CALL logger%para_env%bcast(pint_env%f)
1748 IF (pint_env%first_propagated_mode == 2)
THEN
1749 pint_env%uf(1, :) = 0.0_dp
1752 CALL pint_calc_e_kin_beads_u(pint_env)
1753 CALL pint_calc_e_vir(pint_env)
1754 DO idim = 1,
SIZE(pint_env%uf_h, 2)
1755 DO ib = pint_env%first_propagated_mode,
SIZE(pint_env%uf_h, 1)
1756 pint_env%uf(ib, idim) = real(pint_env%nrespa,
dp)*pint_env%uf(ib, idim)
1760 IF (pint_env%nnos > 0)
THEN
1761 DO idim = 1,
SIZE(pint_env%uf_h, 2)
1762 DO ib = 1,
SIZE(pint_env%uf_h, 1)
1763 pint_env%tf(1, ib, idim) = (pint_env%mass_fict(ib, idim)* &
1764 pint_env%uv(ib, idim)**2 - pint_env%kT)/pint_env%Q(ib)
1768 DO idim = 1, pint_env%ndim
1769 DO ib = 1, pint_env%p
1770 DO inos = 1, pint_env%nnos - 1
1771 pint_env%tf(inos + 1, ib, idim) = pint_env%tv(inos, ib, idim)**2 - &
1772 pint_env%kT/pint_env%Q(ib)
1774 DO inos = 1, pint_env%nnos - 1
1775 pint_env%tf(inos, ib, idim) = pint_env%tf(inos, ib, idim) &
1776 - pint_env%tv(inos, ib, idim)*pint_env%tv(inos + 1, ib, idim)
1780 CALL pint_calc_nh_energy(pint_env)
1783 END SUBROUTINE pint_init_f
1800 SUBROUTINE pint_do_run(pint_env, globenv, helium_env)
1804 OPTIONAL,
POINTER :: helium_env
1807 LOGICAL :: should_stop
1808 REAL(kind=
dp) :: scal
1813 CALL cp_iterate(pint_env%logger%iter_info, iter_nr=pint_env%first_step)
1823 iter_nr=pint_env%first_step)
1826 pint_env%iter = pint_env%first_step
1828 IF (
PRESENT(helium_env))
THEN
1829 IF (
ASSOCIATED(helium_env))
THEN
1831 DO k = 1,
SIZE(helium_env)
1832 helium_env(k)%helium%proarea%accu(:) = 0.0_dp
1833 helium_env(k)%helium%prarea2%accu(:) = 0.0_dp
1834 helium_env(k)%helium%wnmber2%accu(:) = 0.0_dp
1835 helium_env(k)%helium%mominer%accu(:) = 0.0_dp
1836 IF (helium_env(k)%helium%rho_present)
THEN
1837 helium_env(k)%helium%rho_accu(:, :, :, :) = 0.0_dp
1839 IF (helium_env(k)%helium%rdf_present)
THEN
1840 helium_env(k)%helium%rdf_accu(:, :) = 0.0_dp
1847 CALL pint_calc_energy(pint_env)
1848 CALL pint_calc_total_action(pint_env)
1857 DO step = 1, pint_env%num_steps
1859 pint_env%iter = pint_env%iter + 1
1861 last=(step == pint_env%num_steps), &
1862 iter_nr=pint_env%iter)
1864 last=(step == pint_env%num_steps), &
1865 iter_nr=pint_env%iter)
1866 pint_env%t = pint_env%t + pint_env%dt
1868 IF (pint_env%t_tol > 0.0_dp)
THEN
1869 IF (abs(2._dp*pint_env%e_kin_beads/(pint_env%p*pint_env%ndim) &
1870 - pint_env%kT) > pint_env%t_tol)
THEN
1871 scal = sqrt(pint_env%kT*(pint_env%p*pint_env%ndim)/(2.0_dp*pint_env%e_kin_beads))
1872 pint_env%uv = scal*pint_env%uv
1873 CALL pint_init_f(pint_env, helium_env=helium_env)
1876 CALL pint_step(pint_env, helium_env=helium_env)
1886 pint_env=pint_env, helium_env=helium_env)
1890 IF (should_stop)
EXIT
1897 END SUBROUTINE pint_do_run
1908 SUBROUTINE pint_run_scan(pint_env, helium_env)
1912 CHARACTER(len=default_string_length) :: comment
1914 REAL(kind=
dp),
DIMENSION(:, :, :),
POINTER ::
DATA
1917 NULLIFY (pint_env%logger, print_key)
1921 IF (pint_env%logger%para_env%is_source())
THEN
1923 "MOTION%PINT%HELIUM%PRINT%RHO")
1931 IF (pint_env%logger%para_env%is_source())
THEN
1936 middle_name=
"helium-pot", &
1937 extension=
".cube", &
1938 file_position=
"REWIND", &
1941 comment =
"Solute - helium interaction potential"
1943 DATA => helium_env(1)%helium%rho_inst(1, :, :, :)
1947 helium_env(1)%helium%center - 0.5_dp* &
1948 (helium_env(1)%helium%rho_maxr - helium_env(1)%helium%rho_delr), &
1949 helium_env(1)%helium%rho_delr, &
1950 helium_env(1)%helium%rho_nbin, &
1962 END SUBROUTINE pint_run_scan
1976 SUBROUTINE pint_step(pint_env, helium_env)
1979 OPTIONAL,
POINTER :: helium_env
1981 CHARACTER(len=*),
PARAMETER :: routinen =
'pint_step'
1983 INTEGER :: handle, i, ia, ib, idim, ierr, inos, &
1984 iresp, j, k, nbeads, nparticle, &
1986 REAL(kind=
dp) :: dt_temp, dti, dti2, dti22, e_h, factor, &
1987 rn, tdti, time_start, time_stop, tol
1988 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: pos, vel
1989 REAL(kind=
dp),
DIMENSION(:, :, :),
POINTER :: tmp
2004 CALL timeset(routinen, handle)
2007 rn = real(pint_env%nrespa,
dp)
2008 dti = pint_env%dt/rn
2011 dti22 = dti**2/2._dp
2016 IF (pint_env%simpar%constraint)
THEN
2017 NULLIFY (subsys, cell)
2018 NULLIFY (atomic_kinds, local_particles, particles)
2019 NULLIFY (local_molecules, molecules, molecule_kinds, gci)
2020 NULLIFY (atomic_kind_set, molecule_kind_set, particle_set, molecule_set)
2023 CALL force_env_get(force_env=f_env%force_env, subsys=subsys)
2030 atomic_kinds=atomic_kinds, &
2031 local_particles=local_particles, &
2032 particles=particles, &
2033 local_molecules=local_molecules, &
2034 molecules=molecules, &
2035 molecule_kinds=molecule_kinds, &
2038 nparticle_kind = atomic_kinds%n_els
2039 atomic_kind_set => atomic_kinds%els
2040 molecule_kind_set => molecule_kinds%els
2041 nparticle = particles%n_els
2043 particle_set => particles%els
2044 molecule_set => molecules%els
2047 ALLOCATE (pos(3, nparticle))
2048 ALLOCATE (vel(3, nparticle))
2054 factor = sqrt(real(pint_env%p,
dp))
2059 CALL getold(gci, local_molecules, molecule_set, &
2060 molecule_kind_set, particle_set, cell)
2063 SELECT CASE (pint_env%harm_integrator)
2066 DO iresp = 1, pint_env%nrespa
2073 IF (pint_env%simpar%constraint)
THEN
2074 DO k = 1, pint_env%n_atoms_constraints
2075 ia = pint_env%atoms_constraints(k)
2076 DO j = 3*(ia - 1) + 1, 3*ia
2077 pint_env%tv(:, 1, j) = 0.0_dp
2084 pint_env%tx(:, 1, :) = 0.0_dp
2085 pint_env%tv(:, 1, :) = 0.0_dp
2086 pint_env%tf(:, 1, :) = 0.0_dp
2089 DO i = pint_env%first_propagated_mode, pint_env%p
2090 pint_env%ux(i, :) = pint_env%ux(i, :) - &
2091 dti22*pint_env%uv(i, :)*pint_env%tv(1, i, :)
2093 pint_env%tx = pint_env%tx + dti*pint_env%tv + dti22*pint_env%tf
2096 pint_env%tx(:, 1, :) = 0.0_dp
2097 pint_env%tv(:, 1, :) = 0.0_dp
2098 pint_env%tf(:, 1, :) = 0.0_dp
2104 DO i = pint_env%first_propagated_mode, pint_env%p
2105 pint_env%ux_t(i, :) = pint_env%ux(i, :) + &
2106 dti*pint_env%uv(i, :) + &
2107 dti22*(pint_env%uf_h(i, :) + &
2112 SELECT CASE (pint_env%pimd_thermostat)
2116 pint_env%tx(:, 1, :) = 0.0_dp
2117 pint_env%tv(:, 1, :) = 0.0_dp
2118 pint_env%tf(:, 1, :) = 0.0_dp
2121 pint_env%uv_t = pint_env%uv - dti2* &
2122 pint_env%uv*pint_env%tv(1, :, :)
2123 tmp => pint_env%tv_t
2124 pint_env%tv_t => pint_env%tv
2126 pint_env%tv = pint_env%tv_old + tdti*pint_env%tf
2127 pint_env%tv_old = pint_env%tv_t
2128 pint_env%tv_t = pint_env%tv_t + dti2*pint_env%tf
2130 pint_env%uv_t = pint_env%uv
2134 IF (pint_env%simpar%constraint)
THEN
2135 DO k = 1, pint_env%n_atoms_constraints
2136 ia = pint_env%atoms_constraints(k)
2137 DO j = 3*(ia - 1) + 1, 3*ia
2138 pint_env%tv(:, 1, j) = 0.0_dp
2139 pint_env%tv_t(:, 1, j) = 0.0_dp
2146 pint_env%tx(:, 1, :) = 0.0_dp
2147 pint_env%tv(:, 1, :) = 0.0_dp
2148 pint_env%tf(:, 1, :) = 0.0_dp
2152 pint_env%uv_t = pint_env%uv_t + dti2*(pint_env%uf_h + pint_env%uf)
2155 pint_env%uf = 0.0_dp
2157 pint_env%ux = pint_env%ux_t
2160 IF (pint_env%simpar%constraint)
THEN
2161 IF (pint_env%logger%para_env%is_source())
THEN
2164 pos(j, i) = pint_env%ux(1, j + (i - 1)*3)
2165 vel(j, i) = pint_env%uv_t(1, j + (i - 1)*3)
2171 molecule_kind_set, dti, &
2172 f_env%force_env%root_section)
2174 molecule_kind_set, particle_set, &
2175 pos, vel, dti, pint_env%simpar%shake_tol, &
2176 pint_env%simpar%info_constraint, &
2177 pint_env%simpar%lagrange_multipliers, &
2178 pint_env%simpar%dump_lm, cell, &
2182 CALL pint_env%logger%para_env%bcast(pos)
2183 CALL pint_env%logger%para_env%bcast(vel)
2187 pint_env%ux(1, j + (i - 1)*3) = pos(j, i)
2188 pint_env%uv_t(1, j + (i - 1)*3) = vel(j, i)
2195 pint_env%tx(:, 1, :) = 0.0_dp
2196 pint_env%tv(:, 1, :) = 0.0_dp
2197 pint_env%tf(:, 1, :) = 0.0_dp
2200 CALL pint_calc_uf_h(pint_env=pint_env, e_h=e_h)
2201 pint_env%uv_t = pint_env%uv_t + dti2*(pint_env%uf_h + pint_env%uf)
2205 IF (iresp == pint_env%nrespa)
THEN
2207 CALL pint_calc_f(pint_env)
2209 IF (
PRESENT(helium_env))
THEN
2212 IF (pint_env%logger%para_env%is_source())
THEN
2213 pint_env%f(:, :) = pint_env%f(:, :) + helium_env(1)%helium%force_avrg(:, :)
2215 CALL pint_env%logger%para_env%bcast(pint_env%f)
2220 IF (pint_env%first_propagated_mode == 2)
THEN
2221 pint_env%uf(1, :) = 0.0_dp
2225 pint_env%uf = pint_env%uf*rn
2226 pint_env%uv_t = pint_env%uv_t + dti2*pint_env%uf
2231 SELECT CASE (pint_env%pimd_thermostat)
2235 pint_env%tx(:, 1, :) = 0.0_dp
2236 pint_env%tv(:, 1, :) = 0.0_dp
2237 pint_env%tf(:, 1, :) = 0.0_dp
2241 pint_env%uv_new = pint_env%uv_t/(1.+dti2*pint_env%tv(1, :, :))
2242 DO idim = 1, pint_env%ndim
2243 DO ib = 1, pint_env%p
2244 pint_env%tf(1, ib, idim) = (pint_env%mass_fict(ib, idim)* &
2245 pint_env%uv_new(ib, idim)**2 - pint_env%kT*pint_env%kTcorr)/ &
2251 IF (pint_env%simpar%constraint)
THEN
2252 DO k = 1, pint_env%n_atoms_constraints
2253 ia = pint_env%atoms_constraints(k)
2254 DO j = 3*(ia - 1) + 1, 3*ia
2255 pint_env%tf(:, 1, j) = 0.0_dp
2262 pint_env%tx(:, 1, :) = 0.0_dp
2263 pint_env%tv(:, 1, :) = 0.0_dp
2264 pint_env%tf(:, 1, :) = 0.0_dp
2267 DO idim = 1, pint_env%ndim
2268 DO ib = 1, pint_env%p
2269 DO inos = 1, pint_env%nnos - 1
2270 pint_env%tv_new(inos, ib, idim) = &
2271 (pint_env%tv_t(inos, ib, idim) + dti2*pint_env%tf(inos, ib, idim))/ &
2272 (1._dp + dti2*pint_env%tv(inos + 1, ib, idim))
2273 pint_env%tf(inos + 1, ib, idim) = &
2274 (pint_env%tv_new(inos, ib, idim)**2 - &
2275 pint_env%kT*pint_env%kTcorr/pint_env%Q(ib))
2276 tol = max(tol, abs(pint_env%tv(inos, ib, idim) &
2277 - pint_env%tv_new(inos, ib, idim)))
2280 IF (pint_env%simpar%constraint)
THEN
2281 DO k = 1, pint_env%n_atoms_constraints
2282 ia = pint_env%atoms_constraints(k)
2283 DO j = 3*(ia - 1) + 1, 3*ia
2284 pint_env%tv_new(:, 1, j) = 0.0_dp
2285 pint_env%tf(:, 1, j) = 0.0_dp
2292 pint_env%tx(:, 1, :) = 0.0_dp
2293 pint_env%tv(:, 1, :) = 0.0_dp
2294 pint_env%tf(:, 1, :) = 0.0_dp
2297 pint_env%tv_new(pint_env%nnos, ib, idim) = &
2298 pint_env%tv_t(pint_env%nnos, ib, idim) + &
2299 dti2*pint_env%tf(pint_env%nnos, ib, idim)
2300 tol = max(tol, abs(pint_env%tv(pint_env%nnos, ib, idim) &
2301 - pint_env%tv_new(pint_env%nnos, ib, idim)))
2302 tol = max(tol, abs(pint_env%uv(ib, idim) &
2303 - pint_env%uv_new(ib, idim)))
2305 IF (pint_env%simpar%constraint)
THEN
2306 DO k = 1, pint_env%n_atoms_constraints
2307 ia = pint_env%atoms_constraints(k)
2308 DO j = 3*(ia - 1) + 1, 3*ia
2309 pint_env%tv_new(:, 1, j) = 0.0_dp
2315 pint_env%tx(:, 1, :) = 0.0_dp
2316 pint_env%tv(:, 1, :) = 0.0_dp
2317 pint_env%tf(:, 1, :) = 0.0_dp
2323 pint_env%uv = pint_env%uv_new
2324 pint_env%tv = pint_env%tv_new
2325 IF (tol <= pint_env%v_tol)
EXIT
2328 pint_env%tx(:, 1, :) = 0.0_dp
2329 pint_env%tv(:, 1, :) = 0.0_dp
2330 pint_env%tf(:, 1, :) = 0.0_dp
2335 IF (pint_env%simpar%constraint)
THEN
2336 IF (pint_env%logger%para_env%is_source())
THEN
2340 vel(j, i) = pint_env%uv(1, j + (i - 1)*3)
2341 particle_set(i)%r(j) = pint_env%ux(1, j + (i - 1)*3)
2347 IF (iresp == pint_env%nrespa)
THEN
2353 molecule_kind_set, particle_set, &
2354 vel, dt_temp, pint_env%simpar%shake_tol, &
2355 pint_env%simpar%info_constraint, &
2356 pint_env%simpar%lagrange_multipliers, &
2357 pint_env%simpar%dump_lm, cell, &
2362 CALL pint_env%logger%para_env%bcast(vel)
2366 pint_env%uv(1, j + (i - 1)*3) = vel(j, i)
2371 DO inos = 1, pint_env%nnos - 1
2372 pint_env%tf(inos, :, :) = pint_env%tf(inos, :, :) &
2373 - pint_env%tv(inos, :, :)*pint_env%tv(inos + 1, :, :)
2378 pint_env%tx(:, 1, :) = 0.0_dp
2379 pint_env%tv(:, 1, :) = 0.0_dp
2380 pint_env%tf(:, 1, :) = 0.0_dp
2385 pint_env%uv = pint_env%uv_t
2387 pint_env%uv = pint_env%uv_t
2400 SELECT CASE (pint_env%pimd_thermostat)
2403 vnew=pint_env%uv_t, &
2405 ndim=pint_env%ndim, &
2406 first_mode=pint_env%first_propagated_mode, &
2407 masses=pint_env%mass_fict, &
2408 pile_therm=pint_env%pile_therm)
2411 vnew=pint_env%uv_t, &
2412 first_mode=pint_env%first_propagated_mode, &
2413 masses=pint_env%mass_fict, &
2414 piglet_therm=pint_env%piglet_therm)
2417 vnew=pint_env%uv_t, &
2419 ndim=pint_env%ndim, &
2420 masses=pint_env%mass_fict, &
2421 qtb_therm=pint_env%qtb_therm)
2423 pint_env%uv_t = pint_env%uv
2427 pint_env%uv_t = pint_env%uv_t + dti2*pint_env%uf
2430 IF (pint_env%first_propagated_mode == 1)
THEN
2434 pint_env%ux_t(1, :) = pint_env%ux(1, :) + &
2435 dti*pint_env%uv_t(1, :)
2441 pint_env%ux_t(1, :) = pint_env%ux(1, :)
2442 pint_env%uv_t(1, :) = 0.0_dp
2445 DO i = 2, pint_env%p
2446 pint_env%ux_t(i, :) = pint_env%cosex(i)*pint_env%ux(i, :) &
2447 + pint_env%iwsinex(i)*pint_env%uv_t(i, :)
2448 pint_env%uv_t(i, :) = pint_env%cosex(i)*pint_env%uv_t(i, :) &
2449 - pint_env%wsinex(i)*pint_env%ux(i, :)
2453 IF (pint_env%simpar%constraint)
THEN
2455 IF (pint_env%beadwise_constraints)
THEN
2456 IF (pint_env%logger%para_env%is_source())
THEN
2458 CALL pint_u2x(pint_env, ux=pint_env%ux_t, x=pint_env%x)
2459 CALL pint_u2x(pint_env, ux=pint_env%uv_t, x=pint_env%v)
2463 pos(j, i) = pint_env%x(ib, j + (i - 1)*3)
2464 vel(j, i) = pint_env%v(ib, j + (i - 1)*3)
2469 molecule_kind_set, dti, &
2470 f_env%force_env%root_section)
2472 molecule_kind_set, particle_set, &
2473 pos, vel, dti, pint_env%simpar%shake_tol, &
2474 pint_env%simpar%info_constraint, &
2475 pint_env%simpar%lagrange_multipliers, &
2476 pint_env%simpar%dump_lm, cell, &
2480 pint_env%x(ib, j + (i - 1)*3) = pos(j, i)
2481 pint_env%v(ib, j + (i - 1)*3) = vel(j, i)
2486 CALL pint_x2u(pint_env, ux=pint_env%ux_t, x=pint_env%x)
2487 CALL pint_x2u(pint_env, ux=pint_env%uv_t, x=pint_env%v)
2490 CALL pint_env%logger%para_env%bcast(pint_env%ux_t)
2491 CALL pint_env%logger%para_env%bcast(pint_env%uv_t)
2494 IF (pint_env%logger%para_env%is_source())
THEN
2498 pos(j, i) = pint_env%ux_t(1, j + (i - 1)*3)/factor
2499 vel(j, i) = pint_env%uv_t(1, j + (i - 1)*3)/factor
2504 molecule_kind_set, dti, &
2505 f_env%force_env%root_section)
2507 molecule_kind_set, particle_set, &
2508 pos, vel, dti, pint_env%simpar%shake_tol, &
2509 pint_env%simpar%info_constraint, &
2510 pint_env%simpar%lagrange_multipliers, &
2511 pint_env%simpar%dump_lm, cell, &
2515 CALL pint_env%logger%para_env%bcast(pos)
2516 CALL pint_env%logger%para_env%bcast(vel)
2520 pint_env%ux_t(1, j + (i - 1)*3) = pos(j, i)*factor
2521 pint_env%uv_t(1, j + (i - 1)*3) = vel(j, i)*factor
2528 pint_env%ux = pint_env%ux_t
2531 pint_env%uf = 0.0_dp
2533 CALL pint_calc_f(pint_env)
2535 IF (
PRESENT(helium_env))
THEN
2538 IF (pint_env%logger%para_env%is_source())
THEN
2539 pint_env%f(:, :) = pint_env%f(:, :) + helium_env(1)%helium%force_avrg(:, :)
2541 CALL pint_env%logger%para_env%bcast(pint_env%f)
2545 IF (pint_env%first_propagated_mode == 2)
THEN
2546 pint_env%uf(1, :) = 0.0_dp
2548 pint_env%uv_t = pint_env%uv_t + dti2*pint_env%uf
2551 SELECT CASE (pint_env%pimd_thermostat)
2556 ndim=pint_env%ndim, &
2557 first_mode=pint_env%first_propagated_mode, &
2558 masses=pint_env%mass_fict, &
2559 pile_therm=pint_env%pile_therm)
2563 first_mode=pint_env%first_propagated_mode, &
2564 masses=pint_env%mass_fict, &
2565 piglet_therm=pint_env%piglet_therm)
2570 ndim=pint_env%ndim, &
2571 masses=pint_env%mass_fict, &
2572 qtb_therm=pint_env%qtb_therm)
2574 pint_env%uv = pint_env%uv_t
2578 IF (pint_env%simpar%constraint)
THEN
2580 IF (pint_env%beadwise_constraints)
THEN
2581 IF (pint_env%logger%para_env%is_source())
THEN
2584 CALL pint_u2x(pint_env, ux=pint_env%ux, x=pint_env%x)
2585 CALL pint_u2x(pint_env, ux=pint_env%uv, x=pint_env%v)
2589 particle_set(i)%r(j) = pint_env%x(ib, j + (i - 1)*3)
2590 vel(j, i) = pint_env%v(ib, j + (i - 1)*3)
2594 molecule_set, molecule_kind_set, &
2595 particle_set, vel, dti, &
2596 pint_env%simpar%shake_tol, &
2597 pint_env%simpar%info_constraint, &
2598 pint_env%simpar%lagrange_multipliers, &
2599 pint_env%simpar%dump_lm, cell, &
2603 pint_env%v(ib, j + (i - 1)*3) = vel(j, i)
2608 CALL pint_x2u(pint_env, ux=pint_env%uv, x=pint_env%v)
2610 CALL pint_env%logger%para_env%bcast(pint_env%uv)
2613 IF (pint_env%logger%para_env%is_source())
THEN
2618 vel(j, i) = pint_env%uv(1, j + (i - 1)*3)/factor
2619 particle_set(i)%r(j) = pint_env%ux(1, j + (i - 1)*3)/factor
2623 molecule_set, molecule_kind_set, &
2624 particle_set, vel, dti, &
2625 pint_env%simpar%shake_tol, &
2626 pint_env%simpar%info_constraint, &
2627 pint_env%simpar%lagrange_multipliers, &
2628 pint_env%simpar%dump_lm, cell, &
2633 CALL pint_env%logger%para_env%bcast(vel)
2639 pint_env%uv(1, j + (i - 1)*3) = vel(j, i)*factor
2647 IF (pint_env%simpar%constraint)
THEN
2648 DEALLOCATE (pos, vel)
2652 CALL pint_calc_energy(pint_env)
2653 CALL pint_calc_total_action(pint_env)
2667 pint_env%time_per_step = time_stop - time_start
2669 CALL timestop(handle)
2671 END SUBROUTINE pint_step
2679 SUBROUTINE pint_calc_energy(pint_env)
2683 REAL(kind=
dp) :: e_h
2685 CALL pint_calc_e_kin_beads_u(pint_env)
2686 CALL pint_calc_e_vir(pint_env)
2688 CALL pint_calc_uf_h(pint_env, e_h=e_h)
2689 pint_env%e_pot_h = e_h
2691 SELECT CASE (pint_env%pimd_thermostat)
2693 CALL pint_calc_nh_energy(pint_env)
2705 (0.5_dp*real(pint_env%p,
dp)*real(pint_env%ndim,
dp)*pint_env%kT - &
2706 pint_env%e_pot_h)*pint_env%propagator%temp_sim2phys
2711 pint_env%energy(
e_potential_id)*pint_env%propagator%physpotscale + &
2712 pint_env%e_pot_h + &
2713 pint_env%e_kin_beads + &
2714 pint_env%e_pot_t + &
2715 pint_env%e_kin_t + &
2716 pint_env%e_gle + pint_env%e_pile + pint_env%e_piglet + pint_env%e_qtb
2721 END SUBROUTINE pint_calc_energy
2732 SUBROUTINE pint_calc_uf_h(pint_env, e_h)
2734 REAL(kind=
dp),
INTENT(OUT) :: e_h
2738 pint_env%mass_beads, &
2744 pint_env%mass_beads, &
2749 e_h = pint_env%e_pot_h
2750 pint_env%uf_h = pint_env%uf_h/pint_env%mass_fict
2751 END SUBROUTINE pint_calc_uf_h
2765 SUBROUTINE pint_calc_f(pint_env, x, f, e)
2767 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(in), &
2768 OPTIONAL,
TARGET :: x
2769 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(out), &
2770 OPTIONAL,
TARGET :: f
2771 REAL(kind=
dp),
DIMENSION(:),
INTENT(out), &
2772 OPTIONAL,
TARGET :: e
2775 REAL(kind=
dp),
DIMENSION(:),
POINTER :: my_e
2776 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: my_f, my_x
2779 IF (
PRESENT(x)) my_x => x
2781 IF (
PRESENT(f)) my_f => f
2782 my_e => pint_env%e_pot_bead
2783 IF (
PRESENT(e)) my_e => e
2784 DO idim = 1, pint_env%ndim
2785 DO ib = 1, pint_env%p
2786 pint_env%replicas%r(idim, ib) = my_x(ib, idim)
2790 DO idim = 1, pint_env%ndim
2791 DO ib = 1, pint_env%p
2793 my_f(ib, idim) = pint_env%replicas%f(idim, ib)
2796 my_e = pint_env%replicas%f(
SIZE(pint_env%replicas%f, 1), :)
2798 END SUBROUTINE pint_calc_f
2809 SUBROUTINE pint_calc_e_kin_beads_u(pint_env, uv, e_k)
2811 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(in), &
2812 OPTIONAL,
TARGET :: uv
2813 REAL(kind=
dp),
INTENT(out),
OPTIONAL :: e_k
2816 REAL(kind=
dp) :: res
2817 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: my_uv
2820 my_uv => pint_env%uv
2821 IF (
PRESENT(uv)) my_uv => uv
2823 DO idim = 1, pint_env%ndim
2824 DO ib = 1, pint_env%p
2825 res = res + pint_env%mass_fict(ib, idim)*my_uv(ib, idim)**2
2829 IF (.NOT.
PRESENT(uv)) pint_env%e_kin_beads = res
2830 IF (
PRESENT(e_k)) e_k = res
2831 END SUBROUTINE pint_calc_e_kin_beads_u
2841 ELEMENTAL SUBROUTINE pint_calc_e_vir(pint_env, e_vir)
2843 REAL(kind=
dp),
INTENT(out),
OPTIONAL :: e_vir
2846 REAL(kind=
dp) :: res, xcentroid
2850 DO idim = 1, pint_env%ndim
2853 DO ib = 1, pint_env%p
2854 xcentroid = xcentroid + pint_env%x(ib, idim)
2856 xcentroid = xcentroid/real(pint_env%p,
dp)
2857 DO ib = 1, pint_env%p
2858 res = res + (pint_env%x(ib, idim) - xcentroid)*pint_env%f(ib, idim)
2861 res = 0.5_dp*(real(pint_env%ndim,
dp)* &
2862 (pint_env%kT*pint_env%propagator%temp_sim2phys) - res/real(pint_env%p,
dp))
2864 IF (
PRESENT(e_vir)) e_vir = res
2865 END SUBROUTINE pint_calc_e_vir
2873 ELEMENTAL SUBROUTINE pint_calc_nh_energy(pint_env)
2876 INTEGER :: ib, idim, inos
2877 REAL(kind=
dp) :: ekin, epot
2880 DO idim = 1, pint_env%ndim
2881 DO ib = 1, pint_env%p
2882 DO inos = 1, pint_env%nnos
2883 ekin = ekin + pint_env%Q(ib)*pint_env%tv(inos, ib, idim)**2
2887 pint_env%e_kin_t = 0.5_dp*ekin
2889 DO idim = 1, pint_env%ndim
2890 DO ib = 1, pint_env%p
2891 DO inos = 1, pint_env%nnos
2892 epot = epot + pint_env%tx(inos, ib, idim)
2896 pint_env%e_pot_t = pint_env%kT*epot
2897 END SUBROUTINE pint_calc_nh_energy
2905 ELEMENTAL FUNCTION pint_calc_total_link_action(pint_env)
RESULT(link_action)
2907 REAL(kind=
dp) :: link_action
2909 INTEGER :: iatom, ibead, idim, indx
2910 REAL(kind=
dp) :: hb2m, tau, tmp_link_action
2911 REAL(kind=
dp),
DIMENSION(3) :: r
2914 tau = pint_env%beta/real(pint_env%p,
dp)
2916 link_action = 0.0_dp
2917 DO iatom = 1, pint_env%ndim/3
2919 hb2m = 1.0_dp/pint_env%mass((iatom - 1)*3 + 1)
2920 tmp_link_action = 0.0_dp
2921 DO ibead = 1, pint_env%p - 1
2923 indx = (iatom - 1)*3 + idim
2924 r(idim) = pint_env%x(ibead, indx) - pint_env%x(ibead + 1, indx)
2926 tmp_link_action = tmp_link_action + (r(1)*r(1) + r(2)*r(2) + r(3)*r(3))
2929 indx = (iatom - 1)*3 + idim
2930 r(idim) = pint_env%x(pint_env%p, indx) - pint_env%x(1, indx)
2932 tmp_link_action = tmp_link_action + (r(1)*r(1) + r(2)*r(2) + r(3)*r(3))
2933 link_action = link_action + tmp_link_action/hb2m
2936 link_action = link_action/(2.0_dp*tau)
2938 END FUNCTION pint_calc_total_link_action
2946 ELEMENTAL FUNCTION pint_calc_total_pot_action(pint_env)
RESULT(pot_action)
2948 REAL(kind=
dp) :: pot_action
2950 REAL(kind=
dp) :: tau
2952 tau = pint_env%beta/real(pint_env%p,
dp)
2953 pot_action = tau*sum(pint_env%e_pot_bead)
2955 END FUNCTION pint_calc_total_pot_action
2962 ELEMENTAL SUBROUTINE pint_calc_total_action(pint_env)
2965 pint_env%pot_action = pint_calc_total_pot_action(pint_env)
2966 pint_env%link_action = pint_calc_total_link_action(pint_env)
2968 END SUBROUTINE pint_calc_total_action
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
represent a simple array based list of the given type
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.
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public shiga2022
integer, save, public ceriotti2012
integer, save, public ceriotti2010
integer, save, public brieuc2016
Handles all functions related to the CELL.
Contains routines useful for the application of constraints during MD.
subroutine, public getold(gci, local_molecules, molecule_set, molecule_kind_set, particle_set, cell)
saves all of the old variables
subroutine, public rattle_control(gci, local_molecules, molecule_set, molecule_kind_set, particle_set, vel, dt, rattle_tol, log_unit, lagrange_mult, dump_lm, cell, group, local_particles)
...
subroutine, public shake_control(gci, local_molecules, molecule_set, molecule_kind_set, particle_set, pos, vel, dt, shake_tol, log_unit, lagrange_mult, dump_lm, cell, group, local_particles)
...
subroutine, public shake_update_targets(gci, local_molecules, molecule_set, molecule_kind_set, dt, root_section)
Updates the TARGET of the COLLECTIVE constraints if the growth speed is different from zero.
Routines to handle the external control of CP2K.
subroutine, public external_control(should_stop, flag, globenv, target_time, start_time, force_check)
External manipulations during a run : when the <PROJECT_NAME>.EXIT_$runtype command is sent the progr...
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
subroutine, public cp_iterate(iteration_info, last, iter_nr, increment, iter_nr_out)
adds one to the actual iteration
subroutine, public cp_rm_iter_level(iteration_info, level_name, n_rlevel_att)
Removes an iteration level.
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...
subroutine, public cp_add_iter_level(iteration_info, level_name, n_rlevel_new)
Adds an iteration level.
types that represent a subsys, i.e. a part of the system
subroutine, public cp_subsys_get(subsys, ref_count, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell, cell_ref, use_ref_cell)
returns information about various attributes of the given subsys
real(kind=dp) function, public cp_unit_from_cp2k(value, unit_str, defaults, power)
converts from the internal cp2k units to the given unit
real(kind=dp) function, public cp_unit_to_cp2k(value, unit_str, defaults, power)
converts to 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...
interface to use cp2k as library
subroutine, public f_env_add_defaults(f_env_id, f_env, handle)
adds the default environments of the f_env to the stack of the defaults, and returns a new error and ...
subroutine, public f_env_rm_defaults(f_env, ierr, handle)
removes the default environments of the f_env to the stack of the defaults, and sets ierr accordingly...
Interface for the force calculations.
recursive subroutine, public force_env_get(force_env, in_use, fist_env, qs_env, meta_env, fp_env, subsys, para_env, potential_energy, additional_potential, kinetic_energy, harmonic_shell, kinetic_shell, cell, sub_force_env, qmmm_env, qmmmx_env, eip_env, pwdft_env, globenv, input, force_env_section, method_name_id, root_section, mixed_env, nnp_env, embed_env, ipi_env)
returns various attributes about the force environment
subroutine, public restart_gle(gle, gle_section, save_mem, restart)
...
subroutine, public gle_matrix_exp(m, n, j, k, em)
...
subroutine, public gle_cholesky_stab(sst, s, n)
...
subroutine, public gle_dealloc(gle)
Deallocate type for GLE thermostat.
subroutine, public gle_thermo_create(gle, mal_size)
...
subroutine, public gle_init(gle, dt, temp, section)
...
Define type storing the global information of a run. Keep the amount of stored data small....
Methods that handle helium-solvent and helium-helium interactions.
subroutine, public helium_intpot_scan(pint_env, helium_env)
Scan the helium-solute interaction energy within the periodic cell.
I/O subroutines for helium.
subroutine, public helium_write_cubefile(unit, comment, origin, deltar, ndim, data)
Write volumetric data to an orthorhombic cubefile.
Methods dealing with helium_solvent_type.
subroutine, public helium_release(helium_env)
Releases helium_solvent_type.
subroutine, public helium_create(helium_env, input, solute)
Data-structure that holds all needed information about (superfluid) helium solvent.
subroutine, public helium_init(helium_env, pint_env)
Initialize helium data structures.
Methods for sampling helium variables.
subroutine, public helium_step(helium_env, pint_env)
Perform MC step for helium.
subroutine, public helium_do_run(helium_env, globenv)
Performs MC simulation for helium (only)
Data types representing superfluid helium.
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
integer, parameter, public default_path_length
Machine interface based on Fortran 2003 and POSIX.
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
real(kind=dp) function, public m_walltime()
returns time from a real-time clock, protected against rolling early/easily
Definition of mathematical constants and functions.
real(kind=dp), parameter, public twopi
Collection of simple mathematical functions and subroutines.
elemental integer function, public gcd(a, b)
computes the greatest common divisor of two number
Interface to the message passing library MPI.
type(mp_comm_type), parameter, public mp_comm_self
represent a simple array based list of the given type
Define the molecule kind structure types and the corresponding functionality.
represent a simple array based list of the given type
Define the data structure for the molecule information.
Parallel (pseudo)random number generator (RNG) for multiple streams and substreams of random numbers.
integer, parameter, public gaussian
represent a simple array based list of the given type
Define the data structure for the particle information.
Methods to apply GLE to PI runs.
subroutine, public pint_gle_init(pint_env)
...
subroutine, public pint_gle_step(pint_env)
...
elemental subroutine, public pint_calc_gle_energy(pint_env)
...
I/O subroutines for pint_env.
subroutine, public pint_write_action(pint_env)
Writes out the actions according to PINTPRINTACTION.
subroutine, public pint_write_centroids(pint_env)
Write out the trajectory of the centroid (positions and velocities)
subroutine, public pint_write_rgyr(pint_env)
Write radii of gyration according to PINTPRINTCENTROID_GYR.
subroutine, public pint_write_step_info(pint_env)
Write step info to the output file.
subroutine, public pint_write_ener(pint_env)
Writes out the energies according to PINTPRINTENERGY.
subroutine, public pint_write_line(line)
Writes out a line of text to the default output unit.
subroutine, public pint_write_trajectory(pint_env)
Write out the trajectory of the beads (positions and velocities)
subroutine, public pint_write_com(pint_env)
Write center of mass (COM) position according to PINTPRINTCOM.
Methods to performs a path integral run.
subroutine, public do_pint_run(para_env, input, input_declaration, globenv)
Perform a path integral simulation.
Data type and methods dealing with PI calcs in normal mode coords.
pure subroutine, public normalmode_calc_uf_h(normalmode_env, mass_beads, ux, uf_h, e_h)
calculates the harmonic force in the normal mode basis
pure subroutine, public normalmode_release(normalmode_env)
releases the normalmode environment
subroutine, public normalmode_env_create(normalmode_env, normalmode_section, p, kt, propagator)
creates the data needed for a normal mode transformation
pure subroutine, public normalmode_init_masses(normalmode_env, mass, mass_beads, mass_fict, q)
initializes the masses and fictitious masses compatible with the normal mode information
Methods to apply the piglet thermostat to PI runs.
elemental subroutine, public pint_calc_piglet_energy(pint_env)
returns the piglet kinetic energy contribution
subroutine, public pint_piglet_release(piglet_therm)
releases the piglet environment
subroutine, public pint_piglet_create(piglet_therm, pint_env, section)
creates the data structure for a piglet thermostating in PI runs
subroutine, public pint_piglet_step(vold, vnew, first_mode, masses, piglet_therm)
...
subroutine, public pint_piglet_init(piglet_therm, pint_env, section, dt, para_env)
initializes the data for a piglet run
Methods to apply a simple Lagevin thermostat to PI runs. v_new = c1*vold + SQRT(kT/m)*c2*random.
subroutine, public pint_pile_step(vold, vnew, p, ndim, first_mode, masses, pile_therm)
...
subroutine, public pint_pile_init(pile_therm, pint_env, normalmode_env, section)
initializes the data for a pile run
subroutine, public pint_pile_release(pile_therm)
releases the pile environment
subroutine, public pint_calc_pile_energy(pint_env)
returns the pile kinetic energy contribution
Public path integral routines that can be called from other modules.
subroutine, public pint_levy_walk(x0, n, v, x, rng_gaussian)
Perform a Brownian walk of length n around x0 with the variance v.
Methods to apply the QTB thermostat to PI runs. Based on the PILE implementation from Felix Uhl (pint...
subroutine, public pint_qtb_step(vold, vnew, p, ndim, masses, qtb_therm)
...
subroutine, public pint_calc_qtb_energy(pint_env)
returns the qtb kinetic energy contribution
subroutine, public pint_qtb_release(qtb_therm)
releases the qtb environment
subroutine, public pint_qtb_init(qtb_therm, pint_env, normalmode_env, section)
initializes the data for a QTB run
Data type and methods dealing with PI calcs in staging coordinates.
elemental subroutine, public staging_release(staging_env)
releases the staging environment, kept for symmetry reasons with staging_env_create
subroutine, public staging_env_create(staging_env, staging_section, p, kt)
creates the data needed for a staging transformation
pure subroutine, public staging_calc_uf_h(staging_env, mass_beads, ux, uf_h, e_h)
calculates the harmonic force in the staging basis
pure subroutine, public staging_init_masses(staging_env, mass, mass_beads, mass_fict, q)
initializes the masses and fictitious masses compatibly with the staging information
integer, parameter, public e_kin_thermo_id
integer, parameter, public e_conserved_id
integer, parameter, public thermostat_none
integer, parameter, public thermostat_gle
integer, parameter, public e_potential_id
integer, parameter, public thermostat_pile
integer, parameter, public thermostat_piglet
integer, parameter, public thermostat_nose
integer, parameter, public e_kin_virial_id
integer, parameter, public thermostat_qtb
methods to setup replicas of the same system differing only by atom positions and velocities (as used...
subroutine, public rep_env_create(rep_env, para_env, input, input_declaration, nrep, prep, sync_v, keep_wf_history, row_force)
creates a replica environment together with its force environment
subroutine, public rep_env_calc_e_f(rep_env, calc_f)
evaluates the forces
types used to handle many replica of the same system that differ only in atom positions,...
subroutine, public rep_env_release(rep_env)
releases the given replica environment
Type for storing MD parameters.
subroutine, public release_simpar_type(simpar)
Releases the simulation parameters type.
subroutine, public create_simpar_type(simpar)
Creates the simulation parameters type.
represent a list of objects
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...
represents a system: atoms, molecules, their pos,vel,...
structure to store local (to a processor) ordered lists of integers.
contains the initially parsed file and the initial parallel environment
data structure for array of solvent helium environments
stores all the informations relevant to an mpi environment
represent a list of objects
represent a list of objects
represent a list of objects
environment for a path integral run
keeps replicated information about the replicas