83#include "../base/base_uses.f90"
88 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'gopt_f_methods'
89 INTEGER(KIND=int_8),
PARAMETER,
PRIVATE :: bytes_per_mib = 1024*1024
110 REAL(kind=
dp),
DIMENSION(:),
POINTER :: x0
112 INTEGER :: i, idg, j, nparticle
119 SELECT CASE (gopt_env%type_id)
123 CALL apply_qmmm_translation(gopt_env)
125 ALLOCATE (x0(3*nparticle))
128 CALL force_env_get(gopt_env%force_env, subsys=subsys, cell=cell)
130 gopt_env%h_ref = cell%hmat
132 CALL apply_qmmm_translation(gopt_env)
134 ALLOCATE (x0(3*nparticle + 6))
140 x0(idg) = gopt_env%cell_env%opt_cell%hmat(j, i)
144 cpabort(
"Invalid or not yet implemented type of optimization")
153 SUBROUTINE apply_qmmm_translation(gopt_env)
156 IF (gopt_env%force_env%in_use ==
use_qmmm)
THEN
159 IF (gopt_env%force_env%in_use ==
use_qmmmx)
THEN
162 END SUBROUTINE apply_qmmm_translation
182 REAL(kind=
dp),
DIMENSION(:),
POINTER :: x
183 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: f
184 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: gradient
185 INTEGER,
INTENT(IN) :: master
188 CHARACTER(len=*),
PARAMETER :: routinen =
'cp_eval_at'
190 INTEGER :: handle, idg, idir, ip, nparticle, nsize, &
192 REAL(kind=
dp) :: f_ts
193 REAL(kind=
dp),
DIMENSION(3, 3) :: av_ptens, av_ptens_opt
194 REAL(kind=
dp),
DIMENSION(:),
POINTER :: cell_gradient, gradient_ts
203 NULLIFY (core_particles)
204 NULLIFY (gradient_ts)
206 NULLIFY (shell_particles)
211 CALL timeset(routinen, handle)
213 CALL force_env_get(gopt_env%force_env, subsys=subsys, cell=cell)
215 core_particles=core_particles, &
216 particles=particles, &
217 shell_particles=shell_particles, &
220 spgr => gopt_env%spgr
222 SELECT CASE (gopt_env%type_id)
226 SELECT CASE (gopt_env%type_id)
230 calc_force=
PRESENT(gradient), &
231 require_consistent_energy_force=gopt_env%require_consistent_energy_force)
237 IF (
PRESENT(gradient))
THEN
238 IF (master == para_env%mepos)
THEN
240 IF (spgr%keep_space_group)
THEN
248 ALLOCATE (gradient_ts(particles%n_els*3))
252 CALL cp_eval_at_ts(gopt_env, x, f_ts, gradient_ts, calc_force=.true.)
255 IF (
PRESENT(f)) f = f_ts
257 IF (
PRESENT(gradient))
THEN
258 IF (master == para_env%mepos)
THEN
259 cpassert(
ASSOCIATED(gradient))
260 gradient = gradient_ts
263 DEALLOCATE (gradient_ts)
270 IF (.NOT. virial%pv_availability)
THEN
271 CALL cp_abort(__location__, &
272 "For the CELL_OPT task, the FORCE_EVAL/STRESS_TENSOR "// &
273 "keyword MUST be defined in the input file for the "// &
274 "evaluation of the stress tensor, but none is found!")
276 IF (gopt_env%cell_env%keep_volume)
THEN
289 calc_force=
PRESENT(gradient), &
290 require_consistent_energy_force=gopt_env%require_consistent_energy_force)
298 IF (
PRESENT(gradient))
THEN
299 cpassert(any(virial_avg%pv_total /= 0))
301 av_ptens(:, :) = virial_avg%pv_total(:, :)/cell%deth
302 IF (master == para_env%mepos)
THEN
303 cpassert(
ASSOCIATED(gradient))
306 cpassert((
SIZE(gradient) == nsize + 6))
309 IF (spgr%keep_space_group)
THEN
314 cell_gradient => gradient(nsize + 1:nsize + 6)
315 cell_gradient = 0.0_dp
316 av_ptens_opt = matmul(gopt_env%cell_env%input_to_opt, &
317 matmul(av_ptens, gopt_env%cell_env%opt_to_input))
318 CALL get_dg_dh(cell_gradient, av_ptens_opt, gopt_env%cell_env%pres_ext, &
319 gopt_env%cell_env%opt_cell, gopt_env%cell_env%mtrx, &
320 keep_angles=gopt_env%cell_env%keep_angles, &
321 keep_symmetry=gopt_env%cell_env%keep_symmetry, &
322 pres_int=gopt_env%cell_env%pres_int, &
323 pres_constr=gopt_env%cell_env%pres_constr, &
324 constraint_id=gopt_env%cell_env%constraint_id)
328 CALL para_env%bcast(gopt_env%cell_env%pres_int, 0)
329 IF (gopt_env%cell_env%constraint_id /=
fix_none)
THEN
330 CALL para_env%bcast(gopt_env%cell_env%pres_constr, 0)
336 DO ip = 1, particles%n_els
337 shell_index = particles%els(ip)%shell_index
338 IF (shell_index /= 0)
THEN
340 idg = 3*(shell_index - 1) + idir
341 shell_particles%els(shell_index)%r(idir) = core_particles%els(ip)%r(idir) - x(idg)
349 calc_force=
PRESENT(gradient), &
350 require_consistent_energy_force=gopt_env%require_consistent_energy_force)
358 IF (
PRESENT(gradient))
THEN
359 IF (master == para_env%mepos)
THEN
360 cpassert(
ASSOCIATED(gradient))
362 DO ip = 1, shell_particles%n_els
365 gradient(idg) = -(core_particles%els(ip)%f(idir) - shell_particles%els(ip)%f(idir))
371 cpabort(
"Invalid or not yet implemented type of optimization")
374 CALL timestop(handle)
386 INTEGER,
INTENT(IN) :: its, output_unit
388 IF (output_unit > 0)
THEN
389 WRITE (unit=output_unit, fmt=
"(/,T2,26('-'))")
390 WRITE (unit=output_unit, fmt=
"(T2,A,I6)")
"OPTIMIZATION STEP: ", its
391 WRITE (unit=output_unit, fmt=
"(T2,26('-'))")
392 CALL m_flush(output_unit)
405 SUBROUTINE get_reporting_metadata(gopt_env, force_env, max_memory, energy_unit, stress_unit)
407 TYPE(gopt_f_type),
POINTER :: gopt_env
408 TYPE(force_env_type),
POINTER :: force_env
409 INTEGER(KIND=int_8),
INTENT(OUT) :: max_memory
410 CHARACTER(LEN=default_string_length),
INTENT(OUT) :: energy_unit, stress_unit
412 LOGICAL :: print_memory
413 TYPE(mp_para_env_type),
POINTER :: para_env
416 CALL section_vals_val_get(gopt_env%motion_section,
"PRINT%MEMORY_INFO", l_val=print_memory)
418 IF (print_memory)
THEN
419 CALL force_env_get(force_env, para_env=para_env)
420 max_memory = sample_memory(para_env)
423 CALL section_vals_val_get(gopt_env%force_env%force_env_section, &
424 "PRINT%PROGRAM_RUN_INFO%ENERGY_UNIT", &
426 CALL section_vals_val_get(gopt_env%force_env%force_env_section, &
427 "PRINT%STRESS_TENSOR%STRESS_UNIT", &
430 END SUBROUTINE get_reporting_metadata
442 SUBROUTINE gopt_f_io_init(gopt_env, output_unit, opt_energy, wildcard, its, used_time)
444 TYPE(gopt_f_type),
POINTER :: gopt_env
445 INTEGER,
INTENT(IN) :: output_unit
446 REAL(kind=dp) :: opt_energy
447 CHARACTER(LEN=5) :: wildcard
448 INTEGER,
INTENT(IN) :: its
449 REAL(kind=dp) :: used_time
451 CHARACTER(LEN=default_string_length) :: energy_unit, stress_unit
452 INTEGER(KIND=int_8) :: max_memory
453 REAL(kind=dp) :: pres_int
455 CALL get_reporting_metadata(gopt_env, gopt_env%force_env, max_memory, energy_unit, stress_unit)
457 SELECT CASE (gopt_env%type_id)
458 CASE (default_ts_method_id, default_minimization_method_id)
460 IF (.NOT. gopt_env%dimer_rotation)
THEN
461 CALL write_cycle_infos(output_unit, &
465 used_time=used_time, &
466 max_memory=max_memory, &
467 energy_unit=energy_unit, &
468 stress_unit=stress_unit)
470 CALL write_rot_cycle_infos(output_unit, &
473 dimer_env=gopt_env%dimer_env, &
475 used_time=used_time, &
476 max_memory=max_memory)
478 CASE (default_cell_method_id)
480 pres_int = gopt_env%cell_env%pres_int
481 CALL write_cycle_infos(output_unit, &
486 used_time=used_time, &
487 max_memory=max_memory, &
488 energy_unit=energy_unit, &
489 stress_unit=stress_unit)
490 CASE (default_shellcore_method_id)
491 CALL write_cycle_infos(output_unit, &
495 used_time=used_time, &
496 max_memory=max_memory, &
497 energy_unit=energy_unit, &
498 stress_unit=stress_unit)
526 SUBROUTINE gopt_f_io(gopt_env, force_env, root_section, its, opt_energy, &
527 output_unit, eold, emin, wildcard, gopt_param, ndf, dx, xi, conv, pred, rat, &
528 step, rad, used_time)
530 TYPE(gopt_f_type),
POINTER :: gopt_env
531 TYPE(force_env_type),
POINTER :: force_env
532 TYPE(section_vals_type),
POINTER :: root_section
533 INTEGER,
INTENT(IN) :: its
534 REAL(kind=dp),
INTENT(IN) :: opt_energy
535 INTEGER,
INTENT(IN) :: output_unit
536 REAL(kind=dp) :: eold, emin
537 CHARACTER(LEN=5) :: wildcard
538 TYPE(gopt_param_type),
POINTER :: gopt_param
539 INTEGER,
INTENT(IN),
OPTIONAL :: ndf
540 REAL(kind=dp),
DIMENSION(:),
INTENT(IN),
OPTIONAL :: dx
541 REAL(kind=dp),
DIMENSION(:),
OPTIONAL,
POINTER :: xi
542 LOGICAL,
OPTIONAL :: conv
543 REAL(kind=dp),
INTENT(IN),
OPTIONAL :: pred, rat, step, rad
544 REAL(kind=dp) :: used_time
546 CHARACTER(LEN=default_string_length) :: energy_unit, stress_unit
547 INTEGER(KIND=int_8) :: max_memory
548 REAL(kind=dp) :: pres_diff, pres_diff_constr, pres_int, &
551 CALL get_reporting_metadata(gopt_env, force_env, max_memory, energy_unit, stress_unit)
553 SELECT CASE (gopt_env%type_id)
554 CASE (default_ts_method_id, default_minimization_method_id)
556 IF (.NOT. gopt_env%dimer_rotation)
THEN
557 CALL geo_opt_io(force_env=force_env, root_section=root_section, &
558 motion_section=gopt_env%motion_section, its=its, opt_energy=opt_energy)
559 CALL write_cycle_infos(output_unit, &
562 ediff=(opt_energy - eold), &
569 used_time=used_time, &
570 max_memory=max_memory, &
571 energy_unit=energy_unit, &
572 stress_unit=stress_unit)
574 IF (
PRESENT(conv))
THEN
575 cpassert(
PRESENT(ndf))
576 cpassert(
PRESENT(dx))
577 cpassert(
PRESENT(xi))
578 CALL check_and_report_convergence(output_unit, gopt_param, ndf, dx, xi, conv, &
579 max_memory, stress_unit)
582 CALL update_dimer_vec(gopt_env%dimer_env, gopt_env%motion_section)
583 CALL write_restart(force_env=force_env, root_section=root_section)
584 CALL write_rot_cycle_infos(output_unit, its, opt_energy, opt_energy - eold, emin, gopt_env%dimer_env, &
585 wildcard=wildcard, used_time=used_time, max_memory=max_memory)
587 IF (
PRESENT(conv))
THEN
588 cpassert(
ASSOCIATED(gopt_env%dimer_env))
589 CALL check_rot_conv(gopt_env%dimer_env, output_unit, conv)
592 CASE (default_cell_method_id)
594 pres_diff = gopt_env%cell_env%pres_int - gopt_env%cell_env%pres_ext
595 pres_int = gopt_env%cell_env%pres_int
596 pres_tol = gopt_env%cell_env%pres_tol
597 CALL geo_opt_io(force_env=force_env, root_section=root_section, &
598 motion_section=gopt_env%motion_section, its=its, opt_energy=opt_energy)
599 CALL write_cycle_infos(output_unit, &
602 ediff=(opt_energy - eold), &
610 used_time=used_time, &
611 max_memory=max_memory, &
612 energy_unit=energy_unit, &
613 stress_unit=stress_unit)
615 IF (
PRESENT(conv))
THEN
616 cpassert(
PRESENT(ndf))
617 cpassert(
PRESENT(dx))
618 cpassert(
PRESENT(xi))
619 IF (gopt_env%cell_env%constraint_id == fix_none)
THEN
620 CALL check_and_report_convergence(output_unit, gopt_param, ndf, dx, xi, conv, &
621 max_memory, stress_unit, pres_diff, pres_tol)
623 pres_diff_constr = gopt_env%cell_env%pres_constr - gopt_env%cell_env%pres_ext
624 CALL check_and_report_convergence(output_unit, gopt_param, ndf, dx, xi, conv, &
625 max_memory, stress_unit, pres_diff, pres_tol, &
629 CASE (default_shellcore_method_id)
630 CALL write_cycle_infos(output_unit, &
633 ediff=(opt_energy - eold), &
640 used_time=used_time, &
641 max_memory=max_memory, &
642 energy_unit=energy_unit, &
643 stress_unit=stress_unit)
645 IF (
PRESENT(conv))
THEN
646 cpassert(
PRESENT(ndf))
647 cpassert(
PRESENT(dx))
648 cpassert(
PRESENT(xi))
649 CALL check_and_report_convergence(output_unit, gopt_param, ndf, dx, xi, conv, &
650 max_memory, stress_unit)
670 para_env, master, output_unit)
671 TYPE(gopt_f_type),
POINTER :: gopt_env
672 TYPE(force_env_type),
POINTER :: force_env
673 REAL(kind=dp),
DIMENSION(:),
POINTER :: x0
676 TYPE(section_vals_type),
POINTER :: root_section
677 TYPE(mp_para_env_type),
POINTER :: para_env
678 INTEGER,
INTENT(IN) :: master, output_unit
680 IF (gopt_env%eval_opt_geo)
THEN
681 IF (.NOT. gopt_env%dimer_rotation)
THEN
682 CALL write_final_info(output_unit, conv, its, gopt_env, x0, master, &
683 para_env, force_env, gopt_env%motion_section, root_section)
685 CALL update_dimer_vec(gopt_env%dimer_env, gopt_env%motion_section)
686 CALL write_restart(force_env=force_env, root_section=root_section)
710 SUBROUTINE write_cycle_infos(output_unit, it, etot, ediff, pred, rat, step, rad, emin, &
711 pres_int, wildcard, used_time, max_memory, energy_unit, stress_unit)
713 INTEGER,
INTENT(IN) :: output_unit, it
714 REAL(kind=dp),
INTENT(IN) :: etot
715 REAL(kind=dp),
INTENT(IN),
OPTIONAL :: ediff, pred, rat, step, rad, emin, &
717 CHARACTER(LEN=5),
INTENT(IN) :: wildcard
718 REAL(kind=dp),
INTENT(IN) :: used_time
719 INTEGER(KIND=int_8),
INTENT(IN) :: max_memory
720 CHARACTER(LEN=default_string_length),
INTENT(IN) :: energy_unit, stress_unit
722 CHARACTER(LEN=5) :: tag
724 IF (output_unit > 0)
THEN
726 WRITE (unit=output_unit, fmt=
"(/,T2,A)") tag//repeat(
"*", 74)
727 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,I25)") &
728 tag//
"Step number", it
729 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,A25)") &
730 tag//
"Optimization method", wildcard
731 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
732 tag//
"Total energy ["//trim(adjustl(energy_unit))//
"]", &
733 cp_unit_from_cp2k(etot, trim(energy_unit))
734 IF (
PRESENT(pres_int))
THEN
735 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
736 tag//
"Internal pressure ["//trim(adjustl(stress_unit))//
"]", &
737 cp_unit_from_cp2k(pres_int, trim(stress_unit))
739 IF (
PRESENT(ediff))
THEN
740 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
741 tag//
"Effective energy change ["//trim(adjustl(energy_unit))//
"]", &
742 cp_unit_from_cp2k(ediff, trim(energy_unit))
744 IF (
PRESENT(pred))
THEN
745 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
746 tag//
"Predicted energy change ["//trim(adjustl(energy_unit))//
"]", &
747 cp_unit_from_cp2k(pred, trim(energy_unit))
749 IF (
PRESENT(rat))
THEN
750 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
751 tag//
"Scaling factor", rat
753 IF (
PRESENT(step))
THEN
754 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
755 tag//
"Step size", step
757 IF (
PRESENT(rad))
THEN
758 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
759 tag//
"Trust radius", rad
761 IF (
PRESENT(emin))
THEN
762 IF (etot < emin)
THEN
763 WRITE (unit=output_unit, fmt=
"(T2,A,T77,A4)") &
764 tag//
"Decrease in energy",
" YES"
766 WRITE (unit=output_unit, fmt=
"(T2,A,T77,A4)") &
767 tag//
"Decrease in energy",
" NO"
770 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.3)") &
771 tag//
"Used time [s]", used_time
773 WRITE (unit=output_unit, fmt=
"(T2,A)") tag//repeat(
"*", 74)
774 IF (max_memory /= 0)
THEN
775 WRITE (unit=output_unit, fmt=
"(T2,A,T60,1X,I20)") &
776 tag//
"Estimated peak process memory [MiB]", &
777 (max_memory + bytes_per_mib - 1)/bytes_per_mib
782 END SUBROUTINE write_cycle_infos
798 SUBROUTINE write_rot_cycle_infos(output_unit, it, etot, ediff, emin, dimer_env, used_time, &
799 wildcard, max_memory)
801 INTEGER,
INTENT(IN) :: output_unit, it
802 REAL(kind=dp),
INTENT(IN) :: etot
803 REAL(kind=dp),
INTENT(IN),
OPTIONAL :: ediff, emin
804 TYPE(dimer_env_type),
POINTER :: dimer_env
805 REAL(kind=dp),
INTENT(IN) :: used_time
806 CHARACTER(LEN=5),
INTENT(IN) :: wildcard
807 INTEGER(KIND=int_8),
INTENT(IN) :: max_memory
809 CHARACTER(LEN=5) :: tag
811 IF (output_unit > 0)
THEN
813 WRITE (unit=output_unit, fmt=
"(/,T2,A)") tag//repeat(
"*", 74)
814 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,I25)") &
815 tag//
"Rotational step number", it
816 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,A25)") &
817 tag//
"Optimization method", wildcard
818 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
819 tag//
"Local curvature", dimer_env%rot%curvature, &
820 tag//
"Total rotational force", etot
821 IF (
PRESENT(ediff))
THEN
822 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
823 tag//
"Rotational force change", ediff
825 IF (
PRESENT(emin))
THEN
826 IF (etot < emin)
THEN
827 WRITE (unit=output_unit, fmt=
"(T2,A,T77,A4)") &
828 tag//
"Decrease in rotational force",
" YES"
830 WRITE (unit=output_unit, fmt=
"(T2,A,T77,A4)") &
831 tag//
"Decrease in rotational force",
" NO"
834 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.3)") &
835 tag//
"Used time [s]", used_time
837 WRITE (unit=output_unit, fmt=
"(T2,A)") tag//repeat(
"*", 74)
838 IF (max_memory /= 0)
THEN
839 WRITE (unit=output_unit, fmt=
"(T2,A,T60,1X,I20)") &
840 tag//
"Estimated peak process memory [MiB]", &
841 (max_memory + bytes_per_mib - 1)/bytes_per_mib
846 END SUBROUTINE write_rot_cycle_infos
868 SUBROUTINE check_converg(ndf, dr, g, gopt_param, conv, conv_dx, conv_rdx, conv_g, conv_rg, conv_p, &
869 max_dr, rms_dr, max_grad, rms_grad, pres_diff, pres_tol, pres_diff_constr)
871 INTEGER,
INTENT(IN) :: ndf
872 REAL(kind=dp),
INTENT(IN) :: dr(ndf), g(ndf)
873 TYPE(gopt_param_type),
POINTER :: gopt_param
874 LOGICAL,
INTENT(OUT) :: conv, conv_dx, conv_rdx, conv_g, &
876 REAL(kind=dp),
INTENT(OUT) :: max_dr, rms_dr, max_grad, rms_grad
877 REAL(kind=dp),
INTENT(IN),
OPTIONAL :: pres_diff, pres_tol, pres_diff_constr
880 REAL(kind=dp) :: dumm, dxcon, gcon, rmsgcon, rmsxcon
882 dxcon = gopt_param%max_dr
883 gcon = gopt_param%max_force
884 rmsgcon = gopt_param%rms_force
885 rmsxcon = gopt_param%rms_dr
896 IF (indf == 1) max_dr = abs(dr(indf))
897 dumm = dumm + dr(indf)**2
898 IF (abs(dr(indf)) > dxcon) conv_dx = .false.
899 IF (abs(dr(indf)) > max_dr) max_dr = abs(dr(indf))
902 IF (dumm > (rmsxcon*rmsxcon*ndf)) conv_rdx = .false.
903 rms_dr = sqrt(dumm/ndf)
907 IF (indf == 1) max_grad = abs(g(indf))
908 dumm = dumm + g(indf)**2
909 IF (abs(g(indf)) > gcon) conv_g = .false.
910 IF (abs(g(indf)) > max_grad) max_grad = abs(g(indf))
913 IF (dumm > (rmsgcon*rmsgcon*ndf)) conv_rg = .false.
914 rms_grad = sqrt(dumm/ndf)
916 IF (
PRESENT(pres_diff_constr) .AND.
PRESENT(pres_tol))
THEN
917 conv_p = abs(pres_diff_constr) < abs(pres_tol)
918 ELSE IF (
PRESENT(pres_diff) .AND.
PRESENT(pres_tol))
THEN
919 conv_p = abs(pres_diff) < abs(pres_tol)
922 IF (conv_dx .AND. conv_rdx .AND. conv_g .AND. conv_rg .AND. conv_p) conv = .true.
924 END SUBROUTINE check_converg
933 SUBROUTINE write_conv_flag(output_unit, tag, label, flag)
934 INTEGER,
INTENT(IN) :: output_unit
935 CHARACTER(LEN=*),
INTENT(IN) :: tag, label
936 LOGICAL,
INTENT(IN) :: flag
939 WRITE (unit=output_unit, fmt=
"(T2,A,T77,A4)") tag//label,
" YES"
941 WRITE (unit=output_unit, fmt=
"(T2,A,T77,A4)") tag//label,
" NO"
943 END SUBROUTINE write_conv_flag
965 SUBROUTINE write_convergence_infos(output_unit, gopt_param, conv, conv_dx, conv_rdx, conv_g, &
966 conv_rg, conv_p, max_dr, rms_dr, max_grad, rms_grad, &
967 max_memory, stress_unit, pres_diff, pres_tol, pres_diff_constr)
969 INTEGER,
INTENT(IN) :: output_unit
970 TYPE(gopt_param_type),
POINTER :: gopt_param
971 LOGICAL,
INTENT(IN) :: conv, conv_dx, conv_rdx, conv_g, &
973 REAL(kind=dp),
INTENT(IN) :: max_dr, rms_dr, max_grad, rms_grad
974 INTEGER(KIND=int_8),
INTENT(IN) :: max_memory
975 CHARACTER(LEN=default_string_length),
INTENT(IN) :: stress_unit
976 REAL(kind=dp),
INTENT(IN),
OPTIONAL :: pres_diff, pres_tol, pres_diff_constr
978 CHARACTER(LEN=5) :: tag
979 REAL(kind=dp) :: dxcon, gcon, rmsgcon, rmsxcon
981 dxcon = gopt_param%max_dr
982 gcon = gopt_param%max_force
983 rmsgcon = gopt_param%rms_force
984 rmsxcon = gopt_param%rms_dr
986 IF (output_unit > 0)
THEN
990 WRITE (unit=output_unit, fmt=
"(T2,A)") trim(tag)
991 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
992 tag//
"Maximum step size", max_dr, &
993 tag//
"Convergence limit for maximum step size", dxcon
994 CALL write_conv_flag(output_unit, tag,
"Maximum step size is converged", &
997 WRITE (unit=output_unit, fmt=
"(T2,A)") trim(tag)
998 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
999 tag//
"RMS step size", rms_dr, &
1000 tag//
"Convergence limit for RMS step size", rmsxcon
1001 CALL write_conv_flag(output_unit, tag,
"RMS step size is converged", &
1004 WRITE (unit=output_unit, fmt=
"(T2,A)") trim(tag)
1005 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
1006 tag//
"Maximum gradient", max_grad, &
1007 tag//
"Convergence limit for maximum gradient", gcon
1008 CALL write_conv_flag(output_unit, tag,
"Maximum gradient is converged", &
1011 WRITE (unit=output_unit, fmt=
"(T2,A)") trim(tag)
1012 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
1013 tag//
"RMS gradient", rms_grad, &
1014 tag//
"Convergence limit for RMS gradient", rmsgcon
1015 CALL write_conv_flag(output_unit, tag,
"RMS gradient is converged", &
1018 IF (
PRESENT(pres_diff) .AND.
PRESENT(pres_tol))
THEN
1019 WRITE (unit=output_unit, fmt=
"(T2,A)") trim(tag)
1020 IF (
PRESENT(pres_diff_constr))
THEN
1021 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
1022 tag//
"Pressure deviation without constraint ["// &
1023 trim(adjustl(stress_unit))//
"]", &
1024 cp_unit_from_cp2k(pres_diff, trim(stress_unit))
1025 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
1026 tag//
"Pressure deviation with constraint ["// &
1027 trim(adjustl(stress_unit))//
"]", &
1028 cp_unit_from_cp2k(pres_diff_constr, trim(stress_unit))
1030 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
1031 tag//
"Pressure deviation ["//trim(adjustl(stress_unit))//
"]", &
1032 cp_unit_from_cp2k(pres_diff, trim(stress_unit))
1034 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
1035 tag//
"Pressure tolerance ["//trim(adjustl(stress_unit))//
"]", &
1036 cp_unit_from_cp2k(pres_tol, trim(stress_unit))
1037 CALL write_conv_flag(output_unit, tag,
"Pressure is converged", conv_p)
1040 WRITE (unit=output_unit, fmt=
"(T2,A)") tag//repeat(
"*", 74)
1042 IF (max_memory /= 0)
THEN
1043 WRITE (unit=output_unit, fmt=
"(T2,A,T60,1X,I20)") &
1044 tag//
"Estimated peak process memory after this step [MiB]", &
1045 (max_memory + bytes_per_mib - 1)/bytes_per_mib
1050 IF ((conv) .AND. (output_unit > 0))
THEN
1051 WRITE (unit=output_unit, fmt=
"(/,T2,A)") repeat(
"*", 79)
1052 WRITE (unit=output_unit, fmt=
"(T2,A,T25,A,T78,A)") &
1053 "***",
"GEOMETRY OPTIMIZATION COMPLETED",
"***"
1054 WRITE (unit=output_unit, fmt=
"(T2,A)") repeat(
"*", 79)
1057 END SUBROUTINE write_convergence_infos
1073 SUBROUTINE check_and_report_convergence(output_unit, gopt_param, ndf, dr, g, conv, &
1074 max_memory, stress_unit, pres_diff, pres_tol, pres_diff_constr)
1076 INTEGER,
INTENT(IN) :: output_unit
1077 TYPE(gopt_param_type),
POINTER :: gopt_param
1078 INTEGER,
INTENT(IN) :: ndf
1079 REAL(kind=dp),
INTENT(IN) :: dr(ndf), g(ndf)
1080 LOGICAL,
INTENT(INOUT) :: conv
1081 INTEGER(KIND=int_8),
INTENT(IN) :: max_memory
1082 CHARACTER(LEN=default_string_length),
INTENT(IN) :: stress_unit
1083 REAL(kind=dp),
INTENT(IN),
OPTIONAL :: pres_diff, pres_tol, pres_diff_constr
1085 LOGICAL :: conv_dx, conv_g, conv_p, conv_rdx, &
1087 REAL(kind=dp) :: max_dr, max_grad, rms_dr, rms_grad
1089 CALL check_converg(ndf, dr, g, gopt_param, conv, conv_dx, conv_rdx, conv_g, conv_rg, &
1090 conv_p, max_dr, rms_dr, max_grad, rms_grad, pres_diff, pres_tol, &
1092 CALL write_convergence_infos(output_unit, gopt_param, conv, conv_dx, conv_rdx, conv_g, &
1093 conv_rg, conv_p, max_dr, rms_dr, max_grad, rms_grad, &
1094 max_memory, stress_unit, pres_diff, pres_tol, pres_diff_constr)
1095 END SUBROUTINE check_and_report_convergence
1105 SUBROUTINE check_rot_conv(dimer_env, output_unit, conv)
1107 TYPE(dimer_env_type),
POINTER :: dimer_env
1108 INTEGER,
INTENT(IN) :: output_unit
1109 LOGICAL,
INTENT(OUT) :: conv
1111 CHARACTER(LEN=5) :: tag
1113 conv = (abs(dimer_env%rot%angle2) < dimer_env%rot%angle_tol)
1115 IF (output_unit > 0)
THEN
1117 WRITE (unit=output_unit, fmt=
"(T2,A)") trim(tag)
1118 WRITE (unit=output_unit, fmt=
"(T2,A,T55,1X,F25.10)") &
1119 tag//
"Predicted angle step size", dimer_env%rot%angle1, &
1120 tag//
"Effective angle step size", dimer_env%rot%angle2, &
1121 tag//
"Convergence limit for angle step size", dimer_env%rot%angle_tol
1122 CALL write_conv_flag(output_unit, tag,
"Angle step size is converged", conv)
1123 WRITE (unit=output_unit, fmt=
"(T2,A)") tag//repeat(
"*", 74)
1126 IF ((conv) .AND. (output_unit > 0))
THEN
1127 WRITE (unit=output_unit, fmt=
"(/,T2,A)") repeat(
"*", 79)
1128 WRITE (unit=output_unit, fmt=
"(T2,A,T25,A,T78,A)") &
1129 "***",
"ROTATION OPTIMIZATION COMPLETED",
"***"
1130 WRITE (unit=output_unit, fmt=
"(T2,A)") repeat(
"*", 79)
1133 END SUBROUTINE check_rot_conv
1150 RECURSIVE SUBROUTINE write_final_info(output_unit, conv, it, gopt_env, x0, master, para_env, force_env, &
1151 motion_section, root_section)
1152 INTEGER,
INTENT(IN) :: output_unit
1153 LOGICAL,
INTENT(IN) :: conv
1154 INTEGER,
INTENT(INOUT) :: it
1155 TYPE(gopt_f_type),
POINTER :: gopt_env
1156 REAL(kind=dp),
DIMENSION(:),
POINTER :: x0
1157 INTEGER,
INTENT(IN) :: master
1158 TYPE(mp_para_env_type),
POINTER :: para_env
1159 TYPE(force_env_type),
POINTER :: force_env
1160 TYPE(section_vals_type),
POINTER :: motion_section, root_section
1162 CHARACTER(LEN=default_string_length) :: constraint_label
1163 LOGICAL :: keep_angles, keep_symmetry, keep_volume
1164 REAL(kind=dp) :: etot
1165 TYPE(cell_type),
POINTER :: cell
1166 TYPE(cp_subsys_type),
POINTER :: subsys
1167 TYPE(particle_list_type),
POINTER :: particles
1168 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
1170 CALL force_env_get(force_env, cell=cell, subsys=subsys)
1171 CALL cp_subsys_get(subsys=subsys, particles=particles)
1172 particle_set => particles%els
1177 keep_angles = .true.
1178 keep_symmetry = .true.
1179 keep_volume = .true.
1180 constraint_label =
"NONE"
1181 IF (gopt_env%type_id == default_cell_method_id)
THEN
1182 keep_angles = gopt_env%cell_env%keep_angles
1183 keep_symmetry = gopt_env%cell_env%keep_symmetry
1184 keep_volume = gopt_env%cell_env%keep_volume
1185 constraint_label = cell_opt_constraint_label(gopt_env%cell_env%constraint_id)
1187 CALL write_final_structure(particle_set, cell, motion_section, conv, &
1188 keep_angles, keep_symmetry, keep_volume, &
1189 gopt_env%label, constraint_label)
1193 CALL write_structure_data(particle_set, cell, motion_section)
1194 CALL write_restart(force_env=force_env, root_section=root_section)
1196 IF (output_unit > 0)
THEN
1197 WRITE (unit=output_unit, fmt=
"(/,T20,' Reevaluating energy at the minimum')")
1200 CALL cp_eval_at(gopt_env, x0, f=etot, master=master, &
1202 CALL write_geo_traj(force_env, root_section, it, etot)
1203 CALL write_simulation_cell(cell, motion_section, it, 0.0_dp)
1206 END SUBROUTINE write_final_info
1219 SUBROUTINE write_geo_traj(force_env, root_section, it, etot)
1221 TYPE(force_env_type),
POINTER :: force_env
1222 TYPE(section_vals_type),
POINTER :: root_section
1223 INTEGER,
INTENT(IN) :: it
1224 REAL(kind=dp),
INTENT(IN) :: etot
1226 LOGICAL :: shell_adiabatic, shell_present
1227 TYPE(atomic_kind_list_type),
POINTER :: atomic_kinds
1228 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
1229 TYPE(cp_subsys_type),
POINTER :: subsys
1230 TYPE(particle_list_type),
POINTER :: core_particles, shell_particles
1232 NULLIFY (atomic_kinds)
1233 NULLIFY (atomic_kind_set)
1234 NULLIFY (core_particles)
1235 NULLIFY (shell_particles)
1238 CALL write_trajectory(force_env, root_section, it, 0.0_dp, 0.0_dp, etot)
1240 CALL write_trajectory(force_env, root_section, it, 0.0_dp, 0.0_dp, etot,
"FORCES", middle_name=
"frc")
1241 CALL force_env_get(force_env, subsys=subsys)
1242 CALL cp_subsys_get(subsys, atomic_kinds=atomic_kinds)
1243 atomic_kind_set => atomic_kinds%els
1244 CALL get_atomic_kind_set(atomic_kind_set, &
1245 shell_present=shell_present, &
1246 shell_adiabatic=shell_adiabatic)
1247 IF (shell_present)
THEN
1248 CALL cp_subsys_get(subsys, &
1249 core_particles=core_particles, &
1250 shell_particles=shell_particles)
1251 CALL write_trajectory(force_env, root_section, it=it, time=0.0_dp, dtime=0.0_dp, &
1252 etot=etot, pk_name=
"SHELL_TRAJECTORY", middle_name=
"shpos", &
1253 particles=shell_particles)
1254 IF (shell_adiabatic)
THEN
1255 CALL write_trajectory(force_env, root_section, it=it, time=0.0_dp, dtime=0.0_dp, &
1256 etot=etot, pk_name=
"SHELL_FORCES", middle_name=
"shfrc", &
1257 particles=shell_particles)
1258 CALL write_trajectory(force_env, root_section, it=it, time=0.0_dp, dtime=0.0_dp, &
1259 etot=etot, pk_name=
"CORE_TRAJECTORY", middle_name=
"copos", &
1260 particles=core_particles)
1261 CALL write_trajectory(force_env, root_section, it=it, time=0.0_dp, dtime=0.0_dp, &
1262 etot=etot, pk_name=
"CORE_FORCES", middle_name=
"cofrc", &
1263 particles=core_particles)
1267 END SUBROUTINE write_geo_traj
1279 TYPE(gopt_f_type),
POINTER :: gopt_env
1280 INTEGER,
INTENT(IN) :: output_unit
1281 CHARACTER(LEN=*),
INTENT(IN) :: label
1283 CHARACTER(LEN=default_string_length) :: my_format, my_label
1286 IF (output_unit > 0)
THEN
1287 WRITE (unit=output_unit, fmt=
"(/,T2,A)") repeat(
"*", 79)
1288 IF (gopt_env%dimer_rotation)
THEN
1289 my_label =
"OPTIMIZING DIMER ROTATION"
1291 my_label =
"STARTING "//gopt_env%tag(1:8)//
" OPTIMIZATION"
1294 ix = (80 - 7 - len_trim(my_label))/2
1296 my_format =
"(T2,A,T"//cp_to_string(ix)//
",A,T78,A)"
1297 WRITE (unit=output_unit, fmt=trim(my_format))
"***", trim(my_label),
"***"
1299 ix = (80 - 7 - len_trim(label))/2
1301 my_format =
"(T2,A,T"//cp_to_string(ix)//
",A,T78,A)"
1302 WRITE (unit=output_unit, fmt=trim(my_format))
"***", trim(label),
"***"
1304 WRITE (unit=output_unit, fmt=
"(T2,A)") repeat(
"*", 79)
1305 CALL m_flush(output_unit)
1318 TYPE(gopt_f_type),
POINTER :: gopt_env
1319 INTEGER,
INTENT(IN) :: output_unit
1321 IF (output_unit > 0)
THEN
1322 WRITE (unit=output_unit, fmt=
"(/,T2,A)") &
1323 "*** MAXIMUM NUMBER OF OPTIMIZATION STEPS REACHED ***"
1324 IF (.NOT. gopt_env%dimer_rotation)
THEN
1325 WRITE (unit=output_unit, fmt=
"(T2,A)") &
1326 "*** EXITING GEOMETRY OPTIMIZATION ***"
1328 WRITE (unit=output_unit, fmt=
"(T2,A)") &
1329 "*** EXITING ROTATION OPTIMIZATION ***"
1331 CALL m_flush(output_unit)
1347 SUBROUTINE geo_opt_io(force_env, root_section, motion_section, its, opt_energy)
1349 TYPE(force_env_type),
POINTER :: force_env
1350 TYPE(section_vals_type),
POINTER :: root_section, motion_section
1351 INTEGER,
INTENT(IN) :: its
1352 REAL(kind=dp),
INTENT(IN) :: opt_energy
1354 TYPE(atomic_kind_list_type),
POINTER :: atomic_kinds
1355 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
1356 TYPE(cell_type),
POINTER :: cell
1357 TYPE(cp_subsys_type),
POINTER :: subsys
1358 TYPE(distribution_1d_type),
POINTER :: local_particles
1359 TYPE(mp_para_env_type),
POINTER :: para_env
1360 TYPE(particle_list_type),
POINTER :: particles
1361 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
1362 TYPE(virial_type),
POINTER :: virial
1364 NULLIFY (para_env, atomic_kind_set, subsys, particle_set, &
1365 local_particles, atomic_kinds, particles)
1368 CALL write_restart(force_env=force_env, root_section=root_section)
1371 CALL write_geo_traj(force_env, root_section, its, opt_energy)
1374 CALL force_env_get(force_env, cell=cell, para_env=para_env, &
1376 CALL cp_subsys_get(subsys=subsys, atomic_kinds=atomic_kinds, local_particles=local_particles, &
1377 particles=particles, virial=virial)
1378 atomic_kind_set => atomic_kinds%els
1379 particle_set => particles%els
1380 CALL virial_evaluate(atomic_kind_set, particle_set, local_particles, &
1382 CALL write_stress_tensor_to_file(virial, cell, motion_section, its, 0.0_dp)
1385 CALL write_simulation_cell(cell, motion_section, its, 0.0_dp)
1387 END SUBROUTINE geo_opt_io
1401 TYPE(gopt_f_type),
POINTER :: gopt_env
1402 TYPE(cell_type),
POINTER :: cell
1403 REAL(kind=dp),
DIMENSION(:),
POINTER :: x
1404 LOGICAL,
INTENT(IN) :: update_forces
1406 INTEGER :: i, iatom, idg, j, natom, nparticle, &
1408 REAL(kind=dp) :: fc, fs, mass
1409 REAL(kind=dp),
DIMENSION(3) :: s
1410 TYPE(cell_type),
POINTER :: cell_ref
1411 TYPE(cp_subsys_type),
POINTER :: subsys
1412 TYPE(particle_list_type),
POINTER :: core_particles, particles, &
1416 NULLIFY (core_particles)
1418 NULLIFY (shell_particles)
1421 natom = force_env_get_natom(gopt_env%force_env)
1422 nparticle = force_env_get_nparticle(gopt_env%force_env)
1423 CALL force_env_get(gopt_env%force_env, &
1425 CALL cp_subsys_get(subsys=subsys, &
1426 core_particles=core_particles, &
1427 particles=particles, &
1428 shell_particles=shell_particles)
1431 CALL cell_create(cell_ref)
1432 CALL cell_copy(cell, cell_ref, tag=
"CELL_OPT_REF")
1436 CALL init_cell(cell_ref, hmat=gopt_env%h_ref)
1437 cpassert((
SIZE(x) == idg + 6))
1439 IF (update_forces)
THEN
1444 CALL real_to_scaled(s, x(idg:idg + 2), cell)
1445 CALL scaled_to_real(x(idg:idg + 2), s, cell_ref)
1452 gopt_env%cell_env%opt_cell%hmat = 0.0_dp
1456 gopt_env%cell_env%opt_cell%hmat(j, i) = x(idg)
1459 CALL init_cell(gopt_env%cell_env%opt_cell)
1460 IF (gopt_env%spgr%keep_space_group)
THEN
1461 CALL spgr_project_cell_metric(gopt_env%spgr, gopt_env%cell_env%opt_cell)
1467 x(idg) = gopt_env%cell_env%opt_cell%hmat(j, i)
1473 cell%hmat = matmul(gopt_env%cell_env%opt_to_input, &
1474 gopt_env%cell_env%opt_cell%hmat)
1475 CALL init_cell(cell)
1476 CALL cp_subsys_set(subsys, cell=cell)
1481 CALL real_to_scaled(s, x(idg:idg + 2), cell_ref)
1482 shell_index = particles%els(iatom)%shell_index
1483 IF (shell_index == 0)
THEN
1484 CALL scaled_to_real(particles%els(iatom)%r, s, cell)
1486 CALL scaled_to_real(core_particles%els(shell_index)%r, s, cell)
1487 i = 3*(natom + shell_index - 1) + 1
1488 CALL real_to_scaled(s, x(i:i + 2), cell_ref)
1489 CALL scaled_to_real(shell_particles%els(shell_index)%r, s, cell)
1491 mass = particles%els(iatom)%atomic_kind%mass
1492 fc = core_particles%els(shell_index)%atomic_kind%shell%mass_core/mass
1493 fs = shell_particles%els(shell_index)%atomic_kind%shell%mass_shell/mass
1494 particles%els(iatom)%r(1:3) = fc*core_particles%els(shell_index)%r(1:3) + &
1495 fs*shell_particles%els(shell_index)%r(1:3)
1501 CALL cell_release(cell_ref)
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.
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public henkelman1999
Handles all functions related to the CELL.
subroutine, public write_cell(cell, subsys_section, tag)
Write the cell parameters to the output unit.
subroutine, public init_cell(cell, hmat, periodic)
Initialise/readjust a simulation cell after hmat has been changed.
subroutine, public cell_create(cell, hmat, periodic, tag)
allocates and initializes a cell
contains a functional that calculates the energy and its derivatives for the geometry optimizer
subroutine, public rescale_new_cell_volume(vol, x, idg)
Rescale x(idg+1:idg+6) according to vol.
subroutine, public get_dg_dh(gradient, av_ptens, pres_ext, cell, mtrx, keep_angles, keep_symmetry, pres_int, pres_constr, constraint_id)
Computes the derivatives for the cell.
pure character(len=default_string_length) function, public cell_opt_constraint_label(mask)
Returns the label of the consolidated cell constraint mask.
Handles all functions related to the CELL.
subroutine, public scaled_to_real(r, s, cell)
Transform scaled cell coordinates real coordinates. r=h*s.
subroutine, public real_to_scaled(s, r, cell)
Transform real to scaled cell coordinates. s=h_inv*r.
subroutine, public cell_release(cell)
releases the given cell (see doc/ReferenceCounting.html)
subroutine, public cell_copy(cell_in, cell_out, tag)
Copy cell variable.
various routines to log and control the output. The idea is that decisions about where to log should ...
types that represent a subsys, i.e. a part of the system
subroutine, public cp_subsys_set(subsys, atomic_kinds, particles, local_particles, molecules, molecule_kinds, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, results, cell, cell_ref, use_ref_cell)
sets various propreties of the subsys
subroutine, public unpack_subsys_particles(subsys, f, r, s, v, fscale, cell)
Unpack components of a subsystem particle sets into a single vector.
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
subroutine, public pack_subsys_particles(subsys, f, r, s, v, fscale, cell)
Pack components of a subsystem particle sets into a single vector.
real(kind=dp) function, public cp_unit_from_cp2k(value, unit_str, defaults, power)
converts from the internal cp2k units to the given unit
Contains types used for a Dimer Method calculations.
recursive subroutine, public cp_eval_at_ts(gopt_env, x, f, gradient, calc_force)
Computes the dimer energy/gradients (including the rotation of the dimer).
Contains types used for a Dimer Method calculations.
Contains utilities for a Dimer Method calculations.
subroutine, public update_dimer_vec(dimer_env, motion_section)
Updates the orientation of the dimer vector in the input file.
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
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.
integer function, public force_env_get_natom(force_env)
returns the number of atoms
integer, parameter, public use_qmmm
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
integer, parameter, public use_qmmmx
integer function, public force_env_get_nparticle(force_env)
returns the number of particles in a force environment
contains a functional that calculates the energy and its derivatives for the geometry optimizer
subroutine, public print_geo_opt_header(gopt_env, output_unit, label)
...
subroutine, public gopt_f_io_init(gopt_env, output_unit, opt_energy, wildcard, its, used_time)
Handles the Output during an optimization run.
subroutine, public gopt_f_create_x0(gopt_env, x0)
returns the value of the parameters for the actual configuration
recursive subroutine, public gopt_f_io_finalize(gopt_env, force_env, x0, conv, its, root_section, para_env, master, output_unit)
Handles the Output at the end of an optimization run.
subroutine, public apply_cell_change(gopt_env, cell, x, update_forces)
Apply coordinate transformations after cell (shape) change.
subroutine, public gopt_f_io(gopt_env, force_env, root_section, its, opt_energy, output_unit, eold, emin, wildcard, gopt_param, ndf, dx, xi, conv, pred, rat, step, rad, used_time)
Handles the Output during an optimization run.
subroutine, public print_geo_opt_nc(gopt_env, output_unit)
...
subroutine, public cp_eval_at(gopt_env, x, f, gradient, master, para_env)
evaluete the potential energy and its gradients using an array with same dimension as the particle_se...
subroutine, public gopt_f_ii(its, output_unit)
Prints iteration step of the optimization procedure on screen.
contains a functional that calculates the energy and its derivatives for the geometry optimizer
contains typo and related routines to handle parameters controlling the GEO_OPT module
Defines the basic variable types.
integer, parameter, public int_8
integer, parameter, public dp
integer, parameter, public default_string_length
Machine interface based on Fortran 2003 and POSIX.
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
prints all energy info per timestep to the screen or to user defined output files
integer(kind=int_8) function, public sample_memory(para_env)
Samples memory usage.
Interface to the message passing library MPI.
Output Utilities for MOTION_SECTION.
subroutine, public write_simulation_cell(cell, motion_section, itimes, time, pos, act)
Prints the Simulation Cell.
subroutine, public write_trajectory(force_env, root_section, it, time, dtime, etot, pk_name, pos, act, middle_name, particles, extended_xmol_title)
Prints the information controlled by the TRAJECTORY section.
subroutine, public write_stress_tensor_to_file(virial, cell, motion_section, itimes, time, pos, act)
Prints the Stress Tensor.
represent a simple array based list of the given type
Define methods related to particle_type.
subroutine, public write_final_structure(particle_set, cell, input_section, conv, keep_angles, keep_symmetry, keep_volume, gopt_env_label, constraint_label)
Write the final geometry and cell information to files.
subroutine, public write_structure_data(particle_set, cell, input_section)
Write structure data requested by a separate structure data input section to the output unit....
Define the data structure for the particle information.
subroutine, public apply_qmmm_translate(qmmm_env)
Apply translation to the full system in order to center the QM system into the QM box.
Routines used for force-mixing QM/MM calculations.
subroutine, public apply_qmmmx_translate(qmmmx_env)
Apply translation to the full system in order to center the QM system into the QM box.
Space Group Symmetry Type Module (version 1.0, Ferbruary 12, 2021).
Space Group Symmetry Module (version 1.0, January 16, 2020).
subroutine, public spgr_apply_rotations_stress(spgr, cell, stress)
routine applies the rotation matrices to the stress tensor.
subroutine, public spgr_project_cell_metric(spgr, cell)
Project a cell onto the metric preserved by the selected space-group rotations.
subroutine, public spgr_apply_rotations_force(spgr, force)
routine applies the rotation matrices to the forces.
subroutine, public spgr_write_stress_tensor(stress, spgr)
Variable precision output of the symmetrized stress tensor.
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).
subroutine, public virial_update(virial, subsys, para_env)
Updates the virial given the virial and subsys.
represent a list of objects
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
represents a system: atoms, molecules, their pos,vel,...
Defines the environment for a Dimer Method calculation.
structure to store local (to a processor) ordered lists of integers.
wrapper to abstract the force evaluation of the various methods
calculates the potential energy of a system, and its derivatives
stores all the informations relevant to an mpi environment
represent a list of objects