124#include "../base/base_uses.f90"
130 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'integrator'
155 INTEGER :: iparticle, iparticle_kind, iparticle_local, iparticle_reg, ireg, nparticle, &
156 nparticle_kind, nparticle_local, nshell
157 INTEGER,
POINTER :: itimes
158 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: do_langevin
159 REAL(kind=
dp) :: c, c1, c2, c3, c4, dm, dt, gam, &
160 lambda_mix, mass, noisy_gamma_region, &
162 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: var_w
163 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: pos, vel, w
185 NULLIFY (cell, para_env, gci, force_env)
186 NULLIFY (atomic_kinds, local_particles, subsys, local_molecules, molecule_kinds, molecules)
187 NULLIFY (molecule_kind_set, molecule_set, particles, particle_set, simpar, virial)
188 NULLIFY (thermal_region, thermal_regions, itimes, electrons)
190 CALL get_md_env(md_env=md_env, simpar=simpar, force_env=force_env, &
191 para_env=para_env, thermal_regions=thermal_regions, &
192 itimes=itimes, electrons=electrons)
195 gam = simpar%gamma + simpar%shadow_gamma
198 CALL force_env_get(force_env=force_env, subsys=subsys, cell=cell)
204 atomic_kinds=atomic_kinds, &
206 local_particles=local_particles, &
207 local_molecules=local_molecules, &
208 molecules=molecules, &
209 molecule_kinds=molecule_kinds, &
211 particles=particles, &
213 IF (nshell /= 0)
THEN
214 cpabort(
"Langevin dynamics is not yet implemented for core-shell models")
217 nparticle_kind = atomic_kinds%n_els
218 atomic_kind_set => atomic_kinds%els
219 molecule_kind_set => molecule_kinds%els
221 nparticle = particles%n_els
222 particle_set => particles%els
223 molecule_set => molecules%els
226 ALLOCATE (do_langevin(nparticle))
227 IF (simpar%do_thermal_region)
THEN
228 DO iparticle = 1, nparticle
229 do_langevin(iparticle) = thermal_regions%do_langevin(iparticle)
232 do_langevin(1:nparticle) = .true.
243 ALLOCATE (var_w(nparticle))
244 var_w(1:nparticle) = simpar%var_w
245 IF (simpar%do_thermal_region)
THEN
246 DO ireg = 1, thermal_regions%nregions
247 thermal_region => thermal_regions%thermal_region(ireg)
248 noisy_gamma_region = thermal_region%noisy_gamma_region
249 DO iparticle_reg = 1, thermal_region%npart
250 iparticle = thermal_region%part_index(iparticle_reg)
251 reg_temp = thermal_region%temp_expected
252 var_w(iparticle) = 2.0_dp*reg_temp*simpar%dt*(simpar%gamma + noisy_gamma_region)
258 ALLOCATE (pos(3, nparticle))
261 ALLOCATE (vel(3, nparticle))
264 ALLOCATE (w(3, nparticle))
267 IF (simpar%constraint)
CALL getold(gci, local_molecules, molecule_set, &
268 molecule_kind_set, particle_set, cell)
271 DO iparticle_kind = 1, nparticle_kind
272 atomic_kind => atomic_kind_set(iparticle_kind)
274 nparticle_local = local_particles%n_el(iparticle_kind)
275 DO iparticle_local = 1, nparticle_local
276 iparticle = local_particles%list(iparticle_kind)%array(iparticle_local)
277 IF (do_langevin(iparticle))
THEN
278 sigma = var_w(iparticle)*mass
279 associate(rng_stream => local_particles%local_particle_set(iparticle_kind)% &
280 rng(iparticle_local))
281 w(1, iparticle) = rng_stream%stream%next(variance=sigma)
282 w(2, iparticle) = rng_stream%stream%next(variance=sigma)
283 w(3, iparticle) = rng_stream%stream%next(variance=sigma)
309 IF (
ASSOCIATED(electrons))
THEN
316 c = exp(-0.25_dp*dt*gam)
321 DO iparticle_kind = 1, nparticle_kind
322 atomic_kind => atomic_kind_set(iparticle_kind)
324 nparticle_local = local_particles%n_el(iparticle_kind)
327 DO iparticle_local = 1, nparticle_local
328 iparticle = local_particles%list(iparticle_kind)%array(iparticle_local)
329 IF (do_langevin(iparticle))
THEN
330 vel(:, iparticle) = particle_set(iparticle)%v(:) + &
331 c3*particle_set(iparticle)%f(:)
332 pos(:, iparticle) = particle_set(iparticle)%r(:) + &
333 c1*particle_set(iparticle)%v(:) + &
334 c*dm*(dt*particle_set(iparticle)%f(:) + &
337 vel(:, iparticle) = particle_set(iparticle)%v(:) + &
338 dm*particle_set(iparticle)%f(:)
339 pos(:, iparticle) = particle_set(iparticle)%r(:) + &
340 dt*particle_set(iparticle)%v(:) + &
341 dm*dt*particle_set(iparticle)%f(:)
346 IF (simpar%constraint)
THEN
349 molecule_kind_set, dt, force_env%root_section)
351 CALL shake_control(gci, local_molecules, molecule_set, molecule_kind_set, &
352 particle_set, pos, vel, dt, simpar%shake_tol, &
353 simpar%info_constraint, simpar%lagrange_multipliers, &
354 simpar%dump_lm, cell, para_env, local_particles)
366 IF (
ASSOCIATED(electrons))
THEN
372 IF (.NOT. electrons%report_only)
THEN
375 IF (electrons%charge_mixing_enabled)
THEN
392 IF (
ASSOCIATED(electrons))
THEN
393 IF (electrons%charge_mixing_enabled)
THEN
395 electrons%potential_average_min, electrons%potential_average_max, &
396 electrons%q, electrons%charge_mixing_span, &
397 electrons%current_fermi_level_eV, electrons%current_workfunction, &
398 lambda_in=lambda_mix)
401 electrons%potential_average_min, electrons%potential_average_max, &
402 electrons%current_fermi_level_eV, electrons%current_workfunction)
410 DO iparticle_kind = 1, nparticle_kind
411 atomic_kind => atomic_kind_set(iparticle_kind)
415 nparticle_local = local_particles%n_el(iparticle_kind)
416 DO iparticle_local = 1, nparticle_local
417 iparticle = local_particles%list(iparticle_kind)%array(iparticle_local)
418 IF (do_langevin(iparticle))
THEN
419 vel(1, iparticle) = vel(1, iparticle) + c3*particle_set(iparticle)%f(1)
420 vel(2, iparticle) = vel(2, iparticle) + c3*particle_set(iparticle)%f(2)
421 vel(3, iparticle) = vel(3, iparticle) + c3*particle_set(iparticle)%f(3)
422 vel(1, iparticle) = c4*vel(1, iparticle) + c2*w(1, iparticle)/mass
423 vel(2, iparticle) = c4*vel(2, iparticle) + c2*w(2, iparticle)/mass
424 vel(3, iparticle) = c4*vel(3, iparticle) + c2*w(3, iparticle)/mass
426 vel(1, iparticle) = vel(1, iparticle) + dm*particle_set(iparticle)%f(1)
427 vel(2, iparticle) = vel(2, iparticle) + dm*particle_set(iparticle)%f(2)
428 vel(3, iparticle) = vel(3, iparticle) + dm*particle_set(iparticle)%f(3)
435 IF (
ASSOCIATED(electrons))
THEN
440 IF (simpar%temperature_annealing)
THEN
441 simpar%temp_ext = simpar%temp_ext*simpar%f_temperature_annealing
442 simpar%var_w = simpar%var_w*simpar%f_temperature_annealing
445 IF (simpar%constraint)
THEN
446 CALL rattle_control(gci, local_molecules, molecule_set, molecule_kind_set, &
447 particle_set, vel, dt, simpar%shake_tol, &
448 simpar%info_constraint, simpar%lagrange_multipliers, &
449 simpar%dump_lm, cell, para_env, local_particles)
454 IF (
ASSOCIATED(electrons))
THEN
466 DEALLOCATE (do_langevin)
469 IF (simpar%constraint)
CALL pv_constraint(gci, local_molecules, molecule_set, &
470 molecule_kind_set, particle_set, virial, para_env)
486 SUBROUTINE nve(md_env, globenv)
488 TYPE(md_environment_type),
POINTER :: md_env
489 TYPE(global_environment_type),
POINTER :: globenv
491 INTEGER :: i_iter, n_iter, nparticle, &
492 nparticle_kind, nshell
493 INTEGER,
POINTER :: itimes
494 LOGICAL :: deallocate_vel, ehrenfest_md, &
495 shell_adiabatic, shell_check_distance, &
498 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:, :) :: v_old
499 TYPE(atomic_kind_list_type),
POINTER :: atomic_kinds
500 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
501 TYPE(cell_type),
POINTER :: cell
502 TYPE(cp_subsys_type),
POINTER :: subsys
503 TYPE(dft_control_type),
POINTER :: dft_control
504 TYPE(distribution_1d_type),
POINTER :: local_molecules, local_particles
505 TYPE(force_env_type),
POINTER :: force_env
506 TYPE(global_constraint_type),
POINTER :: gci
507 TYPE(molecule_kind_list_type),
POINTER :: molecule_kinds
508 TYPE(molecule_kind_type),
DIMENSION(:),
POINTER :: molecule_kind_set
509 TYPE(molecule_list_type),
POINTER :: molecules
510 TYPE(molecule_type),
DIMENSION(:),
POINTER :: molecule_set
511 TYPE(mp_para_env_type),
POINTER :: para_env
512 TYPE(particle_list_type),
POINTER :: core_particles, particles, &
514 TYPE(particle_type),
DIMENSION(:),
POINTER :: core_particle_set, particle_set, &
516 TYPE(rt_prop_type),
POINTER :: rtp
517 TYPE(simpar_type),
POINTER :: simpar
518 TYPE(thermostat_type),
POINTER :: thermostat_coeff, thermostat_shell
519 TYPE(tmp_variables_type),
POINTER :: tmp
520 TYPE(virial_type),
POINTER :: virial
522 NULLIFY (thermostat_coeff, tmp)
523 NULLIFY (subsys, simpar, para_env, cell, gci, force_env, virial)
524 NULLIFY (atomic_kinds, local_particles, molecules, molecule_kind_set, molecule_set, particle_set)
525 NULLIFY (shell_particles, shell_particle_set, core_particles, &
526 core_particle_set, thermostat_shell, dft_control, itimes)
527 CALL get_md_env(md_env=md_env, simpar=simpar, force_env=force_env, &
528 thermostat_coeff=thermostat_coeff, thermostat_shell=thermostat_shell, &
529 para_env=para_env, ehrenfest_md=ehrenfest_md, itimes=itimes)
531 CALL force_env_get(force_env=force_env, subsys=subsys, cell=cell)
534 CALL apply_qmmm_walls_reflective(force_env)
536 CALL cp_subsys_get(subsys=subsys, atomic_kinds=atomic_kinds, local_particles=local_particles, &
537 particles=particles, local_molecules=local_molecules, molecules=molecules, &
538 molecule_kinds=molecule_kinds, gci=gci, virial=virial)
540 nparticle_kind = atomic_kinds%n_els
541 atomic_kind_set => atomic_kinds%els
542 molecule_kind_set => molecule_kinds%els
544 nparticle = particles%n_els
545 particle_set => particles%els
546 molecule_set => molecules%els
548 CALL get_atomic_kind_set(atomic_kind_set=atomic_kind_set, &
549 shell_present=shell_present, shell_adiabatic=shell_adiabatic, &
550 shell_check_distance=shell_check_distance)
552 IF (shell_present)
THEN
553 CALL cp_subsys_get(subsys=subsys, shell_particles=shell_particles, &
554 core_particles=core_particles)
555 shell_particle_set => shell_particles%els
556 nshell =
SIZE(shell_particles%els)
558 IF (shell_adiabatic)
THEN
559 core_particle_set => core_particles%els
563 CALL allocate_tmp(md_env, tmp, nparticle, nshell, shell_adiabatic)
566 IF (shell_adiabatic)
THEN
567 CALL apply_thermostat_shells(thermostat_shell, atomic_kind_set, particle_set, &
568 local_particles, para_env, shell_particle_set=shell_particle_set, &
569 core_particle_set=core_particle_set)
572 IF (simpar%constraint)
CALL getold(gci, local_molecules, molecule_set, &
573 molecule_kind_set, particle_set, cell)
576 CALL vv_first(tmp, atomic_kind_set, local_particles, particle_set, &
577 core_particle_set, shell_particle_set, nparticle_kind, shell_adiabatic, dt)
579 IF (simpar%variable_dt)
CALL variable_timestep(md_env, tmp, dt, simpar, para_env, atomic_kind_set, &
580 local_particles, particle_set, core_particle_set, shell_particle_set, &
581 nparticle_kind, shell_adiabatic)
583 IF (simpar%constraint)
THEN
585 CALL shake_update_targets(gci, local_molecules, molecule_set, &
586 molecule_kind_set, dt, force_env%root_section)
588 CALL shake_control(gci, local_molecules, molecule_set, &
589 molecule_kind_set, particle_set, tmp%pos, tmp%vel, dt, simpar%shake_tol, &
590 simpar%info_constraint, simpar%lagrange_multipliers, simpar%dump_lm, &
591 cell, para_env, local_particles)
595 CALL update_dealloc_tmp(tmp, particle_set, shell_particle_set, &
596 core_particle_set, para_env, shell_adiabatic, pos=.true.)
598 IF (shell_adiabatic .AND. shell_check_distance)
THEN
599 CALL optimize_shell_core(force_env, particle_set, &
600 shell_particle_set, core_particle_set, globenv, tmp=tmp, check=.true.)
605 IF (ehrenfest_md)
THEN
606 ALLOCATE (v_old(3,
SIZE(tmp%vel, 2)))
607 v_old(:, :) = tmp%vel
608 CALL vv_second(tmp, atomic_kind_set, local_particles, particle_set, &
609 core_particle_set, shell_particle_set, nparticle_kind, shell_adiabatic, dt)
610 CALL update_dealloc_tmp(tmp, particle_set, shell_particle_set, &
611 core_particle_set, para_env, shell_adiabatic, vel=.true., &
612 should_deall_vel=.false.)
614 CALL get_qs_env(force_env%qs_env, dft_control=dft_control)
615 n_iter = dft_control%rtp_control%max_iter
620 DO i_iter = 1, n_iter
622 IF (ehrenfest_md)
THEN
623 CALL get_qs_env(qs_env=force_env%qs_env, rtp=rtp)
626 CALL propagation_step(force_env%qs_env, rtp, dft_control%rtp_control)
630 CALL force_env_calc_energy_force(force_env, require_consistent_energy_force=.false.)
632 IF (ehrenfest_md)
THEN
633 CALL rt_prop_output(force_env%qs_env, ehrenfest, delta_iter=force_env%qs_env%rtp%delta_iter)
637 CALL metadyn_integrator(force_env, itimes, tmp%vel)
640 CALL vv_second(tmp, atomic_kind_set, local_particles, particle_set, &
641 core_particle_set, shell_particle_set, nparticle_kind, shell_adiabatic, dt)
643 IF (simpar%constraint)
CALL rattle_control(gci, local_molecules, molecule_set, &
644 molecule_kind_set, particle_set, tmp%vel, dt, simpar%shake_tol, &
645 simpar%info_constraint, simpar%lagrange_multipliers, simpar%dump_lm, &
646 cell, para_env, local_particles)
649 IF (shell_adiabatic)
THEN
650 CALL apply_thermostat_shells(thermostat_shell, atomic_kind_set, particle_set, &
651 local_particles, para_env, vel=tmp%vel, &
652 shell_vel=tmp%shell_vel, core_vel=tmp%core_vel)
655 IF (simpar%annealing)
THEN
656 tmp%vel(:, :) = tmp%vel(:, :)*simpar%f_annealing
657 IF (shell_adiabatic)
THEN
658 CALL shell_scale_comv(atomic_kind_set, local_particles, particle_set, &
659 tmp%vel, tmp%shell_vel, tmp%core_vel)
663 IF (ehrenfest_md) deallocate_vel = force_env%qs_env%rtp%converged
664 IF (i_iter == n_iter) deallocate_vel = .true.
666 CALL update_dealloc_tmp(tmp, particle_set, shell_particle_set, &
667 core_particle_set, para_env, shell_adiabatic, vel=.true., &
668 should_deall_vel=deallocate_vel)
669 IF (ehrenfest_md)
THEN
670 IF (force_env%qs_env%rtp%converged)
EXIT
676 IF (simpar%constraint)
CALL pv_constraint(gci, local_molecules, &
677 molecule_set, molecule_kind_set, particle_set, virial, para_env)
679 CALL virial_evaluate(atomic_kind_set, particle_set, &
680 local_particles, virial, para_env)
700 TYPE(md_environment_type),
POINTER :: md_env
702 INTEGER :: nparticle, nparticle_kind, nshell
703 INTEGER,
POINTER :: itimes
704 LOGICAL :: shell_adiabatic, shell_present
706 TYPE(atomic_kind_list_type),
POINTER :: atomic_kinds
707 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
708 TYPE(cp_subsys_type),
POINTER :: subsys
709 TYPE(distribution_1d_type),
POINTER :: local_particles
710 TYPE(force_env_type),
POINTER :: force_env
711 TYPE(mp_para_env_type),
POINTER :: para_env
712 TYPE(particle_list_type),
POINTER :: core_particles, particles, &
714 TYPE(particle_type),
DIMENSION(:),
POINTER :: core_particle_set, particle_set, &
716 TYPE(simpar_type),
POINTER :: simpar
717 TYPE(tmp_variables_type),
POINTER :: tmp
719 NULLIFY (force_env, tmp, simpar, itimes)
720 NULLIFY (atomic_kinds, para_env, subsys, local_particles)
721 NULLIFY (core_particles, particles, shell_particles)
722 NULLIFY (core_particle_set, particle_set, shell_particle_set)
724 CALL get_md_env(md_env=md_env, simpar=simpar, force_env=force_env, &
725 para_env=para_env, itimes=itimes)
729 CALL force_env_get(force_env=force_env, subsys=subsys)
732 CALL apply_qmmm_walls_reflective(force_env)
734 IF (simpar%constraint)
THEN
735 cpabort(
"Constraints not yet implemented")
738 CALL cp_subsys_get(subsys=subsys, atomic_kinds=atomic_kinds, &
739 local_particles=local_particles, &
742 nparticle_kind = atomic_kinds%n_els
743 atomic_kind_set => atomic_kinds%els
744 nparticle = particles%n_els
745 particle_set => particles%els
747 CALL get_atomic_kind_set(atomic_kind_set=atomic_kind_set, &
748 shell_present=shell_present, shell_adiabatic=shell_adiabatic)
750 IF (shell_present)
THEN
751 CALL cp_subsys_get(subsys=subsys, shell_particles=shell_particles, &
752 core_particles=core_particles)
753 shell_particle_set => shell_particles%els
754 nshell =
SIZE(shell_particles%els)
756 IF (shell_adiabatic)
THEN
757 core_particle_set => core_particles%els
761 CALL allocate_tmp(md_env, tmp, nparticle, nshell, shell_adiabatic)
764 CALL get_s_ds(tmp, nparticle_kind, atomic_kind_set, local_particles, particle_set, &
768 tmp%scale_v(1:3) = sqrt(1.0_dp/tmp%ds)
769 tmp%poly_v(1:3) = 2.0_dp*tmp%s/sqrt(tmp%ds)/dt
770 CALL vv_first(tmp, atomic_kind_set, local_particles, particle_set, &
771 core_particle_set, shell_particle_set, nparticle_kind, &
774 IF (simpar%variable_dt)
CALL variable_timestep(md_env, tmp, dt, simpar, para_env, atomic_kind_set, &
775 local_particles, particle_set, core_particle_set, shell_particle_set, &
776 nparticle_kind, shell_adiabatic)
779 CALL update_dealloc_tmp(tmp, particle_set, shell_particle_set, &
780 core_particle_set, para_env, shell_adiabatic, pos=.true.)
782 CALL force_env_calc_energy_force(force_env)
785 CALL metadyn_integrator(force_env, itimes, tmp%vel)
788 CALL get_s_ds(tmp, nparticle_kind, atomic_kind_set, local_particles, particle_set, &
789 dt, para_env, tmpv=.true.)
792 tmp%scale_v(1:3) = sqrt(1.0_dp/tmp%ds)
793 tmp%poly_v(1:3) = 2.0_dp*tmp%s/sqrt(tmp%ds)/dt
794 CALL vv_second(tmp, atomic_kind_set, local_particles, particle_set, &
795 core_particle_set, shell_particle_set, nparticle_kind, &
798 IF (simpar%annealing) tmp%vel(:, :) = tmp%vel(:, :)*simpar%f_annealing
801 CALL update_dealloc_tmp(tmp, particle_set, shell_particle_set, &
802 core_particle_set, para_env, shell_adiabatic, vel=.true.)
816 TYPE(md_environment_type),
POINTER :: md_env
817 TYPE(global_environment_type),
POINTER :: globenv
819 INTEGER :: ivar, nparticle, nparticle_kind, nshell
820 INTEGER,
POINTER :: itimes
821 LOGICAL :: shell_adiabatic, shell_check_distance, &
824 REAL(kind=dp),
DIMENSION(:),
POINTER :: rand
825 TYPE(atomic_kind_list_type),
POINTER :: atomic_kinds
826 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
827 TYPE(cell_type),
POINTER :: cell
828 TYPE(cp_subsys_type),
POINTER :: subsys
829 TYPE(distribution_1d_type),
POINTER :: local_molecules, local_particles
830 TYPE(force_env_type),
POINTER :: force_env
831 TYPE(global_constraint_type),
POINTER :: gci
832 TYPE(molecule_kind_list_type),
POINTER :: molecule_kinds
833 TYPE(molecule_kind_type),
DIMENSION(:),
POINTER :: molecule_kind_set
834 TYPE(molecule_list_type),
POINTER :: molecules
835 TYPE(molecule_type),
DIMENSION(:),
POINTER :: molecule_set
836 TYPE(mp_para_env_type),
POINTER :: para_env
837 TYPE(particle_list_type),
POINTER :: core_particles, particles, &
839 TYPE(particle_type),
DIMENSION(:),
POINTER :: core_particle_set, particle_set, &
841 TYPE(simpar_type),
POINTER :: simpar
842 TYPE(thermostat_type),
POINTER :: thermostat_coeff, thermostat_fast, &
843 thermostat_shell, thermostat_slow
844 TYPE(tmp_variables_type),
POINTER :: tmp
845 TYPE(virial_type),
POINTER :: virial
847 NULLIFY (gci, force_env, thermostat_coeff, tmp, &
848 thermostat_fast, thermostat_slow, thermostat_shell, cell, shell_particles, &
849 shell_particle_set, core_particles, core_particle_set, rand)
850 NULLIFY (para_env, subsys, local_molecules, local_particles, molecule_kinds, &
851 molecules, molecule_kind_set, molecule_set, atomic_kinds, particles)
852 NULLIFY (simpar, itimes)
854 CALL get_md_env(md_env=md_env, simpar=simpar, force_env=force_env, &
855 thermostat_fast=thermostat_fast, thermostat_slow=thermostat_slow, &
856 thermostat_coeff=thermostat_coeff, thermostat_shell=thermostat_shell, &
857 para_env=para_env, itimes=itimes)
860 CALL force_env_get(force_env=force_env, subsys=subsys, cell=cell)
863 CALL apply_qmmm_walls_reflective(force_env)
865 CALL cp_subsys_get(subsys=subsys, atomic_kinds=atomic_kinds, local_particles=local_particles, &
866 particles=particles, local_molecules=local_molecules, molecules=molecules, &
867 molecule_kinds=molecule_kinds, gci=gci, virial=virial)
869 nparticle_kind = atomic_kinds%n_els
870 atomic_kind_set => atomic_kinds%els
871 molecule_kind_set => molecule_kinds%els
873 nparticle = particles%n_els
874 particle_set => particles%els
875 molecule_set => molecules%els
877 CALL get_atomic_kind_set(atomic_kind_set=atomic_kind_set, &
878 shell_present=shell_present, shell_adiabatic=shell_adiabatic, &
879 shell_check_distance=shell_check_distance)
881 IF (
ASSOCIATED(force_env%meta_env))
THEN
883 IF (force_env%meta_env%langevin)
THEN
884 ALLOCATE (rand(force_env%meta_env%n_colvar))
890 IF (shell_present)
THEN
891 CALL cp_subsys_get(subsys=subsys, shell_particles=shell_particles, &
892 core_particles=core_particles)
893 shell_particle_set => shell_particles%els
894 nshell =
SIZE(shell_particles%els)
896 IF (shell_adiabatic)
THEN
897 core_particle_set => core_particles%els
901 CALL allocate_tmp(md_env, tmp, nparticle, nshell, shell_adiabatic)
904 IF (shell_adiabatic)
THEN
909 CALL apply_thermostat_shells(thermostat_shell, atomic_kind_set, particle_set, &
910 local_particles, para_env, shell_particle_set=shell_particle_set, &
911 core_particle_set=core_particle_set)
913 CALL apply_thermostat_particles(thermostat_fast, force_env, molecule_kind_set, molecule_set, &
914 particle_set, local_molecules, local_particles, para_env)
916 CALL apply_thermostat_particles(thermostat_slow, force_env, molecule_kind_set, molecule_set, &
917 particle_set, local_molecules, local_particles, para_env)
920 IF (simpar%constraint)
CALL getold(gci, local_molecules, molecule_set, &
921 molecule_kind_set, particle_set, cell)
924 IF (
ASSOCIATED(force_env%meta_env))
THEN
925 IF (force_env%meta_env%langevin)
THEN
926 DO ivar = 1, force_env%meta_env%n_colvar
927 rand(ivar) = force_env%meta_env%rng(ivar)%next()
929 CALL metadyn_velocities_colvar(force_env, rand)
934 CALL vv_first(tmp, atomic_kind_set, local_particles, particle_set, &
935 core_particle_set, shell_particle_set, nparticle_kind, shell_adiabatic, dt)
937 IF (simpar%variable_dt)
CALL variable_timestep(md_env, tmp, dt, simpar, para_env, atomic_kind_set, &
938 local_particles, particle_set, core_particle_set, shell_particle_set, &
939 nparticle_kind, shell_adiabatic)
941 IF (simpar%constraint)
THEN
943 CALL shake_update_targets(gci, local_molecules, molecule_set, &
944 molecule_kind_set, dt, force_env%root_section)
946 CALL shake_control(gci, local_molecules, molecule_set, &
947 molecule_kind_set, particle_set, tmp%pos, tmp%vel, dt, simpar%shake_tol, &
948 simpar%info_constraint, simpar%lagrange_multipliers, simpar%dump_lm, &
949 cell, para_env, local_particles)
953 CALL update_dealloc_tmp(tmp, particle_set, shell_particle_set, &
954 core_particle_set, para_env, shell_adiabatic, pos=.true.)
956 IF (shell_adiabatic .AND. shell_check_distance)
THEN
957 CALL optimize_shell_core(force_env, particle_set, &
958 shell_particle_set, core_particle_set, globenv, tmp=tmp, check=.true.)
962 CALL force_env_calc_energy_force(force_env)
965 CALL metadyn_integrator(force_env, itimes, tmp%vel, rand=rand)
968 CALL vv_second(tmp, atomic_kind_set, local_particles, particle_set, &
969 core_particle_set, shell_particle_set, nparticle_kind, shell_adiabatic, dt)
971 IF (simpar%constraint)
CALL rattle_control(gci, local_molecules, molecule_set, &
972 molecule_kind_set, particle_set, tmp%vel, dt, simpar%shake_tol, &
973 simpar%info_constraint, simpar%lagrange_multipliers, simpar%dump_lm, &
974 cell, para_env, local_particles)
977 IF (shell_adiabatic)
THEN
982 CALL apply_thermostat_shells(thermostat_shell, atomic_kind_set, particle_set, &
983 local_particles, para_env, vel=tmp%vel, shell_vel=tmp%shell_vel, &
984 core_vel=tmp%core_vel)
986 CALL apply_thermostat_particles(thermostat_slow, force_env, molecule_kind_set, molecule_set, &
987 particle_set, local_molecules, local_particles, para_env, vel=tmp%vel)
989 CALL apply_thermostat_particles(thermostat_fast, force_env, molecule_kind_set, molecule_set, &
990 particle_set, local_molecules, local_particles, para_env, vel=tmp%vel)
994 CALL update_dealloc_tmp(tmp, particle_set, shell_particle_set, &
995 core_particle_set, para_env, shell_adiabatic, vel=.true.)
997 IF (
ASSOCIATED(force_env%meta_env))
THEN
998 IF (force_env%meta_env%langevin)
THEN
1004 IF (simpar%constraint)
CALL pv_constraint(gci, local_molecules, &
1005 molecule_set, molecule_kind_set, particle_set, virial, para_env)
1008 CALL virial_evaluate(atomic_kind_set, particle_set, &
1009 local_particles, virial, para_env)
1022 SUBROUTINE nvt(md_env, globenv)
1024 TYPE(md_environment_type),
POINTER :: md_env
1025 TYPE(global_environment_type),
POINTER :: globenv
1027 INTEGER :: ivar, nparticle, nparticle_kind, nshell
1028 INTEGER,
POINTER :: itimes
1029 LOGICAL :: shell_adiabatic, shell_check_distance, &
1031 REAL(kind=dp) :: dt, lambda_mix
1032 REAL(kind=dp),
DIMENSION(:),
POINTER :: rand
1033 TYPE(atomic_kind_list_type),
POINTER :: atomic_kinds
1034 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
1035 TYPE(cell_type),
POINTER :: cell
1036 TYPE(cp_subsys_type),
POINTER :: subsys
1037 TYPE(distribution_1d_type),
POINTER :: local_molecules, local_particles
1038 TYPE(force_env_type),
POINTER :: force_env
1039 TYPE(global_constraint_type),
POINTER :: gci
1040 TYPE(molecule_kind_list_type),
POINTER :: molecule_kinds
1041 TYPE(molecule_kind_type),
DIMENSION(:),
POINTER :: molecule_kind_set
1042 TYPE(molecule_list_type),
POINTER :: molecules
1043 TYPE(molecule_type),
DIMENSION(:),
POINTER :: molecule_set
1044 TYPE(mp_para_env_type),
POINTER :: para_env
1045 TYPE(particle_list_type),
POINTER :: core_particles, particles, &
1047 TYPE(particle_type),
DIMENSION(:),
POINTER :: core_particle_set, particle_set, &
1049 TYPE(qs_electrons_type),
POINTER :: electrons
1050 TYPE(simpar_type),
POINTER :: simpar
1051 TYPE(thermostat_type),
POINTER :: thermostat_coeff, thermostat_part, &
1053 TYPE(tmp_variables_type),
POINTER :: tmp
1054 TYPE(virial_type),
POINTER :: virial
1056 NULLIFY (gci, force_env, thermostat_coeff, tmp, &
1057 thermostat_part, thermostat_shell, cell, shell_particles, &
1058 shell_particle_set, core_particles, core_particle_set, rand)
1059 NULLIFY (para_env, subsys, local_molecules, local_particles, molecule_kinds, &
1060 molecules, molecule_kind_set, molecule_set, atomic_kinds, particles)
1061 NULLIFY (simpar, thermostat_coeff, thermostat_part, thermostat_shell, itimes, electrons)
1063 CALL get_md_env(md_env=md_env, simpar=simpar, force_env=force_env, &
1064 thermostat_part=thermostat_part, thermostat_coeff=thermostat_coeff, &
1065 thermostat_shell=thermostat_shell, para_env=para_env, &
1066 itimes=itimes, electrons=electrons)
1069 CALL force_env_get(force_env=force_env, subsys=subsys, cell=cell)
1072 CALL apply_qmmm_walls_reflective(force_env)
1074 CALL cp_subsys_get(subsys=subsys, atomic_kinds=atomic_kinds, local_particles=local_particles, &
1075 particles=particles, local_molecules=local_molecules, molecules=molecules, &
1076 molecule_kinds=molecule_kinds, gci=gci, virial=virial)
1078 nparticle_kind = atomic_kinds%n_els
1079 atomic_kind_set => atomic_kinds%els
1080 molecule_kind_set => molecule_kinds%els
1082 nparticle = particles%n_els
1083 particle_set => particles%els
1084 molecule_set => molecules%els
1086 CALL get_atomic_kind_set(atomic_kind_set=atomic_kind_set, &
1087 shell_present=shell_present, shell_adiabatic=shell_adiabatic, &
1088 shell_check_distance=shell_check_distance)
1090 IF (
ASSOCIATED(force_env%meta_env))
THEN
1092 IF (force_env%meta_env%langevin)
THEN
1093 ALLOCATE (rand(force_env%meta_env%n_colvar))
1099 IF (shell_present)
THEN
1100 CALL cp_subsys_get(subsys=subsys, shell_particles=shell_particles, &
1101 core_particles=core_particles)
1102 shell_particle_set => shell_particles%els
1103 nshell =
SIZE(shell_particles%els)
1105 IF (shell_adiabatic)
THEN
1106 core_particle_set => core_particles%els
1110 CALL allocate_tmp(md_env, tmp, nparticle, nshell, shell_adiabatic)
1113 IF (shell_adiabatic)
THEN
1114 CALL apply_thermostat_particles(thermostat_part, force_env, molecule_kind_set, molecule_set, &
1115 particle_set, local_molecules, local_particles, para_env, shell_adiabatic=shell_adiabatic, &
1116 shell_particle_set=shell_particle_set, core_particle_set=core_particle_set)
1118 CALL apply_thermostat_shells(thermostat_shell, atomic_kind_set, particle_set, &
1119 local_particles, para_env, shell_particle_set=shell_particle_set, &
1120 core_particle_set=core_particle_set)
1122 CALL apply_thermostat_particles(thermostat_part, force_env, molecule_kind_set, molecule_set, &
1123 particle_set, local_molecules, local_particles, para_env)
1130 IF (simpar%constraint)
CALL getold(gci, local_molecules, molecule_set, &
1131 molecule_kind_set, particle_set, cell)
1134 IF (
ASSOCIATED(force_env%meta_env))
THEN
1135 IF (force_env%meta_env%langevin)
THEN
1136 DO ivar = 1, force_env%meta_env%n_colvar
1137 rand(ivar) = force_env%meta_env%rng(ivar)%next()
1139 CALL metadyn_velocities_colvar(force_env, rand)
1144 CALL vv_first(tmp, atomic_kind_set, local_particles, particle_set, &
1145 core_particle_set, shell_particle_set, nparticle_kind, shell_adiabatic, dt)
1146 IF (
ASSOCIATED(electrons))
THEN
1156 IF (.NOT. electrons%report_only)
THEN
1157 CALL qs_electrons_kick(electrons, 0.5_dp*dt)
1158 CALL qs_electrons_drift(electrons, 0.5_dp*dt)
1159 CALL qs_electrons_thermostat_step(electrons, dt)
1160 CALL qs_electrons_drift(electrons, 0.5_dp*dt)
1161 IF (electrons%charge_mixing_enabled)
THEN
1162 CALL charge_mixing_maybe_rebuild(force_env, electrons)
1163 CALL qs_electrons_charge_mixing_lambda(electrons, lambda_mix)
1164 CALL push_lambda_to_mixed_env(force_env, lambda_mix)
1166 CALL apply_ne_core_correction(force_env, electrons%q, electrons%neutral_electrons)
1171 IF (simpar%variable_dt)
CALL variable_timestep(md_env, tmp, dt, simpar, para_env, atomic_kind_set, &
1172 local_particles, particle_set, core_particle_set, shell_particle_set, &
1173 nparticle_kind, shell_adiabatic)
1175 IF (simpar%constraint)
THEN
1177 CALL shake_update_targets(gci, local_molecules, molecule_set, &
1178 molecule_kind_set, dt, force_env%root_section)
1180 CALL shake_control(gci, local_molecules, molecule_set, &
1181 molecule_kind_set, particle_set, tmp%pos, tmp%vel, dt, simpar%shake_tol, &
1182 simpar%info_constraint, simpar%lagrange_multipliers, simpar%dump_lm, &
1183 cell, para_env, local_particles)
1187 CALL update_dealloc_tmp(tmp, particle_set, shell_particle_set, &
1188 core_particle_set, para_env, shell_adiabatic, pos=.true.)
1190 IF (shell_adiabatic .AND. shell_check_distance)
THEN
1191 CALL optimize_shell_core(force_env, particle_set, &
1192 shell_particle_set, core_particle_set, globenv, tmp=tmp, check=.true.)
1196 CALL qmmmx_update_force_env(force_env, force_env%root_section)
1201 CALL force_env_get(force_env=force_env, subsys=subsys, cell=cell)
1203 CALL cp_subsys_get(subsys=subsys, atomic_kinds=atomic_kinds, local_particles=local_particles, &
1204 particles=particles, local_molecules=local_molecules, molecules=molecules, &
1205 molecule_kinds=molecule_kinds, gci=gci, virial=virial)
1207 nparticle_kind = atomic_kinds%n_els
1208 atomic_kind_set => atomic_kinds%els
1209 molecule_kind_set => molecule_kinds%els
1211 nparticle = particles%n_els
1212 particle_set => particles%els
1213 molecule_set => molecules%els
1215 CALL get_atomic_kind_set(atomic_kind_set=atomic_kind_set, &
1216 shell_present=shell_present, shell_adiabatic=shell_adiabatic, &
1217 shell_check_distance=shell_check_distance)
1220 IF (shell_present)
THEN
1221 CALL cp_subsys_get(subsys=subsys, shell_particles=shell_particles, &
1222 core_particles=core_particles)
1223 shell_particle_set => shell_particles%els
1224 nshell =
SIZE(shell_particles%els)
1226 IF (shell_adiabatic)
THEN
1227 core_particle_set => core_particles%els
1234 CALL force_env_calc_energy_force(force_env, require_consistent_energy_force=.false.)
1236 IF (
ASSOCIATED(electrons))
THEN
1237 IF (electrons%charge_mixing_enabled)
THEN
1238 CALL compute_mixed_workfunction(force_env, electrons%potential_average_axis, &
1239 electrons%potential_average_min, electrons%potential_average_max, &
1240 electrons%q, electrons%charge_mixing_span, &
1241 electrons%current_fermi_level_eV, electrons%current_workfunction, &
1242 lambda_in=lambda_mix)
1244 CALL qs_electrons_compute_workfunction(force_env, electrons%potential_average_axis, &
1245 electrons%potential_average_min, electrons%potential_average_max, &
1246 electrons%current_fermi_level_eV, electrons%current_workfunction)
1251 CALL metadyn_integrator(force_env, itimes, tmp%vel, rand=rand)
1254 CALL vv_second(tmp, atomic_kind_set, local_particles, particle_set, &
1255 core_particle_set, shell_particle_set, nparticle_kind, shell_adiabatic, dt)
1257 IF (
ASSOCIATED(electrons))
THEN
1259 IF (.NOT. electrons%report_only)
CALL qs_electrons_kick(electrons, 0.5_dp*dt)
1262 IF (simpar%constraint)
CALL rattle_control(gci, local_molecules, molecule_set, &
1263 molecule_kind_set, particle_set, tmp%vel, dt, simpar%shake_tol, &
1264 simpar%info_constraint, simpar%lagrange_multipliers, simpar%dump_lm, &
1265 cell, para_env, local_particles)
1268 IF (shell_adiabatic)
THEN
1269 CALL apply_thermostat_particles(thermostat_part, force_env, molecule_kind_set, molecule_set, &
1270 particle_set, local_molecules, local_particles, para_env, shell_adiabatic=shell_adiabatic, &
1271 vel=tmp%vel, shell_vel=tmp%shell_vel, core_vel=tmp%core_vel)
1273 CALL apply_thermostat_shells(thermostat_shell, atomic_kind_set, particle_set, &
1274 local_particles, para_env, vel=tmp%vel, shell_vel=tmp%shell_vel, &
1275 core_vel=tmp%core_vel)
1277 CALL apply_thermostat_particles(thermostat_part, force_env, molecule_kind_set, molecule_set, &
1278 particle_set, local_molecules, local_particles, para_env, vel=tmp%vel)
1285 CALL update_dealloc_tmp(tmp, particle_set, shell_particle_set, &
1286 core_particle_set, para_env, shell_adiabatic, vel=.true.)
1288 IF (
ASSOCIATED(force_env%meta_env))
THEN
1289 IF (force_env%meta_env%langevin)
THEN
1295 IF (simpar%constraint)
CALL pv_constraint(gci, local_molecules, &
1296 molecule_set, molecule_kind_set, particle_set, virial, para_env)
1299 CALL virial_evaluate(atomic_kind_set, particle_set, &
1300 local_particles, virial, para_env)
1315 TYPE(md_environment_type),
POINTER :: md_env
1316 TYPE(global_environment_type),
POINTER :: globenv
1318 REAL(kind=dp),
PARAMETER :: e2 = 1.0_dp/6.0_dp, e4 = e2/20.0_dp, &
1319 e6 = e4/42.0_dp, e8 = e6/72.0_dp
1321 INTEGER :: iroll, ivar, nkind, nparticle, &
1322 nparticle_kind, nshell
1323 INTEGER,
POINTER :: itimes
1324 LOGICAL :: first, first_time, shell_adiabatic, &
1325 shell_check_distance, shell_present
1326 REAL(kind=dp) :: dt, infree, kin, roll_tol, roll_tol_thrs
1327 REAL(kind=dp),
DIMENSION(3) :: vector_r, vector_v
1328 REAL(kind=dp),
DIMENSION(3, 3) :: pv_kin
1329 REAL(kind=dp),
DIMENSION(:),
POINTER :: rand
1330 REAL(kind=dp),
SAVE :: eps_0
1331 TYPE(atomic_kind_list_type),
POINTER :: atomic_kinds
1332 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
1333 TYPE(cell_type),
POINTER :: cell
1334 TYPE(cp_subsys_type),
POINTER :: subsys
1335 TYPE(distribution_1d_type),
POINTER :: local_molecules, local_particles
1336 TYPE(force_env_type),
POINTER :: force_env
1337 TYPE(global_constraint_type),
POINTER :: gci
1338 TYPE(local_fixd_constraint_type),
DIMENSION(:), &
1339 POINTER :: lfixd_list
1340 TYPE(molecule_kind_list_type),
POINTER :: molecule_kinds
1341 TYPE(molecule_kind_type),
DIMENSION(:),
POINTER :: molecule_kind_set
1342 TYPE(molecule_list_type),
POINTER :: molecules
1343 TYPE(molecule_type),
DIMENSION(:),
POINTER :: molecule_set
1344 TYPE(mp_para_env_type),
POINTER :: para_env
1345 TYPE(npt_info_type),
POINTER :: npt(:, :)
1346 TYPE(old_variables_type),
POINTER :: old
1347 TYPE(particle_list_type),
POINTER :: core_particles, particles, &
1349 TYPE(particle_type),
DIMENSION(:),
POINTER :: core_particle_set, particle_set, &
1351 TYPE(simpar_type),
POINTER :: simpar
1352 TYPE(thermostat_type),
POINTER :: thermostat_baro, thermostat_part, &
1354 TYPE(tmp_variables_type),
POINTER :: tmp
1355 TYPE(virial_type),
POINTER :: virial
1357 NULLIFY (gci, thermostat_baro, thermostat_part, thermostat_shell, force_env)
1358 NULLIFY (atomic_kinds, cell, para_env, subsys, local_molecules, local_particles)
1359 NULLIFY (molecule_kinds, molecules, molecule_kind_set, npt)
1360 NULLIFY (core_particles, particles, shell_particles, tmp, old)
1361 NULLIFY (core_particle_set, particle_set, shell_particle_set)
1362 NULLIFY (simpar, virial, rand, itimes, lfixd_list)
1364 CALL get_md_env(md_env=md_env, simpar=simpar, force_env=force_env, &
1365 thermostat_part=thermostat_part, thermostat_baro=thermostat_baro, &
1366 thermostat_shell=thermostat_shell, npt=npt, first_time=first_time, &
1367 para_env=para_env, itimes=itimes)
1369 infree = 1.0_dp/real(simpar%nfree, kind=dp)
1371 CALL force_env_get(force_env=force_env, subsys=subsys, cell=cell)
1374 CALL apply_qmmm_walls_reflective(force_env)
1376 CALL cp_subsys_get(subsys=subsys, atomic_kinds=atomic_kinds, local_particles=local_particles, &
1377 particles=particles, local_molecules=local_molecules, molecules=molecules, &
1378 gci=gci, molecule_kinds=molecule_kinds, virial=virial)
1380 nparticle_kind = atomic_kinds%n_els
1381 nkind = molecule_kinds%n_els
1382 atomic_kind_set => atomic_kinds%els
1383 molecule_kind_set => molecule_kinds%els
1385 nparticle = particles%n_els
1386 particle_set => particles%els
1387 molecule_set => molecules%els
1389 CALL get_atomic_kind_set(atomic_kind_set=atomic_kind_set, &
1390 shell_present=shell_present, shell_adiabatic=shell_adiabatic, &
1391 shell_check_distance=shell_check_distance)
1393 IF (first_time)
THEN
1394 CALL virial_evaluate(atomic_kind_set, particle_set, &
1395 local_particles, virial, para_env)
1399 CALL allocate_old(old, particle_set, npt)
1401 IF (
ASSOCIATED(force_env%meta_env))
THEN
1403 IF (force_env%meta_env%langevin)
THEN
1404 ALLOCATE (rand(force_env%meta_env%n_colvar))
1409 IF (shell_present)
THEN
1410 CALL cp_subsys_get(subsys=subsys, &
1411 shell_particles=shell_particles, core_particles=core_particles)
1412 shell_particle_set => shell_particles%els
1413 nshell =
SIZE(shell_particles%els)
1414 IF (shell_adiabatic)
THEN
1415 core_particle_set => core_particles%els
1419 CALL allocate_tmp(md_env, tmp, nparticle, nshell, shell_adiabatic)
1422 IF (first_time) eps_0 = npt(1, 1)%eps
1425 CALL apply_thermostat_baro(thermostat_baro, npt, para_env)
1428 IF (simpar%ensemble /= npe_i_ensemble)
THEN
1429 IF (shell_adiabatic)
THEN
1430 CALL apply_thermostat_particles(thermostat_part, force_env, molecule_kind_set, molecule_set, &
1431 particle_set, local_molecules, local_particles, para_env, shell_adiabatic=shell_adiabatic, &
1432 shell_particle_set=shell_particle_set, core_particle_set=core_particle_set)
1435 CALL apply_thermostat_particles(thermostat_part, force_env, molecule_kind_set, molecule_set, &
1436 particle_set, local_molecules, local_particles, para_env)
1441 CALL apply_thermostat_shells(thermostat_shell, atomic_kind_set, particle_set, &
1442 local_particles, para_env, shell_particle_set=shell_particle_set, &
1443 core_particle_set=core_particle_set)
1445 IF (simpar%constraint)
THEN
1447 CALL shake_update_targets(gci, local_molecules, molecule_set, &
1448 molecule_kind_set, dt, force_env%root_section)
1452 IF (simpar%constraint)
THEN
1453 roll_tol_thrs = simpar%roll_tol
1455 CALL set(old, atomic_kind_set, particle_set, local_particles, cell, npt,
'F')
1456 CALL getold(gci, local_molecules, molecule_set, &
1457 molecule_kind_set, particle_set, cell)
1459 roll_tol_thrs = epsilon(0.0_dp)
1461 roll_tol = -roll_tol_thrs
1464 IF (
ASSOCIATED(force_env%meta_env))
THEN
1465 IF (force_env%meta_env%langevin)
THEN
1466 DO ivar = 1, force_env%meta_env%n_colvar
1467 rand(ivar) = force_env%meta_env%rng(ivar)%next()
1469 CALL metadyn_velocities_colvar(force_env, rand)
1473 sr:
DO WHILE (abs(roll_tol) >= roll_tol_thrs)
1475 IF (simpar%constraint)
THEN
1476 CALL set(old, atomic_kind_set, particle_set, local_particles, cell, npt,
'B')
1479 CALL update_pv(gci, simpar, atomic_kind_set, particle_set, &
1480 local_molecules, molecule_set, molecule_kind_set, &
1481 local_particles, kin, pv_kin, virial, para_env)
1482 CALL update_veps(cell, npt, simpar, pv_kin, kin, virial, infree)
1484 tmp%arg_r(1) = (0.5_dp*npt(1, 1)%v*dt)* &
1485 (0.5_dp*npt(1, 1)%v*dt)
1486 tmp%poly_r(1:3) = 1.0_dp + e2*tmp%arg_r(1) + e4*tmp%arg_r(1)*tmp%arg_r(1) + &
1487 e6*tmp%arg_r(1)**3 + e8*tmp%arg_r(1)**4
1489 tmp%arg_v(1) = (0.25_dp*npt(1, 1)%v*dt* &
1490 (1.0_dp + 3.0_dp*infree))*(0.25_dp*npt(1, 1)%v* &
1491 dt*(1.0_dp + 3.0_dp*infree))
1492 tmp%poly_v(1:3) = 1.0_dp + e2*tmp%arg_v(1) + e4*tmp%arg_v(1)*tmp%arg_v(1) + &
1493 e6*tmp%arg_v(1)**3 + e8*tmp%arg_v(1)**4
1495 tmp%scale_r(1:3) = exp(0.5_dp*dt*npt(1, 1)%v)
1496 tmp%scale_v(1:3) = exp(-0.25_dp*dt*npt(1, 1)%v* &
1497 (1.0_dp + 3.0_dp*infree))
1500 IF (simpar%ensemble == npt_ia_ensemble)
THEN
1501 CALL create_local_fixd_list(lfixd_list, nkind, molecule_kind_set, local_particles)
1502 CALL vv_first(tmp, atomic_kind_set, local_particles, particle_set, &
1503 core_particle_set, shell_particle_set, nparticle_kind, &
1504 shell_adiabatic, dt, lfixd_list=lfixd_list)
1505 CALL release_local_fixd_list(lfixd_list)
1507 CALL vv_first(tmp, atomic_kind_set, local_particles, particle_set, &
1508 core_particle_set, shell_particle_set, nparticle_kind, &
1509 shell_adiabatic, dt)
1512 IF (simpar%variable_dt)
CALL variable_timestep(md_env, tmp, dt, simpar, para_env, &
1513 atomic_kind_set, local_particles, particle_set, core_particle_set, &
1514 shell_particle_set, nparticle_kind, shell_adiabatic, npt=npt)
1517 vector_r(:) = tmp%scale_r(:)*tmp%poly_r(:)
1518 vector_v(:) = tmp%scale_v(:)*tmp%poly_v(:)
1520 IF (simpar%constraint)
CALL shake_roll_control(gci, local_molecules, &
1521 molecule_set, molecule_kind_set, particle_set, tmp%pos, tmp%vel, dt, simpar, &
1522 roll_tol, iroll, vector_r, vector_v, para_env, cell=cell, &
1523 local_particles=local_particles)
1527 npt(:, :)%eps = npt(:, :)%eps + dt*npt(:, :)%v
1530 cell%hmat(:, :) = cell%hmat(:, :)*exp(npt(1, 1)%eps - eps_0)
1532 eps_0 = npt(1, 1)%eps
1535 CALL init_cell(cell)
1538 CALL update_dealloc_tmp(tmp, particle_set, shell_particle_set, &
1539 core_particle_set, para_env, shell_adiabatic, pos=.true.)
1541 IF (shell_adiabatic .AND. shell_check_distance)
THEN
1542 CALL optimize_shell_core(force_env, particle_set, &
1543 shell_particle_set, core_particle_set, globenv, tmp=tmp, check=.true.)
1547 CALL force_env_calc_energy_force(force_env)
1550 CALL metadyn_integrator(force_env, itimes, tmp%vel, rand=rand)
1553 CALL vv_second(tmp, atomic_kind_set, local_particles, particle_set, &
1554 core_particle_set, shell_particle_set, nparticle_kind, &
1555 shell_adiabatic, dt)
1557 IF (simpar%constraint)
THEN
1558 roll_tol_thrs = simpar%roll_tol
1561 CALL set(old, atomic_kind_set, particle_set, tmp%vel, local_particles, cell, npt,
'F')
1563 roll_tol_thrs = epsilon(0.0_dp)
1565 roll_tol = -roll_tol_thrs
1567 rr:
DO WHILE (abs(roll_tol) >= roll_tol_thrs)
1569 IF (simpar%constraint)
CALL rattle_roll_setup(old, gci, atomic_kind_set, &
1570 particle_set, local_particles, molecule_kind_set, molecule_set, &
1571 local_molecules, tmp%vel, dt, cell, npt, simpar, virial, vector_v, &
1572 roll_tol, iroll, infree, first, para_env)
1574 CALL update_pv(gci, simpar, atomic_kind_set, tmp%vel, particle_set, &
1575 local_molecules, molecule_set, molecule_kind_set, &
1576 local_particles, kin, pv_kin, virial, para_env)
1577 CALL update_veps(cell, npt, simpar, pv_kin, kin, virial, infree)
1581 IF (simpar%ensemble /= npe_i_ensemble)
THEN
1582 IF (shell_adiabatic)
THEN
1583 CALL apply_thermostat_particles(thermostat_part, force_env, molecule_kind_set, molecule_set, &
1584 particle_set, local_molecules, local_particles, para_env, shell_adiabatic=shell_adiabatic, &
1585 vel=tmp%vel, shell_vel=tmp%shell_vel, core_vel=tmp%core_vel)
1587 CALL apply_thermostat_particles(thermostat_part, force_env, molecule_kind_set, molecule_set, &
1588 particle_set, local_molecules, local_particles, para_env, vel=tmp%vel)
1593 IF (
ASSOCIATED(thermostat_shell))
THEN
1594 CALL apply_thermostat_shells(thermostat_shell, atomic_kind_set, particle_set, &
1595 local_particles, para_env, vel=tmp%vel, shell_vel=tmp%shell_vel, &
1596 core_vel=tmp%core_vel)
1600 CALL apply_thermostat_baro(thermostat_baro, npt, para_env)
1603 IF (simpar%ensemble == npe_i_ensemble .AND. simpar%annealing)
THEN
1604 tmp%vel(:, :) = tmp%vel(:, :)*simpar%f_annealing
1605 IF (shell_adiabatic)
THEN
1606 CALL shell_scale_comv(atomic_kind_set, local_particles, particle_set, &
1607 tmp%vel, tmp%shell_vel, tmp%core_vel)
1611 IF (simpar%ensemble == npe_i_ensemble .AND. simpar%annealing_cell)
THEN
1612 npt(1, 1)%v = npt(1, 1)%v*simpar%f_annealing_cell
1616 CALL update_dealloc_tmp(tmp, particle_set, shell_particle_set, &
1617 core_particle_set, para_env, shell_adiabatic, vel=.true.)
1620 IF (simpar%constraint)
CALL pv_constraint(gci, local_molecules, &
1621 molecule_set, molecule_kind_set, particle_set, virial, para_env)
1623 CALL virial_evaluate(atomic_kind_set, particle_set, &
1624 local_particles, virial, para_env)
1627 CALL deallocate_old(old)
1629 IF (
ASSOCIATED(force_env%meta_env))
THEN
1630 IF (force_env%meta_env%langevin)
THEN
1635 IF (first_time)
THEN
1636 first_time = .false.
1637 CALL set_md_env(md_env, first_time=first_time)
1640 END SUBROUTINE npt_i
1652 TYPE(md_environment_type),
POINTER :: md_env
1654 CHARACTER(LEN=2) :: element_kind_ref0, element_symbol, &
1656 CHARACTER(LEN=max_line_length) :: errmsg
1657 INTEGER :: cell_itimes, i, nparticle, nread, &
1659 INTEGER,
POINTER :: itimes
1660 LOGICAL :: init, my_end, traj_has_cell_info
1661 REAL(kind=dp) :: cell_time, h(3, 3), trj_epot, trj_time, &
1663 REAL(kind=dp),
POINTER :: time
1664 TYPE(cell_type),
POINTER :: cell
1665 TYPE(cp_logger_type),
POINTER :: logger
1666 TYPE(cp_subsys_type),
POINTER :: subsys
1667 TYPE(force_env_type),
POINTER :: force_env
1668 TYPE(mp_para_env_type),
POINTER :: para_env
1669 TYPE(particle_list_type),
POINTER :: particles
1670 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
1671 TYPE(reftraj_type),
POINTER :: reftraj_env
1672 TYPE(simpar_type),
POINTER :: simpar
1674 NULLIFY (reftraj_env, particle_set, particles, force_env, subsys, simpar, para_env, cell, logger, itimes, time)
1675 CALL get_md_env(md_env=md_env, init=init,
reftraj=reftraj_env, force_env=force_env, &
1676 para_env=para_env, simpar=simpar)
1677 logger => cp_get_default_logger()
1679 CALL force_env_get(force_env=force_env, cell=cell, subsys=subsys)
1680 reftraj_env%isnap = reftraj_env%isnap + reftraj_env%info%stride
1683 CALL apply_qmmm_walls_reflective(force_env)
1684 CALL cp_subsys_get(subsys=subsys, particles=particles)
1685 nparticle = particles%n_els
1686 particle_set => particles%els
1690 CALL parser_read_line(reftraj_env%info%traj_parser, 1)
1691 READ (reftraj_env%info%traj_parser%input_line, fmt=
"(I8)") nread
1692 CALL parser_read_line(reftraj_env%info%traj_parser, 1)
1695 CALL read_xyz_comment(reftraj_env%info%traj_parser%input_line, cell, &
1696 traj_has_cell_info, trj_itimes, trj_time, trj_epot)
1697 IF (trj_itimes == huge(0))
THEN
1698 CALL get_md_env(md_env, itimes=itimes)
1701 IF (trj_time == huge(0.0_dp)) trj_time = 0.0_dp
1702 IF (trj_epot == huge(0.0_dp)) trj_epot = 0.0_dp
1738 IF (nread /= nparticle)
THEN
1739 errmsg =
"Number of atoms for step "//trim(adjustl(cp_to_string(trj_itimes)))// &
1740 " in the trajectory file does not match the reference configuration: "// &
1741 trim(adjustl(cp_to_string(nread)))//
" != "//trim(adjustl(cp_to_string(nparticle)))
1745 CALL parser_read_line(reftraj_env%info%traj_parser, 1)
1746 READ (unit=reftraj_env%info%traj_parser%input_line(1:len_trim(reftraj_env%info%traj_parser%input_line)), fmt=*) &
1747 element_symbol, particle_set(i)%r
1748 CALL uppercase(element_symbol)
1749 element_symbol_ref0 = particle_set(i)%atomic_kind%element_symbol
1750 element_kind_ref0 = particle_set(i)%atomic_kind%name(1:2)
1751 CALL uppercase(element_symbol_ref0)
1752 CALL uppercase(element_kind_ref0)
1753 IF (element_symbol /= element_symbol_ref0)
THEN
1755 IF (element_symbol /= element_kind_ref0)
THEN
1756 errmsg =
"Atomic configuration from trajectory file does not match the reference configuration: "// &
1757 "Check atom "//trim(adjustl(cp_to_string(i)))//
" of step "// &
1758 trim(adjustl(cp_to_string(trj_itimes)))//
". Found trajectory label '"// &
1759 trim(element_symbol)//
"', expected element '"//trim(element_symbol_ref0)// &
1760 "' or kind label '"//trim(element_kind_ref0)// &
1761 "'. REFTRAJ trajectories usually contain element labels; check whether the "// &
1762 "trajectory was modified to contain kind aliases instead."
1766 particle_set(i)%r(1) = cp_unit_to_cp2k(particle_set(i)%r(1),
"angstrom")
1767 particle_set(i)%r(2) = cp_unit_to_cp2k(particle_set(i)%r(2),
"angstrom")
1768 particle_set(i)%r(3) = cp_unit_to_cp2k(particle_set(i)%r(3),
"angstrom")
1773 CALL parser_read_line(reftraj_env%info%traj_parser, 1, at_end=my_end)
1774 READ (unit=reftraj_env%info%traj_parser%input_line, fmt=*) element_symbol, particle_set(i)%r
1775 CALL uppercase(element_symbol)
1776 element_symbol_ref0 = particle_set(i)%atomic_kind%element_symbol
1777 element_kind_ref0 = particle_set(i)%atomic_kind%name(1:2)
1778 CALL uppercase(element_symbol_ref0)
1779 CALL uppercase(element_kind_ref0)
1780 IF (element_symbol /= element_symbol_ref0)
THEN
1782 IF (element_symbol /= element_kind_ref0)
THEN
1783 errmsg =
"Atomic configuration from trajectory file does not match the reference configuration: "// &
1784 "Check atom "//trim(adjustl(cp_to_string(i)))//
" of step "// &
1785 trim(adjustl(cp_to_string(trj_itimes)))//
". Found trajectory label '"// &
1786 trim(element_symbol)//
"', expected element '"//trim(element_symbol_ref0)// &
1787 "' or kind label '"//trim(element_kind_ref0)// &
1788 "'. REFTRAJ trajectories usually contain element labels; check whether the "// &
1789 "trajectory was modified to contain kind aliases instead."
1793 particle_set(i)%r(1) = cp_unit_to_cp2k(particle_set(i)%r(1),
"angstrom")
1794 particle_set(i)%r(2) = cp_unit_to_cp2k(particle_set(i)%r(2),
"angstrom")
1795 particle_set(i)%r(3) = cp_unit_to_cp2k(particle_set(i)%r(3),
"angstrom")
1799 IF (reftraj_env%isnap /= (simpar%nsteps - 1))
THEN
1800 CALL cp_abort(__location__, &
1801 "Reached the end of the Trajectory frames in the TRAJECTORY file. Number of "// &
1802 "missing frames ("//cp_to_string((simpar%nsteps - 1) - reftraj_env%isnap)//
").")
1807 IF (reftraj_env%info%variable_volume .AND. (.NOT. traj_has_cell_info))
THEN
1808 CALL parser_get_next_line(reftraj_env%info%cell_parser, 1, at_end=my_end)
1809 CALL parse_cell_line(reftraj_env%info%cell_parser%input_line, cell_itimes, cell_time, h, vol)
1810 cpassert(trj_itimes == cell_itimes)
1813 IF (reftraj_env%isnap /= (simpar%nsteps - 1))
THEN
1814 CALL cp_abort(__location__, &
1815 "Reached the end of the cell info frames in the CELL file. Number of "// &
1816 "missing frames ("//cp_to_string((simpar%nsteps - 1) - reftraj_env%isnap)//
").")
1822 reftraj_env%time0 = trj_time
1823 reftraj_env%epot0 = trj_epot
1824 reftraj_env%itimes0 = trj_itimes
1827 IF (trj_itimes /= 0.0_dp .AND. trj_time /= 0.0_dp) simpar%dt = (trj_time/femtoseconds)/real(trj_itimes, kind=dp)
1829 reftraj_env%epot = trj_epot
1830 reftraj_env%itimes = trj_itimes
1831 reftraj_env%time = trj_time/femtoseconds
1832 CALL get_md_env(md_env, itimes=itimes, t=time)
1833 itimes = reftraj_env%itimes
1834 time = reftraj_env%time
1835 CALL cp_iterate(logger%iter_info, &
1836 last=logger%iter_info%last_iter(logger%iter_info%n_rlevel), &
1837 iter_nr=reftraj_env%itimes)
1839 IF (traj_has_cell_info)
THEN
1840 CALL init_cell(cell)
1841 ELSE IF (reftraj_env%info%variable_volume)
THEN
1843 CALL init_cell(cell)
1847 SELECT CASE (reftraj_env%info%wrap)
1848 CASE (reftraj_wrap_none)
1850 CASE (reftraj_wrap_positive)
1853 particle_set(i)%r(1:3) = pbc(particle_set(i)%r(1:3), cell, positive_range=.true.)
1855 CASE (reftraj_wrap_central)
1858 particle_set(i)%r(1:3) = pbc(particle_set(i)%r(1:3), cell)
1862 cpabort(
"Option invalid or unavailable for reftraj_env%info%wrap")
1866 CALL qmmmx_update_force_env(force_env, force_env%root_section)
1872 CALL force_env_calc_energy_force(force_env, &
1873 calc_force=(reftraj_env%info%eval == reftraj_eval_energy_forces), &
1874 eval_energy_forces=(reftraj_env%info%eval /= reftraj_eval_none), &
1875 require_consistent_energy_force=.false.)
1878 CALL metadyn_integrator(force_env, trj_itimes)
1881 IF (reftraj_env%info%msd)
THEN
1882 CALL compute_msd_reftraj(reftraj_env, md_env, particle_set)
1886 CALL parser_get_next_line(reftraj_env%info%traj_parser, (reftraj_env%info%stride - 1)*(nparticle + 2))
1887 IF (reftraj_env%info%variable_volume)
THEN
1888 CALL parser_get_next_line(reftraj_env%info%cell_parser, (reftraj_env%info%stride - 1))
1905 TYPE(md_environment_type),
POINTER :: md_env
1907 REAL(dp),
PARAMETER :: e2 = 1._dp/6._dp, e4 = e2/20._dp, &
1908 e6 = e4/42._dp, e8 = e6/72._dp
1910 INTEGER :: iroll, nparticle, nparticle_kind, nshell
1911 INTEGER,
POINTER :: itimes
1912 LOGICAL :: first, first_time, shell_adiabatic, &
1914 REAL(kind=dp) :: dt, infree, kin, roll_tol, roll_tol_thrs
1915 REAL(kind=dp),
DIMENSION(3) :: vector_r, vector_v
1916 REAL(kind=dp),
DIMENSION(3, 3) :: pv_kin
1917 TYPE(atomic_kind_list_type),
POINTER :: atomic_kinds
1918 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
1919 TYPE(cell_type),
POINTER :: cell
1920 TYPE(cp_subsys_type),
POINTER :: subsys
1921 TYPE(distribution_1d_type),
POINTER :: local_molecules, local_particles
1922 TYPE(force_env_type),
POINTER :: force_env
1923 TYPE(global_constraint_type),
POINTER :: gci
1924 TYPE(molecule_kind_list_type),
POINTER :: molecule_kinds
1925 TYPE(molecule_kind_type),
DIMENSION(:),
POINTER :: molecule_kind_set
1926 TYPE(molecule_list_type),
POINTER :: molecules
1927 TYPE(molecule_type),
DIMENSION(:),
POINTER :: molecule_set
1928 TYPE(mp_para_env_type),
POINTER :: para_env
1929 TYPE(npt_info_type),
POINTER :: npt(:, :)
1930 TYPE(old_variables_type),
POINTER :: old
1931 TYPE(particle_list_type),
POINTER :: core_particles, particles, &
1933 TYPE(particle_type),
DIMENSION(:),
POINTER :: core_particle_set, particle_set, &
1935 TYPE(simpar_type),
POINTER :: simpar
1936 TYPE(tmp_variables_type),
POINTER :: tmp
1937 TYPE(virial_type),
POINTER :: virial
1939 NULLIFY (gci, force_env)
1940 NULLIFY (atomic_kinds, cell, para_env, subsys, local_molecules, local_particles)
1941 NULLIFY (molecule_kinds, molecules, molecule_kind_set, npt)
1942 NULLIFY (core_particles, particles, shell_particles, tmp, old)
1943 NULLIFY (core_particle_set, particle_set, shell_particle_set)
1944 NULLIFY (simpar, virial, itimes)
1946 CALL get_md_env(md_env=md_env, simpar=simpar, force_env=force_env, npt=npt, &
1947 first_time=first_time, para_env=para_env, itimes=itimes)
1949 infree = 1.0_dp/real(simpar%nfree, dp)
1951 CALL force_env_get(force_env, subsys=subsys, cell=cell)
1954 CALL apply_qmmm_walls_reflective(force_env)
1956 CALL cp_subsys_get(subsys=subsys, atomic_kinds=atomic_kinds, local_particles=local_particles, &
1957 particles=particles, local_molecules=local_molecules, molecules=molecules, gci=gci, &
1958 molecule_kinds=molecule_kinds, virial=virial)
1960 nparticle_kind = atomic_kinds%n_els
1961 atomic_kind_set => atomic_kinds%els
1962 molecule_kind_set => molecule_kinds%els
1964 nparticle = particles%n_els
1965 particle_set => particles%els
1966 molecule_set => molecules%els
1968 IF (first_time)
THEN
1969 CALL virial_evaluate(atomic_kind_set, particle_set, &
1970 local_particles, virial, para_env)
1973 CALL get_atomic_kind_set(atomic_kind_set=atomic_kind_set, &
1974 shell_present=shell_present, shell_adiabatic=shell_adiabatic)
1977 CALL allocate_old(old, particle_set, npt)
1979 IF (shell_present)
THEN
1980 CALL cp_subsys_get(subsys=subsys, &
1981 shell_particles=shell_particles, core_particles=core_particles)
1982 shell_particle_set => shell_particles%els
1983 nshell =
SIZE(shell_particles%els)
1984 IF (shell_adiabatic)
THEN
1985 core_particle_set => core_particles%els
1989 CALL allocate_tmp(md_env, tmp, nparticle, nshell, shell_adiabatic)
1991 IF (simpar%constraint)
THEN
1993 CALL shake_update_targets(gci, local_molecules, molecule_set, &
1994 molecule_kind_set, dt, force_env%root_section)
1998 IF (simpar%constraint)
THEN
1999 roll_tol_thrs = simpar%roll_tol
2001 CALL set(old, atomic_kind_set, particle_set, local_particles, cell, npt,
'F')
2002 CALL getold(gci, local_molecules, molecule_set, &
2003 molecule_kind_set, particle_set, cell)
2005 roll_tol_thrs = epsilon(0.0_dp)
2007 roll_tol = -roll_tol_thrs
2009 sr:
DO WHILE (abs(roll_tol) >= roll_tol_thrs)
2011 IF (simpar%constraint)
THEN
2012 CALL set(old, atomic_kind_set, particle_set, local_particles, cell, npt,
'B')
2014 CALL update_pv(gci, simpar, atomic_kind_set, particle_set, &
2015 local_molecules, molecule_set, molecule_kind_set, &
2016 local_particles, kin, pv_kin, virial, para_env)
2017 CALL update_veps(cell, npt, simpar, pv_kin, kin, virial, infree)
2019 tmp%arg_r(1) = (0.5_dp*npt(1, 1)%v*dt)* &
2020 (0.5_dp*npt(1, 1)%v*dt)
2021 tmp%poly_r(1) = 1._dp + e2*tmp%arg_r(1) + e4*tmp%arg_r(1)*tmp%arg_r(1) + &
2022 e6*tmp%arg_r(1)**3 + e8*tmp%arg_r(1)**4
2023 tmp%poly_r(2) = 1.0_dp
2024 tmp%poly_r(3) = 1.0_dp
2026 tmp%arg_v(1) = (0.25_dp*npt(1, 1)%v*dt* &
2027 (1._dp + infree))*(0.25_dp*npt(1, 1)%v* &
2028 dt*(1._dp + infree))
2029 tmp%arg_v(2) = (0.25_dp*npt(1, 1)%v*dt*infree)* &
2030 (0.25_dp*npt(1, 1)%v*dt*infree)
2031 tmp%poly_v(1) = 1._dp + e2*tmp%arg_v(1) + e4*tmp%arg_v(1)*tmp%arg_v(1) + &
2032 e6*tmp%arg_v(1)**3 + e8*tmp%arg_v(1)**4
2033 tmp%poly_v(2) = 1._dp + e2*tmp%arg_v(2) + e4*tmp%arg_v(2)*tmp%arg_v(2) + &
2034 e6*tmp%arg_v(2)**3 + e8*tmp%arg_v(2)**4
2035 tmp%poly_v(3) = 1._dp + e2*tmp%arg_v(2) + e4*tmp%arg_v(2)*tmp%arg_v(2) + &
2036 e6*tmp%arg_v(2)**3 + e8*tmp%arg_v(2)**4
2038 tmp%scale_r(1) = exp(0.5_dp*dt*npt(1, 1)%v)
2039 tmp%scale_r(2) = 1.0_dp
2040 tmp%scale_r(3) = 1.0_dp
2042 tmp%scale_v(1) = exp(-0.25_dp*dt*npt(1, 1)%v* &
2044 tmp%scale_v(2) = exp(-0.25_dp*dt*npt(1, 1)%v*infree)
2045 tmp%scale_v(3) = exp(-0.25_dp*dt*npt(1, 1)%v*infree)
2048 CALL vv_first(tmp, atomic_kind_set, local_particles, particle_set, &
2049 core_particle_set, shell_particle_set, nparticle_kind, &
2050 shell_adiabatic, dt)
2052 IF (simpar%variable_dt)
CALL variable_timestep(md_env, tmp, dt, simpar, para_env, &
2053 atomic_kind_set, local_particles, particle_set, core_particle_set, &
2054 shell_particle_set, nparticle_kind, shell_adiabatic, npt=npt)
2058 vector_v(:) = tmp%scale_v(:)*tmp%poly_v(:)
2059 vector_r(1) = tmp%scale_r(1)*tmp%poly_r(1)
2061 IF (simpar%constraint)
CALL shake_roll_control(gci, local_molecules, &
2062 molecule_set, molecule_kind_set, particle_set, tmp%pos, tmp%vel, dt, simpar, &
2063 roll_tol, iroll, vector_r, vector_v, para_env, cell=cell, &
2064 local_particles=local_particles)
2068 cell%hmat(1, 1) = cell%hmat(1, 1)*tmp%scale_r(1)*tmp%scale_r(1)
2071 CALL init_cell(cell)
2074 CALL update_dealloc_tmp(tmp, particle_set, shell_particle_set, &
2075 core_particle_set, para_env, shell_adiabatic, pos=.true.)
2078 CALL force_env_calc_energy_force(force_env)
2081 CALL metadyn_integrator(force_env, itimes, tmp%vel)
2084 CALL vv_second(tmp, atomic_kind_set, local_particles, particle_set, &
2085 core_particle_set, shell_particle_set, nparticle_kind, &
2086 shell_adiabatic, dt)
2088 IF (simpar%constraint)
THEN
2089 roll_tol_thrs = simpar%roll_tol
2092 CALL set(old, atomic_kind_set, particle_set, tmp%vel, local_particles, cell, npt,
'F')
2094 roll_tol_thrs = epsilon(0.0_dp)
2096 roll_tol = -roll_tol_thrs
2098 rr:
DO WHILE (abs(roll_tol) >= roll_tol_thrs)
2100 IF (simpar%constraint)
CALL rattle_roll_setup(old, gci, atomic_kind_set, &
2101 particle_set, local_particles, molecule_kind_set, molecule_set, &
2102 local_molecules, tmp%vel, dt, cell, npt, simpar, virial, vector_v, &
2103 roll_tol, iroll, infree, first, para_env)
2105 CALL update_pv(gci, simpar, atomic_kind_set, tmp%vel, particle_set, &
2106 local_molecules, molecule_set, molecule_kind_set, &
2107 local_particles, kin, pv_kin, virial, para_env)
2108 CALL update_veps(cell, npt, simpar, pv_kin, kin, virial, infree)
2111 IF (simpar%annealing) tmp%vel(:, :) = tmp%vel(:, :)*simpar%f_annealing
2114 CALL update_dealloc_tmp(tmp, particle_set, shell_particle_set, &
2115 core_particle_set, para_env, shell_adiabatic, vel=.true.)
2118 IF (simpar%constraint)
CALL pv_constraint(gci, local_molecules, &
2119 molecule_set, molecule_kind_set, particle_set, virial, para_env)
2121 CALL virial_evaluate(atomic_kind_set, particle_set, &
2122 local_particles, virial, para_env)
2125 CALL deallocate_old(old)
2127 IF (first_time)
THEN
2128 first_time = .false.
2129 CALL set_md_env(md_env, first_time=first_time)
2148 TYPE(md_environment_type),
POINTER :: md_env
2150 REAL(dp),
PARAMETER :: e2 = 1._dp/6._dp, e4 = e2/20._dp, &
2151 e6 = e4/42._dp, e8 = e6/72._dp
2153 INTEGER :: iroll, nparticle, nparticle_kind, nshell
2154 INTEGER,
POINTER :: itimes
2155 LOGICAL :: first, first_time, shell_adiabatic, &
2157 REAL(kind=dp) :: aa, aax, dt, gamma1, infree, kin, &
2158 roll_tol, roll_tol_thrs
2159 REAL(kind=dp),
DIMENSION(3) :: vector_r, vector_v
2160 REAL(kind=dp),
DIMENSION(3, 3) :: pv_kin
2161 TYPE(atomic_kind_list_type),
POINTER :: atomic_kinds
2162 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
2163 TYPE(cell_type),
POINTER :: cell
2164 TYPE(cp_subsys_type),
POINTER :: subsys
2165 TYPE(distribution_1d_type),
POINTER :: local_molecules, local_particles
2166 TYPE(force_env_type),
POINTER :: force_env
2167 TYPE(global_constraint_type),
POINTER :: gci
2168 TYPE(molecule_kind_list_type),
POINTER :: molecule_kinds
2169 TYPE(molecule_kind_type),
DIMENSION(:),
POINTER :: molecule_kind_set
2170 TYPE(molecule_list_type),
POINTER :: molecules
2171 TYPE(molecule_type),
DIMENSION(:),
POINTER :: molecule_set
2172 TYPE(mp_para_env_type),
POINTER :: para_env
2173 TYPE(npt_info_type),
POINTER :: npt(:, :)
2174 TYPE(old_variables_type),
POINTER :: old
2175 TYPE(particle_list_type),
POINTER :: core_particles, particles, &
2177 TYPE(particle_type),
DIMENSION(:),
POINTER :: core_particle_set, particle_set, &
2179 TYPE(simpar_type),
POINTER :: simpar
2180 TYPE(tmp_variables_type),
POINTER :: tmp
2181 TYPE(virial_type),
POINTER :: virial
2183 NULLIFY (gci, force_env)
2184 NULLIFY (atomic_kinds, cell, para_env, subsys, local_molecules, local_particles)
2185 NULLIFY (molecule_kinds, molecules, molecule_kind_set, npt)
2186 NULLIFY (core_particles, particles, shell_particles, tmp, old)
2187 NULLIFY (core_particle_set, particle_set, shell_particle_set)
2188 NULLIFY (simpar, virial, itimes)
2190 CALL get_md_env(md_env=md_env, simpar=simpar, force_env=force_env, npt=npt, &
2191 first_time=first_time, para_env=para_env, itimes=itimes)
2193 infree = 1.0_dp/real(simpar%nfree, dp)
2194 gamma1 = simpar%gamma_nph
2196 CALL force_env_get(force_env, subsys=subsys, cell=cell)
2198 CALL cp_subsys_get(subsys=subsys, atomic_kinds=atomic_kinds, local_particles=local_particles, &
2199 particles=particles, local_molecules=local_molecules, molecules=molecules, gci=gci, &
2200 molecule_kinds=molecule_kinds, virial=virial)
2202 nparticle_kind = atomic_kinds%n_els
2203 atomic_kind_set => atomic_kinds%els
2204 molecule_kind_set => molecule_kinds%els
2206 nparticle = particles%n_els
2207 particle_set => particles%els
2208 molecule_set => molecules%els
2210 IF (first_time)
THEN
2211 CALL virial_evaluate(atomic_kind_set, particle_set, &
2212 local_particles, virial, para_env)
2215 CALL get_atomic_kind_set(atomic_kind_set=atomic_kind_set, &
2216 shell_present=shell_present, shell_adiabatic=shell_adiabatic)
2219 CALL allocate_old(old, particle_set, npt)
2221 IF (shell_present)
THEN
2222 CALL cp_subsys_get(subsys=subsys, &
2223 shell_particles=shell_particles, core_particles=core_particles)
2224 shell_particle_set => shell_particles%els
2225 nshell =
SIZE(shell_particles%els)
2226 IF (shell_adiabatic)
THEN
2227 core_particle_set => core_particles%els
2231 CALL allocate_tmp(md_env, tmp, nparticle, nshell, shell_adiabatic)
2234 CALL damp_v(molecule_kind_set, molecule_set, particle_set, local_molecules, &
2235 gamma1, npt(1, 1), dt, para_env)
2237 IF (simpar%constraint)
THEN
2239 CALL shake_update_targets(gci, local_molecules, molecule_set, &
2240 molecule_kind_set, dt, force_env%root_section)
2244 IF (simpar%constraint)
THEN
2245 roll_tol_thrs = simpar%roll_tol
2247 CALL set(old, atomic_kind_set, particle_set, local_particles, cell, npt,
'F')
2248 CALL getold(gci, local_molecules, molecule_set, &
2249 molecule_kind_set, particle_set, cell)
2251 roll_tol_thrs = epsilon(0.0_dp)
2253 roll_tol = -roll_tol_thrs
2255 sr:
DO WHILE (abs(roll_tol) >= roll_tol_thrs)
2258 CALL damp_veps(npt(1, 1), gamma1, dt)
2260 IF (simpar%constraint)
THEN
2261 CALL set(old, atomic_kind_set, particle_set, local_particles, cell, npt,
'B')
2263 CALL update_pv(gci, simpar, atomic_kind_set, particle_set, &
2264 local_molecules, molecule_set, molecule_kind_set, &
2265 local_particles, kin, pv_kin, virial, para_env)
2266 CALL update_veps(cell, npt, simpar, pv_kin, kin, virial, infree)
2269 CALL damp_veps(npt(1, 1), gamma1, dt)
2271 tmp%arg_r(1) = (0.5_dp*npt(1, 1)%v*dt)* &
2272 (0.5_dp*npt(1, 1)%v*dt)
2273 tmp%poly_r(1) = 1._dp + e2*tmp%arg_r(1) + e4*tmp%arg_r(1)*tmp%arg_r(1) + &
2274 e6*tmp%arg_r(1)**3 + e8*tmp%arg_r(1)**4
2276 aax = npt(1, 1)%v*(1.0_dp + infree)
2277 tmp%arg_v(1) = (0.25_dp*dt*aax)*(0.25_dp*dt*aax)
2278 tmp%poly_v(1) = 1._dp + e2*tmp%arg_v(1) + e4*tmp%arg_v(1)*tmp%arg_v(1) + &
2279 e6*tmp%arg_v(1)**3 + e8*tmp%arg_v(1)**4
2281 aa = npt(1, 1)%v*infree
2282 tmp%arg_v(2) = (0.25_dp*dt*aa)*(0.25_dp*dt*aa)
2283 tmp%poly_v(2) = 1._dp + e2*tmp%arg_v(2) + e4*tmp%arg_v(2)*tmp%arg_v(2) + &
2284 e6*tmp%arg_v(2)**3 + e8*tmp%arg_v(2)**4
2285 tmp%poly_v(3) = 1._dp + e2*tmp%arg_v(2) + e4*tmp%arg_v(2)*tmp%arg_v(2) + &
2286 e6*tmp%arg_v(2)**3 + e8*tmp%arg_v(2)**4
2288 tmp%scale_r(1) = exp(0.5_dp*dt*npt(1, 1)%v)
2289 tmp%scale_v(1) = exp(-0.25_dp*dt*aax)
2290 tmp%scale_v(2) = exp(-0.25_dp*dt*aa)
2291 tmp%scale_v(3) = exp(-0.25_dp*dt*aa)
2294 CALL vv_first(tmp, atomic_kind_set, local_particles, particle_set, &
2295 core_particle_set, shell_particle_set, nparticle_kind, &
2296 shell_adiabatic, dt)
2298 IF (simpar%variable_dt)
CALL variable_timestep(md_env, tmp, dt, simpar, para_env, &
2299 atomic_kind_set, local_particles, particle_set, core_particle_set, &
2300 shell_particle_set, nparticle_kind, shell_adiabatic, npt=npt)
2304 vector_v(:) = tmp%scale_v(:)*tmp%poly_v(:)
2305 vector_r(1) = tmp%scale_r(1)*tmp%poly_r(1)
2307 IF (simpar%constraint)
CALL shake_roll_control(gci, local_molecules, &
2308 molecule_set, molecule_kind_set, particle_set, tmp%pos, tmp%vel, dt, simpar, &
2309 roll_tol, iroll, vector_r, vector_v, para_env, cell=cell, &
2310 local_particles=local_particles)
2314 cell%hmat(1, 1) = cell%hmat(1, 1)*tmp%scale_r(1)*tmp%scale_r(1)
2317 CALL init_cell(cell)
2320 CALL update_dealloc_tmp(tmp, particle_set, shell_particle_set, &
2321 core_particle_set, para_env, shell_adiabatic, pos=.true.)
2324 CALL force_env_calc_energy_force(force_env)
2327 CALL metadyn_integrator(force_env, itimes, tmp%vel)
2330 CALL vv_second(tmp, atomic_kind_set, local_particles, particle_set, &
2331 core_particle_set, shell_particle_set, nparticle_kind, &
2332 shell_adiabatic, dt)
2334 IF (simpar%constraint)
THEN
2335 roll_tol_thrs = simpar%roll_tol
2338 CALL set(old, atomic_kind_set, particle_set, tmp%vel, local_particles, cell, npt,
'F')
2340 roll_tol_thrs = epsilon(0.0_dp)
2342 roll_tol = -roll_tol_thrs
2344 rr:
DO WHILE (abs(roll_tol) >= roll_tol_thrs)
2346 IF (simpar%constraint)
CALL rattle_roll_setup(old, gci, atomic_kind_set, &
2347 particle_set, local_particles, molecule_kind_set, molecule_set, local_molecules, &
2348 tmp%vel, dt, cell, npt, simpar, virial, vector_v, roll_tol, iroll, infree, first, &
2351 CALL damp_veps(npt(1, 1), gamma1, dt)
2353 CALL update_pv(gci, simpar, atomic_kind_set, tmp%vel, particle_set, &
2354 local_molecules, molecule_set, molecule_kind_set, &
2355 local_particles, kin, pv_kin, virial, para_env)
2356 CALL update_veps(cell, npt, simpar, pv_kin, kin, virial, infree)
2359 CALL damp_veps(npt(1, 1), gamma1, dt)
2364 CALL damp_v(molecule_kind_set, molecule_set, particle_set, local_molecules, &
2365 tmp%vel, gamma1, npt(1, 1), dt, para_env)
2367 IF (simpar%annealing) tmp%vel(:, :) = tmp%vel(:, :)*simpar%f_annealing
2370 CALL update_dealloc_tmp(tmp, particle_set, shell_particle_set, &
2371 core_particle_set, para_env, shell_adiabatic, vel=.true.)
2374 IF (simpar%constraint)
CALL pv_constraint(gci, local_molecules, &
2375 molecule_set, molecule_kind_set, particle_set, virial, para_env)
2377 CALL virial_evaluate(atomic_kind_set, particle_set, &
2378 local_particles, virial, para_env)
2381 CALL deallocate_old(old)
2383 IF (first_time)
THEN
2384 first_time = .false.
2385 CALL set_md_env(md_env, first_time=first_time)
2400 TYPE(md_environment_type),
POINTER :: md_env
2401 TYPE(global_environment_type),
POINTER :: globenv
2403 REAL(kind=dp),
PARAMETER :: e2 = 1.0_dp/6.0_dp, e4 = e2/20.0_dp, &
2404 e6 = e4/42.0_dp, e8 = e6/72.0_dp
2406 INTEGER :: i, iroll, j, nparticle, nparticle_kind, &
2408 INTEGER,
POINTER :: itimes
2409 LOGICAL :: first, first_time, shell_adiabatic, &
2410 shell_check_distance, shell_present
2411 REAL(kind=dp) :: dt, infree, kin, roll_tol, &
2413 REAL(kind=dp),
DIMENSION(3) :: vector_r, vector_v
2414 REAL(kind=dp),
DIMENSION(3, 3) :: pv_kin, uh
2415 TYPE(atomic_kind_list_type),
POINTER :: atomic_kinds
2416 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
2417 TYPE(barostat_type),
POINTER :: barostat
2418 TYPE(cell_type),
POINTER :: cell
2419 TYPE(cp_subsys_type),
POINTER :: subsys
2420 TYPE(distribution_1d_type),
POINTER :: local_molecules, local_particles
2421 TYPE(force_env_type),
POINTER :: force_env
2422 TYPE(global_constraint_type),
POINTER :: gci
2423 TYPE(molecule_kind_list_type),
POINTER :: molecule_kinds
2424 TYPE(molecule_kind_type),
DIMENSION(:),
POINTER :: molecule_kind_set
2425 TYPE(molecule_list_type),
POINTER :: molecules
2426 TYPE(molecule_type),
DIMENSION(:),
POINTER :: molecule_set
2427 TYPE(mp_para_env_type),
POINTER :: para_env
2428 TYPE(npt_info_type),
POINTER :: npt(:, :)
2429 TYPE(old_variables_type),
POINTER :: old
2430 TYPE(particle_list_type),
POINTER :: core_particles, particles, &
2432 TYPE(particle_type),
DIMENSION(:),
POINTER :: core_particle_set, particle_set, &
2434 TYPE(simpar_type),
POINTER :: simpar
2435 TYPE(thermostat_type),
POINTER :: thermostat_baro, thermostat_part, &
2437 TYPE(tmp_variables_type),
POINTER :: tmp
2438 TYPE(virial_type),
POINTER :: virial
2440 NULLIFY (gci, thermostat_baro, thermostat_part, thermostat_shell, force_env)
2441 NULLIFY (atomic_kinds, cell, para_env, subsys, local_molecules, local_particles)
2442 NULLIFY (molecule_kinds, molecules, molecule_kind_set, npt, barostat)
2443 NULLIFY (core_particles, particles, shell_particles, tmp, old)
2444 NULLIFY (core_particle_set, particle_set, shell_particle_set)
2445 NULLIFY (simpar, virial, itimes)
2447 CALL get_md_env(md_env=md_env, simpar=simpar, force_env=force_env, &
2448 thermostat_part=thermostat_part, thermostat_baro=thermostat_baro, &
2449 thermostat_shell=thermostat_shell, npt=npt, first_time=first_time, &
2450 para_env=para_env, barostat=barostat, itimes=itimes)
2452 infree = 1.0_dp/real(simpar%nfree, kind=dp)
2454 CALL force_env_get(force_env, subsys=subsys, cell=cell)
2457 CALL apply_qmmm_walls_reflective(force_env)
2459 CALL cp_subsys_get(subsys=subsys, atomic_kinds=atomic_kinds, local_particles=local_particles, &
2460 particles=particles, local_molecules=local_molecules, molecules=molecules, &
2461 gci=gci, molecule_kinds=molecule_kinds, virial=virial)
2463 nparticle_kind = atomic_kinds%n_els
2464 atomic_kind_set => atomic_kinds%els
2465 molecule_kind_set => molecule_kinds%els
2467 nparticle = particles%n_els
2468 particle_set => particles%els
2469 molecule_set => molecules%els
2471 CALL get_atomic_kind_set(atomic_kind_set=atomic_kind_set, &
2472 shell_present=shell_present, shell_adiabatic=shell_adiabatic, &
2473 shell_check_distance=shell_check_distance)
2475 IF (first_time)
THEN
2476 CALL virial_evaluate(atomic_kind_set, particle_set, &
2477 local_particles, virial, para_env)
2481 CALL allocate_old(old, particle_set, npt)
2483 IF (shell_present)
THEN
2484 CALL cp_subsys_get(subsys=subsys, &
2485 shell_particles=shell_particles, core_particles=core_particles)
2486 shell_particle_set => shell_particles%els
2487 nshell =
SIZE(shell_particles%els)
2488 IF (shell_adiabatic)
THEN
2489 core_particle_set => core_particles%els
2493 CALL allocate_tmp(md_env, tmp, nparticle, nshell, shell_adiabatic)
2496 CALL apply_thermostat_baro(thermostat_baro, npt, para_env)
2499 IF (simpar%ensemble /= npe_f_ensemble)
THEN
2500 IF (shell_adiabatic)
THEN
2501 CALL apply_thermostat_particles(thermostat_part, force_env, molecule_kind_set, molecule_set, &
2502 particle_set, local_molecules, local_particles, para_env, shell_adiabatic=shell_adiabatic, &
2503 shell_particle_set=shell_particle_set, core_particle_set=core_particle_set)
2505 CALL apply_thermostat_particles(thermostat_part, force_env, molecule_kind_set, molecule_set, &
2506 particle_set, local_molecules, local_particles, para_env)
2511 CALL apply_thermostat_shells(thermostat_shell, atomic_kind_set, particle_set, &
2512 local_particles, para_env, shell_particle_set=shell_particle_set, &
2513 core_particle_set=core_particle_set)
2515 IF (simpar%constraint)
THEN
2517 CALL shake_update_targets(gci, local_molecules, molecule_set, &
2518 molecule_kind_set, dt, force_env%root_section)
2522 IF (simpar%constraint)
THEN
2523 roll_tol_thrs = simpar%roll_tol
2525 CALL set(old, atomic_kind_set, particle_set, local_particles, cell, npt,
'F')
2526 CALL getold(gci, local_molecules, molecule_set, &
2527 molecule_kind_set, particle_set, cell)
2529 roll_tol_thrs = epsilon(0.0_dp)
2531 roll_tol = -roll_tol_thrs
2533 sr:
DO WHILE (abs(roll_tol) >= roll_tol_thrs)
2535 IF (simpar%constraint)
THEN
2536 CALL set(old, atomic_kind_set, particle_set, local_particles, cell, npt,
'B')
2538 CALL update_pv(gci, simpar, atomic_kind_set, particle_set, &
2539 local_molecules, molecule_set, molecule_kind_set, &
2540 local_particles, kin, pv_kin, virial, para_env)
2541 CALL update_veps(cell, npt, simpar, pv_kin, kin, virial, infree, &
2542 virial_components=barostat%virial_components)
2544 trvg = npt(1, 1)%v + npt(2, 2)%v + npt(3, 3)%v
2549 CALL diagonalise(matrix=npt(:, :)%v, mysize=3, &
2550 uplo=
"U", eigenvalues=tmp%e_val, eigenvectors=tmp%u)
2552 tmp%arg_r(:) = 0.5_dp*tmp%e_val(:)*dt* &
2553 0.5_dp*tmp%e_val(:)*dt
2554 tmp%poly_r = 1.0_dp + e2*tmp%arg_r + e4*tmp%arg_r*tmp%arg_r + &
2555 e6*tmp%arg_r**3 + e8*tmp%arg_r**4
2556 tmp%scale_r(:) = exp(0.5_dp*dt*tmp%e_val(:))
2558 tmp%arg_v(:) = 0.25_dp*dt*(tmp%e_val(:) + trvg*infree)* &
2559 0.25_dp*dt*(tmp%e_val(:) + trvg*infree)
2560 tmp%poly_v = 1.0_dp + e2*tmp%arg_v + e4*tmp%arg_v*tmp%arg_v + &
2561 e6*tmp%arg_v**3 + e8*tmp%arg_v**4
2562 tmp%scale_v(:) = exp(-0.25_dp*dt*(tmp%e_val(:) + trvg*infree))
2564 CALL vv_first(tmp, atomic_kind_set, local_particles, particle_set, &
2565 core_particle_set, shell_particle_set, nparticle_kind, &
2566 shell_adiabatic, dt, u=tmp%u)
2568 IF (simpar%variable_dt)
CALL variable_timestep(md_env, tmp, dt, simpar, para_env, &
2569 atomic_kind_set, local_particles, particle_set, core_particle_set, &
2570 shell_particle_set, nparticle_kind, shell_adiabatic, npt=npt)
2573 vector_r = tmp%scale_r*tmp%poly_r
2574 vector_v = tmp%scale_v*tmp%poly_v
2576 IF (simpar%constraint)
CALL shake_roll_control(gci, local_molecules, &
2577 molecule_set, molecule_kind_set, particle_set, tmp%pos, tmp%vel, dt, &
2578 simpar, roll_tol, iroll, vector_r, vector_v, &
2579 para_env, u=tmp%u, cell=cell, &
2580 local_particles=local_particles)
2584 uh = matmul(transpose(tmp%u), cell%hmat)
2588 uh(i, j) = uh(i, j)*tmp%scale_r(i)*tmp%scale_r(i)
2592 cell%hmat = matmul(tmp%u, uh)
2594 CALL init_cell(cell)
2597 CALL update_dealloc_tmp(tmp, particle_set, shell_particle_set, &
2598 core_particle_set, para_env, shell_adiabatic, pos=.true.)
2600 IF (shell_adiabatic .AND. shell_check_distance)
THEN
2601 CALL optimize_shell_core(force_env, particle_set, &
2602 shell_particle_set, core_particle_set, globenv, tmp=tmp, check=.true.)
2606 CALL force_env_calc_energy_force(force_env)
2609 CALL metadyn_integrator(force_env, itimes, tmp%vel)
2612 CALL vv_second(tmp, atomic_kind_set, local_particles, particle_set, &
2613 core_particle_set, shell_particle_set, nparticle_kind, &
2614 shell_adiabatic, dt, tmp%u)
2616 IF (simpar%constraint)
THEN
2617 roll_tol_thrs = simpar%roll_tol
2620 CALL set(old, atomic_kind_set, particle_set, tmp%vel, local_particles, cell, npt,
'F')
2622 roll_tol_thrs = epsilon(0.0_dp)
2624 roll_tol = -roll_tol_thrs
2626 rr:
DO WHILE (abs(roll_tol) >= roll_tol_thrs)
2628 IF (simpar%constraint)
CALL rattle_roll_setup(old, gci, atomic_kind_set, &
2629 particle_set, local_particles, molecule_kind_set, molecule_set, &
2630 local_molecules, tmp%vel, dt, cell, npt, simpar, virial, vector_v, &
2631 roll_tol, iroll, infree, first, para_env, u=tmp%u)
2633 CALL update_pv(gci, simpar, atomic_kind_set, tmp%vel, particle_set, &
2634 local_molecules, molecule_set, molecule_kind_set, &
2635 local_particles, kin, pv_kin, virial, para_env)
2636 CALL update_veps(cell, npt, simpar, pv_kin, kin, virial, infree, &
2637 virial_components=barostat%virial_components)
2641 IF (simpar%ensemble /= npe_f_ensemble)
THEN
2642 IF (shell_adiabatic)
THEN
2643 CALL apply_thermostat_particles(thermostat_part, force_env, molecule_kind_set, molecule_set, &
2644 particle_set, local_molecules, local_particles, para_env, shell_adiabatic=shell_adiabatic, &
2645 vel=tmp%vel, shell_vel=tmp%shell_vel, core_vel=tmp%core_vel)
2648 CALL apply_thermostat_particles(thermostat_part, force_env, molecule_kind_set, molecule_set, &
2649 particle_set, local_molecules, local_particles, para_env, vel=tmp%vel)
2654 IF (
ASSOCIATED(thermostat_shell))
THEN
2655 CALL apply_thermostat_shells(thermostat_shell, atomic_kind_set, particle_set, &
2656 local_particles, para_env, vel=tmp%vel, shell_vel=tmp%shell_vel, &
2657 core_vel=tmp%core_vel)
2661 CALL apply_thermostat_baro(thermostat_baro, npt, para_env)
2664 IF (simpar%ensemble == npe_f_ensemble .AND. simpar%annealing)
THEN
2665 tmp%vel(:, :) = tmp%vel(:, :)*simpar%f_annealing
2666 IF (shell_adiabatic)
THEN
2667 CALL shell_scale_comv(atomic_kind_set, local_particles, particle_set, &
2668 tmp%vel, tmp%shell_vel, tmp%core_vel)
2672 IF (simpar%ensemble == npe_f_ensemble .AND. simpar%annealing_cell)
THEN
2673 npt(:, :)%v = npt(:, :)%v*simpar%f_annealing_cell
2677 CALL update_dealloc_tmp(tmp, particle_set, shell_particle_set, &
2678 core_particle_set, para_env, shell_adiabatic, vel=.true.)
2681 IF (simpar%constraint)
THEN
2682 CALL pv_constraint(gci, local_molecules, molecule_set, &
2683 molecule_kind_set, particle_set, virial, para_env)
2686 CALL virial_evaluate(atomic_kind_set, particle_set, &
2687 local_particles, virial, para_env)
2690 CALL deallocate_old(old)
2692 IF (first_time)
THEN
2693 first_time = .false.
2694 CALL set_md_env(md_env, first_time=first_time)
2697 END SUBROUTINE npt_f
2706 TYPE(md_environment_type),
POINTER :: md_env
2708 INTEGER :: i_step, iparticle, iparticle_kind, &
2709 iparticle_local, n_time_steps, &
2710 nparticle, nparticle_kind, &
2712 INTEGER,
POINTER :: itimes
2713 REAL(kind=dp) :: constraint_dt, dm, dt, inner_dt, mass
2714 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:, :) :: pos, vel
2715 TYPE(atomic_kind_list_type),
POINTER :: atomic_kinds
2716 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
2717 TYPE(atomic_kind_type),
POINTER :: atomic_kind
2718 TYPE(cell_type),
POINTER :: cell
2719 TYPE(cp_subsys_type),
POINTER :: subsys, subsys_respa
2720 TYPE(distribution_1d_type),
POINTER :: local_molecules, local_particles
2721 TYPE(force_env_type),
POINTER :: force_env
2722 TYPE(global_constraint_type),
POINTER :: gci
2723 TYPE(molecule_kind_list_type),
POINTER :: molecule_kinds
2724 TYPE(molecule_kind_type),
DIMENSION(:),
POINTER :: molecule_kind_set
2725 TYPE(molecule_list_type),
POINTER :: molecules
2726 TYPE(molecule_type),
DIMENSION(:),
POINTER :: molecule_set
2727 TYPE(mp_para_env_type),
POINTER :: para_env
2728 TYPE(particle_list_type),
POINTER :: particles, particles_respa
2729 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set, particle_set_respa
2730 TYPE(simpar_type),
POINTER :: simpar
2732 NULLIFY (para_env, cell, subsys_respa, particles_respa, particle_set_respa, gci, force_env, atomic_kinds)
2733 NULLIFY (atomic_kind_set, simpar, subsys, particles, particle_set)
2734 NULLIFY (local_molecules, molecule_kinds, molecules, molecule_kind_set, local_particles, itimes)
2735 CALL get_md_env(md_env=md_env, simpar=simpar, force_env=force_env, &
2736 para_env=para_env, itimes=itimes)
2739 n_time_steps = simpar%n_time_steps
2740 inner_dt = dt/n_time_steps
2742 CALL force_env_get(force_env, subsys=subsys, cell=cell)
2743 CALL force_env_get(force_env%sub_force_env(1)%force_env, subsys=subsys_respa)
2746 CALL apply_qmmm_walls_reflective(force_env)
2748 CALL cp_subsys_get(subsys=subsys, atomic_kinds=atomic_kinds, local_particles=local_particles, &
2749 particles=particles, local_molecules=local_molecules, molecules=molecules, &
2750 gci=gci, molecule_kinds=molecule_kinds)
2752 CALL cp_subsys_get(subsys=subsys_respa, particles=particles_respa)
2753 particle_set_respa => particles_respa%els
2755 nparticle_kind = atomic_kinds%n_els
2756 atomic_kind_set => atomic_kinds%els
2757 molecule_kind_set => molecule_kinds%els
2759 nparticle = particles%n_els
2760 particle_set => particles%els
2761 molecule_set => molecules%els
2764 ALLOCATE (pos(3, nparticle))
2765 ALLOCATE (vel(3, nparticle))
2769 IF (simpar%constraint)
THEN
2770 IF (gci%joint_colvar_checks)
THEN
2771 constraint_dt = inner_dt
2773 CALL getold(gci, local_molecules, molecule_set, &
2774 molecule_kind_set, particle_set, cell)
2779 DO iparticle_kind = 1, nparticle_kind
2780 atomic_kind => atomic_kind_set(iparticle_kind)
2781 CALL get_atomic_kind(atomic_kind=atomic_kind, mass=mass)
2783 nparticle_local = local_particles%n_el(iparticle_kind)
2784 DO iparticle_local = 1, nparticle_local
2785 iparticle = local_particles%list(iparticle_kind)%array(iparticle_local)
2786 vel(:, iparticle) = particle_set(iparticle)%v(:) + &
2787 dm*(particle_set(iparticle)%f(:) - &
2788 particle_set_respa(iparticle)%f(:))
2793 DO i_step = 1, n_time_steps
2794 IF (gci%joint_colvar_checks)
CALL getold(gci, local_molecules, molecule_set, &
2795 molecule_kind_set, particle_set, cell)
2797 DO iparticle_kind = 1, nparticle_kind
2798 atomic_kind => atomic_kind_set(iparticle_kind)
2799 CALL get_atomic_kind(atomic_kind=atomic_kind, mass=mass)
2800 dm = 0.5_dp*dt/(n_time_steps*mass)
2801 nparticle_local = local_particles%n_el(iparticle_kind)
2802 DO iparticle_local = 1, nparticle_local
2803 iparticle = local_particles%list(iparticle_kind)%array(iparticle_local)
2804 vel(:, iparticle) = vel(:, iparticle) + &
2805 dm*particle_set_respa(iparticle)%f(:)
2806 pos(:, iparticle) = particle_set(iparticle)%r(:) + &
2807 (dt/n_time_steps)*vel(:, iparticle)
2811 IF (simpar%constraint)
THEN
2813 CALL shake_update_targets(gci, local_molecules, molecule_set, &
2814 molecule_kind_set, inner_dt, force_env%root_section)
2816 CALL shake_control(gci, local_molecules, molecule_set, &
2817 molecule_kind_set, particle_set, pos, vel, constraint_dt, simpar%shake_tol, &
2818 simpar%info_constraint, simpar%lagrange_multipliers, simpar%dump_lm, cell, &
2819 para_env, local_particles)
2823 CALL update_particle_set(particle_set, para_env, pos=pos)
2824 DO iparticle = 1,
SIZE(particle_set)
2825 particle_set_respa(iparticle)%r = particle_set(iparticle)%r
2829 CALL force_env_calc_energy_force(force_env%sub_force_env(1)%force_env)
2832 CALL metadyn_integrator(force_env, itimes, vel)
2835 DO iparticle_kind = 1, nparticle_kind
2836 atomic_kind => atomic_kind_set(iparticle_kind)
2837 CALL get_atomic_kind(atomic_kind=atomic_kind, mass=mass)
2838 dm = 0.5_dp*dt/(n_time_steps*mass)
2839 nparticle_local = local_particles%n_el(iparticle_kind)
2840 DO iparticle_local = 1, nparticle_local
2841 iparticle = local_particles%list(iparticle_kind)%array(iparticle_local)
2842 vel(1, iparticle) = vel(1, iparticle) + dm*particle_set_respa(iparticle)%f(1)
2843 vel(2, iparticle) = vel(2, iparticle) + dm*particle_set_respa(iparticle)%f(2)
2844 vel(3, iparticle) = vel(3, iparticle) + dm*particle_set_respa(iparticle)%f(3)
2848 IF (simpar%constraint)
CALL rattle_control(gci, local_molecules, molecule_set, &
2849 molecule_kind_set, particle_set, vel, constraint_dt, simpar%shake_tol, &
2850 simpar%info_constraint, simpar%lagrange_multipliers, &
2851 simpar%dump_lm, cell, para_env, local_particles)
2853 IF (simpar%annealing) vel(:, :) = vel(:, :)*simpar%f_annealing
2859 CALL force_env_calc_energy_force(force_env)
2862 CALL metadyn_integrator(force_env, itimes, vel)
2864 DO iparticle_kind = 1, nparticle_kind
2865 atomic_kind => atomic_kind_set(iparticle_kind)
2866 CALL get_atomic_kind(atomic_kind=atomic_kind, mass=mass)
2868 nparticle_local = local_particles%n_el(iparticle_kind)
2869 DO iparticle_local = 1, nparticle_local
2870 iparticle = local_particles%list(iparticle_kind)%array(iparticle_local)
2871 vel(1, iparticle) = vel(1, iparticle) + dm*(particle_set(iparticle)%f(1) - particle_set_respa(iparticle)%f(1))
2872 vel(2, iparticle) = vel(2, iparticle) + dm*(particle_set(iparticle)%f(2) - particle_set_respa(iparticle)%f(2))
2873 vel(3, iparticle) = vel(3, iparticle) + dm*(particle_set(iparticle)%f(3) - particle_set_respa(iparticle)%f(3))
2877 IF (gci%joint_colvar_checks)
CALL rattle_control(gci, local_molecules, molecule_set, &
2878 molecule_kind_set, particle_set, vel, dt, simpar%shake_tol, &
2879 simpar%info_constraint, simpar%lagrange_multipliers, &
2880 simpar%dump_lm, cell, para_env, local_particles)
2883 CALL update_particle_set(particle_set, para_env, vel=vel)
represent a simple array based list of the given type
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
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.
Barostat structure: module containing barostat available for MD.
Handles all functions related to the CELL.
subroutine, public read_xyz_comment(line, cell, has_cell, step, time, ener)
Reads comment line of XYZ files to get cell, step, time and energy info.
subroutine, public init_cell(cell, hmat, periodic)
Initialise/readjust a simulation cell after hmat has been changed.
Handles all functions related to the CELL.
subroutine, public parse_cell_line(input_line, cell_itimes, cell_time, h, vol)
Read cell info from a line (parsed from a file).
subroutine, public fix_atom_control(force_env, w)
allows for fix atom constraints
subroutine, public release_local_fixd_list(lfixd_list)
destroy the list of local atoms on which to apply constraints/restraints Teodoro Laino [tlaino] - 11....
subroutine, public create_local_fixd_list(lfixd_list, nkind, molecule_kind_set, local_particles)
setup a list of local atoms on which to apply constraints/restraints
Contains routines useful for the application of constraints during MD.
subroutine, public pv_constraint(gci, local_molecules, molecule_set, molecule_kind_set, particle_set, virial, group)
...
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_roll_control(gci, local_molecules, molecule_set, molecule_kind_set, particle_set, pos, vel, dt, simpar, roll_tol, iroll, vector_r, vector_v, group, u, cell, 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.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
subroutine, public cp_iterate(iteration_info, last, iter_nr, increment, iter_nr_out)
adds one to the actual iteration
Utility routines to read data from files. Kept as close as possible to the old parser because.
subroutine, public parser_read_line(parser, nline, at_end)
Read the next line from a logical unit "unit" (I/O node only). Skip (nline-1) lines and skip also all...
subroutine, public parser_get_next_line(parser, nline, at_end)
Read the next input line and broadcast the input information. Skip (nline-1) lines and skip also all ...
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_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...
Provides interfaces to LAPACK eigenvalue/SVD routines.
subroutine, public shell_scale_comv(atomic_kind_set, local_particles, particle_set, com_vel, shell_vel, core_vel)
...
Lumps all possible extended system variables into one type for easy access and passing.
Interface for the force calculations.
recursive subroutine, public force_env_calc_energy_force(force_env, calc_force, consistent_energies, skip_external_control, eval_energy_forces, require_consistent_energy_force, linres, calc_stress_tensor)
Interface routine for force and energy calculations.
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
Define type storing the global information of a run. Keep the amount of stored data small....
Provides integrator utility routines for the integrators.
subroutine, public variable_timestep(md_env, tmp, dt, simpar, para_env, atomic_kind_set, local_particles, particle_set, core_particle_set, shell_particle_set, nparticle_kind, shell_adiabatic, npt)
Compute the timestep rescaling factor.
subroutine, public rattle_roll_setup(old, gci, atomic_kind_set, particle_set, local_particles, molecule_kind_set, molecule_set, local_molecules, vel, dt, cell, npt, simpar, virial, vector_v, roll_tol, iroll, infree, first, para_env, u)
update veps using multiplier obtained from SHAKE
subroutine, public allocate_tmp(md_env, tmp, nparticle, nshell, shell_adiabatic)
allocate temporary variables to store positions and velocities used by the velocity-verlet integrator
subroutine, public vv_second(tmp, atomic_kind_set, local_particles, particle_set, core_particle_set, shell_particle_set, nparticle_kind, shell_adiabatic, dt, u)
Second half of the velocity-verlet algorithm : update velocity by half step using the new forces.
subroutine, public allocate_old(old, particle_set, npt)
...
subroutine, public update_dealloc_tmp(tmp, particle_set, shell_particle_set, core_particle_set, para_env, shell_adiabatic, pos, vel, should_deall_vel)
update positions and deallocate temporary variable
elemental subroutine, public damp_veps(npt, gamma1, dt)
provides damping for barostat via nph_uniaxial_damped dynamics
subroutine, public update_veps(box, npt, simpar, pv_kin, kin, virial, infree, virial_components)
Routine to compute veps.
subroutine, public get_s_ds(tmp, nparticle_kind, atomic_kind_set, local_particles, particle_set, dt, para_env, tmpv)
...
subroutine, public vv_first(tmp, atomic_kind_set, local_particles, particle_set, core_particle_set, shell_particle_set, nparticle_kind, shell_adiabatic, dt, u, lfixd_list)
First half of the velocity-verlet algorithm : update velocity by half step and positions by full step...
subroutine, public deallocate_old(old)
...
Provides integrator routines (velocity verlet) for all the ensemble types.
subroutine, public nvt(md_env, globenv)
nvt integrator for particle positions & momenta
subroutine, public isokin(md_env)
simplest version of the isokinetic gaussian thermostat
subroutine, public reftraj(md_env)
uses coordinates in a file and generates frame after frame of these
subroutine, public nph_uniaxial(md_env)
nph_uniaxial integrator (non-Hamiltonian version) for particle positions & momenta undergoing uniaxia...
subroutine, public nph_uniaxial_damped(md_env)
nph_uniaxial integrator (non-Hamiltonian version) for particle positions & momenta undergoing uniaxia...
subroutine, public langevin(md_env)
Langevin integrator for particle positions & momenta (Brownian dynamics).
subroutine, public npt_f(md_env, globenv)
Velocity Verlet integrator for the NPT ensemble with fully flexible cell.
subroutine, public nve_respa(md_env)
RESPA integrator for nve ensemble for particle positions & momenta.
subroutine, public nvt_adiabatic(md_env, globenv)
nvt adiabatic integrator for particle positions & momenta
subroutine, public nve(md_env, globenv)
nve integrator for particle positions & momenta
subroutine, public npt_i(md_env, globenv)
npt_i integrator for particle positions & momenta isotropic box changes
Defines the basic variable types.
integer, parameter, public max_line_length
integer, parameter, public dp
subroutine, public set_md_env(md_env, itimes, constant, cell, simpar, fe_env, force_env, para_env, init, first_time, thermostats, barostat, reftraj, md_ener, averages, thermal_regions, ehrenfest_md, electrons)
Set the integrator environment to the correct program.
subroutine, public get_md_env(md_env, itimes, constant, used_time, cell, simpar, npt, force_env, para_env, reftraj, t, init, first_time, fe_env, thermostats, barostat, thermostat_coeff, thermostat_part, thermostat_shell, thermostat_baro, thermostat_fast, thermostat_slow, md_ener, averages, thermal_regions, ehrenfest_md, electrons)
get components of MD environment type
Interface to the message passing library MPI.
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.
represent a simple array based list of the given type
Define the data structure for the particle information.
subroutine, public update_particle_set(particle_set, int_group, pos, vel, for, add)
...
Definition of physical constants:
real(kind=dp), parameter, public femtoseconds
subroutine, public apply_qmmm_walls_reflective(force_env)
Apply reflective QM walls in order to avoid QM atoms escaping from the QM Box.
Update a QM/MM calculations with force mixing.
subroutine, public qmmmx_update_force_env(force_env, root_section)
...
Dual integer-electron-endpoint charge mixing for constant-potential MD, built on top of CP2K's stock ...
subroutine, public push_lambda_to_mixed_env(force_env, lambda)
Push a dynamically computed lambda into the MIXED force_eval's input structure. force_env_methods....
subroutine, public charge_mixing_maybe_rebuild(force_env, electrons)
Check whether q(t) has drifted outside the currently-built [N_lo,N_hi] bracket and,...
subroutine, public qs_electrons_charge_mixing_lambda(electrons, lambda, n_lo, n_hi)
Given the current electronic coordinate q and the integer span S, compute the bracketing integers N_l...
subroutine, public compute_mixed_workfunction(force_env, axis, wf_min, wf_max, q, span, fermi_level_ev, workfunction_ev, lambda_in)
Fermi level / workfunction mixing across the two integer-charge endpoints. Stock MIXED only combines ...
Ne-electrode core-charge correction for constant-potential MD: adjusts the Ne pseudopotential core ch...
subroutine, public apply_ne_core_correction(force_env, target_nelect, neutral_electrons_ref)
Apply Ne core correction update from the current total electron number.
State of the fictitious electronic degree of freedom (electron number q, its momentum,...
Propagation of the electronic degree of freedom in constant-potential MD: generalized force,...
subroutine, public qs_electrons_drift(electrons, dt)
Drift of the electronic coordinate (total electron number).
subroutine, public qs_electrons_thermostat_step(electrons, dt)
Stochastic velocity rescaling ("O" step) of the electronic momentum, reusing CP2K's own CSVR rescalin...
subroutine, public qs_electrons_kick(electrons, dt)
Half-kick of the electronic momentum from the current generalized force.
Work function and Fermi level readback from the converged SCF, using the planar average of the Hartre...
subroutine, public qs_electrons_compute_workfunction(force_env, axis, minimum_a, maximum_a, fermi_level_ev, workfunction_ev)
Compute the work function (vacuum Hartree level minus Fermi level, in eV) from the planar average of ...
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
initialization of the reftraj structure used to analyse previously generated trajectories
integer, parameter, public reftraj_wrap_central
integer, parameter, public reftraj_wrap_positive
integer, parameter, public reftraj_wrap_none
integer, parameter, public reftraj_eval_energy_forces
integer, parameter, public reftraj_eval_none
Initialize the analysis of trajectories to be done by activating the REFTRAJ ensemble.
subroutine, public compute_msd_reftraj(reftraj, md_env, particle_set)
...
Routines for propagating the orbitals.
subroutine, public propagation_step(qs_env, rtp, rtp_control)
performs a single propagation step a(t+Dt)=U(t+Dt,t)*a(0) and calculates the new exponential
Routine for the real time propagation output.
subroutine, public rt_prop_output(qs_env, run_type, delta_iter, used_time)
...
Types and set_get for real time propagation depending on runtype and diagonalization method different...
subroutine, public optimize_shell_core(force_env, particle_set, shell_particle_set, core_particle_set, globenv, tmp, check)
Optimize shell-core positions along an MD run.
Type for storing MD parameters.
Utilities for string manipulations.
elemental subroutine, public uppercase(string)
Convert all lower case characters in a string to upper case.
Thermal regions type: to initialize and control the temperature of different regions.
subroutine, public apply_thermostat_baro(thermostat, npt, group)
...
subroutine, public apply_thermostat_shells(thermostat, atomic_kind_set, particle_set, local_particles, group, shell_particle_set, core_particle_set, vel, shell_vel, core_vel)
...
subroutine, public apply_thermostat_particles(thermostat, force_env, molecule_kind_set, molecule_set, particle_set, local_molecules, local_particles, group, shell_adiabatic, shell_particle_set, core_particle_set, vel, shell_vel, core_vel)
...
Thermostat structure: module containing thermostat available for MD.
subroutine, public virial_evaluate(atomic_kind_set, particle_set, local_particles, virial, igroup)
Computes the kinetic part of the pressure tensor and updates the full VIRIAL (PV).
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.
wrapper to abstract the force evaluation of the various methods
contains the initially parsed file and the initial parallel environment
stores all the informations relevant to an mpi environment
represent a list of objects
represent a list of objects
represent a list of objects
Simulation parameter type for molecular dynamics.