96#include "./base/base_uses.f90"
103 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'optimize_basis'
122 CHARACTER(len=*),
PARAMETER :: routinen =
'run_optimize_basis'
125 LOGICAL :: frontier_orbitals_explicit, &
126 frontier_screening_explicit
129 frontier_screening_section, &
132 CALL timeset(routinen, handle)
136 frontier_screening_section => &
138 CALL section_vals_get(frontier_orbitals_section, explicit=frontier_orbitals_explicit)
139 CALL section_vals_get(frontier_screening_section, explicit=frontier_screening_explicit)
141 IF (frontier_orbitals_explicit .AND. frontier_screening_explicit)
THEN
142 cpabort(
"FRONTIER_ORBITALS and FRONTIER_ORBITAL_SCREENING cannot be activated together")
145 IF (frontier_screening_explicit)
THEN
147 input_declaration, root_section, para_env, globenv, frontier_screening_section, driver_para_opt_basis)
150 CALL driver_para_opt_basis(opt_bas, input_declaration, para_env, globenv)
154 CALL timestop(handle)
169 SUBROUTINE driver_para_opt_basis(opt_bas, input_declaration, para_env, globenv, training_input, reference)
176 DIMENSION(:),
INTENT(IN),
OPTIONAL,
TARGET :: reference
178 CHARACTER(len=*),
PARAMETER :: routinen =
'driver_para_opt_basis'
180 INTEGER :: handle, n_groups_created
182 INTEGER,
DIMENSION(:),
POINTER :: group_distribution_p
183 INTEGER,
DIMENSION(0:para_env%num_pe-1),
TARGET :: group_distribution
185 CALL timeset(routinen, handle)
186 group_distribution_p => group_distribution
187 CALL opt_group%from_split(para_env, n_groups_created, group_distribution_p, &
188 n_subgroups=
SIZE(opt_bas%group_partition), group_partition=opt_bas%group_partition)
189 opt_bas%opt_id = group_distribution(para_env%mepos) + 1
190 opt_bas%n_groups_created = n_groups_created
191 ALLOCATE (opt_bas%sub_sources(0:para_env%num_pe - 1))
193 IF (
PRESENT(training_input))
THEN
194 cpassert(
PRESENT(reference))
195 CALL driver_optimization_para_low(opt_bas, input_declaration, para_env, opt_group, &
196 globenv, training_input, reference)
198 CALL driver_optimization_para_low(opt_bas, input_declaration, para_env, opt_group, globenv)
201 CALL opt_group%free()
202 CALL timestop(handle)
204 END SUBROUTINE driver_para_opt_basis
219 SUBROUTINE driver_optimization_para_low(opt_bas, input_declaration, para_env_top, mpi_comm_opt, &
220 globenv, training_input, reference)
228 DIMENSION(:),
INTENT(IN),
OPTIONAL,
TARGET :: reference
230 CHARACTER(len=*),
PARAMETER :: routinen =
'driver_optimization_para_low'
232 INTEGER :: handle, icalc, iopt, is, mp_id, &
233 outer_print_level, stat
234 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: f_env_id
236 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: tot_time
237 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:) :: matrix_s_inv
241 ALLOCATABLE,
DIMENSION(:),
TARGET :: local_reference
243 DIMENSION(:),
POINTER :: active_reference
245 DIMENSION(:) :: initial_info, optimized_info
248 DIMENSION(:),
TARGET :: training_qs_env
250 NULLIFY (active_reference, f_env, logger)
252 CALL timeset(routinen, handle)
255 mp_id = opt_bas%opt_id
257 NULLIFY (para_env, f_env)
258 ALLOCATE (f_env_id(
SIZE(opt_bas%comp_group(mp_id)%member_list)), source=-1)
259 ALLOCATE (tot_time(opt_bas%ncombinations*opt_bas%ntraining_sets))
261 ALLOCATE (matrix_s_inv(
SIZE(opt_bas%comp_group(mp_id)%member_list)))
263 ALLOCATE (initial_info(opt_bas%ncombinations*opt_bas%ntraining_sets))
264 ALLOCATE (optimized_info(opt_bas%ncombinations*opt_bas%ntraining_sets))
265 IF (
PRESENT(reference))
THEN
266 active_reference => reference
268 ALLOCATE (local_reference(
SIZE(opt_bas%comp_group(mp_id)%member_list)))
269 active_reference => local_reference
274 para_env = mpi_comm_opt
277 IF (para_env%is_source()) is = para_env_top%mepos
278 CALL para_env_top%allgather(is, opt_bas%sub_sources)
280 IF (use_direct_qs)
THEN
281 ALLOCATE (training_qs_env(
SIZE(opt_bas%comp_group(mp_id)%member_list)))
283 outer_print_level = logger%iter_info%print_level
285 IF (
PRESENT(training_input))
THEN
286 CALL init_training_qs_envs(opt_bas, training_qs_env, input_declaration, para_env, globenv, &
287 training_input=training_input)
289 CALL init_training_qs_envs(opt_bas, training_qs_env, input_declaration, para_env, globenv, &
290 reference=local_reference)
293 CALL init_training_force_envs(opt_bas, f_env_id, input_declaration, para_env, mpi_comm_opt, &
294 matrix_s_inv=matrix_s_inv)
297 CALL init_free_vars(opt_bas)
300 CALL update_free_vars(opt_bas)
301 CALL init_free_vars(opt_bas)
302 ALLOCATE (opt_bas%x_initial, source=opt_bas%x_opt)
307 DO iopt = 0, opt_bas%powell_param%maxfun
308 SELECT CASE (opt_bas%method)
310 CALL compute_residuum_vectors(opt_bas, f_env_id, matrix_s_inv, tot_time, &
311 para_env_top, para_env, iopt)
314 CALL compute_frontier_orbitals_objective( &
315 opt_bas, f_env_id, active_reference, tot_time, &
316 para_env_top, para_env, initial_info, training_qs_env)
318 CALL compute_frontier_orbitals_objective( &
319 opt_bas, f_env_id, active_reference, tot_time, &
320 para_env_top, para_env, qs_envs=training_qs_env)
323 cpabort(
"Unknown basis optimization method")
325 IF (para_env_top%is_source())
THEN
326 CALL powell_optimize(opt_bas%powell_param%nvar, opt_bas%x_opt, opt_bas%powell_param)
328 CALL para_env_top%bcast(opt_bas%powell_param%state)
329 CALL para_env_top%bcast(opt_bas%x_opt)
330 CALL update_free_vars(opt_bas)
332 mod(iopt, opt_bas%write_frequency) == 0
335 IF (opt_bas%powell_param%state == -1)
EXIT
339 IF (para_env_top%is_source())
THEN
340 opt_bas%powell_param%state = 8
341 CALL powell_optimize(opt_bas%powell_param%nvar, opt_bas%x_opt, opt_bas%powell_param)
344 CALL para_env_top%bcast(opt_bas%x_opt)
345 CALL update_free_vars(opt_bas)
348 CALL compute_frontier_orbitals_objective( &
349 opt_bas, f_env_id, active_reference, tot_time, &
350 para_env_top, para_env, optimized_info, training_qs_env)
351 IF (.NOT. opt_bas%quiet_output)
THEN
352 CALL print_frontier_orbitals_info( &
353 opt_bas, active_reference, initial_info, optimized_info, &
354 para_env_top, para_env)
362 DO icalc =
SIZE(opt_bas%comp_group(mp_id)%member_list), 1, -1
366 IF (use_direct_qs)
THEN
373 IF (
ALLOCATED(training_qs_env))
THEN
374 DEALLOCATE (training_qs_env)
375 logger%iter_info%print_level = outer_print_level
377 DEALLOCATE (f_env_id);
DEALLOCATE (tot_time)
378 IF (
ALLOCATED(initial_info))
DEALLOCATE (initial_info)
379 IF (
ALLOCATED(optimized_info))
DEALLOCATE (optimized_info)
380 IF (
ALLOCATED(local_reference))
DEALLOCATE (local_reference)
383 CALL timestop(handle)
385 END SUBROUTINE driver_optimization_para_low
400 SUBROUTINE compute_residuum_vectors(opt_bas, f_env_id, matrix_S_inv, tot_time, &
401 para_env_top, para_env, iopt)
403 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: f_env_id
404 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: matrix_s_inv
405 REAL(kind=
dp),
DIMENSION(:) :: tot_time
409 CHARACTER(len=*),
PARAMETER :: routinen =
'compute_residuum_vectors'
411 CHARACTER(len=8) :: basis_type
412 INTEGER :: bas_id, handle, icalc, icomb, ispin, &
413 mp_id, my_id, nao, ncalc, nelectron, &
415 REAL(kind=
dp) :: flexible_electron_count, maxocc, n_el_f
416 REAL(kind=
dp),
DIMENSION(:),
POINTER :: cond_vec, energy, f_vec, my_time, &
418 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: gdata
421 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_ks, matrix_s_aux, matrix_s_aux_orb
424 TYPE(
mo_set_type),
ALLOCATABLE,
DIMENSION(:) :: mos_aux
427 POINTER :: sab_aux, sab_aux_orb
429 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
432 CALL timeset(routinen, handle)
434 basis_type =
"AUX_OPT"
436 ncalc = opt_bas%ncombinations*opt_bas%ntraining_sets
437 ALLOCATE (gdata(ncalc, 4))
439 my_time => gdata(:, 2)
440 cond_vec => gdata(:, 3)
441 energy => gdata(:, 4)
443 f_vec = 0.0_dp; cond_vec = 0.0_dp; my_time = 0.0_dp; energy = 0.0_dp
444 mp_id = opt_bas%opt_id
445 ALLOCATE (start_time(
SIZE(opt_bas%comp_group(mp_id)%member_list)))
447 DO icalc = 1,
SIZE(opt_bas%comp_group(mp_id)%member_list)
448 my_id = opt_bas%comp_group(mp_id)%member_list(icalc) + 1
452 NULLIFY (matrix_s_aux_orb, matrix_s_aux)
453 CALL get_set_and_basis_id(opt_bas%comp_group(mp_id)%member_list(icalc), opt_bas, set_id, bas_id)
455 force_env => f_env%force_env
459 NULLIFY (sab_aux, sab_aux_orb)
462 basis_type_a=basis_type, &
463 basis_type_b=basis_type, &
466 basis_type_a=basis_type, &
467 basis_type_b=
"ORB", &
471 CALL get_qs_env(qs_env, mos=mos, matrix_ks=matrix_ks)
474 ALLOCATE (mos_aux(nspins))
475 CALL get_qs_env(qs_env, qs_kind_set=qs_kind_set)
478 CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff, maxocc=maxocc, nelectron=nelectron, &
479 n_el_f=n_el_f, nmo=nmo, flexible_electron_count=flexible_electron_count)
481 context=mo_coeff%matrix_struct%context, &
482 para_env=mo_coeff%matrix_struct%para_env)
484 n_el_f, maxocc, flexible_electron_count)
485 CALL init_mo_set(mo_set=mos_aux(ispin), fm_struct=fm_struct, name=
"MO_AUX")
489 CALL fit_mo_coeffs(matrix_s_aux, matrix_s_aux_orb, mos, mos_aux)
490 CALL evaluate_optvals(mos, mos_aux, matrix_ks, matrix_s_aux_orb(1)%matrix, &
491 matrix_s_aux(1)%matrix, matrix_s_inv(icalc), &
492 f_vec(my_id), energy(my_id), cond_vec(my_id))
501 my_time(my_id) =
m_walltime() - start_time(icalc)
504 DEALLOCATE (start_time)
506 IF (.NOT. para_env%is_source())
THEN
507 f_vec = 0.0_dp; cond_vec = 0.0_dp; my_time = 0.0_dp; energy = 0.0_dp
510 CALL para_env_top%sum(gdata)
512 opt_bas%powell_param%f = 0.0_dp
513 IF (para_env_top%is_source())
THEN
514 DO icalc = 1,
SIZE(f_vec)
515 icomb = mod(icalc - 1, opt_bas%ncombinations)
516 opt_bas%powell_param%f = opt_bas%powell_param%f + &
517 (f_vec(icalc) + energy(icalc))*opt_bas%fval_weight(icomb)
518 IF (opt_bas%use_condition_number)
THEN
519 opt_bas%powell_param%f = opt_bas%powell_param%f + &
520 log(cond_vec(icalc))*opt_bas%condition_weight(icomb)
524 f_vec = 0.0_dp; cond_vec = 0.0_dp; my_time = 0.0_dp; energy = 0.0_dp
526 CALL para_env_top%bcast(opt_bas%powell_param%f)
529 CALL output_opt_info(f_vec, cond_vec, my_time, tot_time, opt_bas, iopt, para_env_top)
532 CALL para_env_top%sync()
534 CALL timestop(handle)
536 END SUBROUTINE compute_residuum_vectors
549 SUBROUTINE compute_frontier_orbitals_objective(opt_bas, f_env_id, reference, tot_time, &
550 para_env_top, para_env, info, qs_envs)
552 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: f_env_id
554 DIMENSION(:),
INTENT(IN) :: reference
555 REAL(kind=
dp),
DIMENSION(:) :: tot_time
558 DIMENSION(:),
INTENT(OUT),
OPTIONAL :: info
560 OPTIONAL,
TARGET :: qs_envs
562 CHARACTER(len=*),
PARAMETER :: routinen =
'compute_frontier_orbitals_objective'
564 CHARACTER(len=8) :: basis_type
565 INTEGER :: bas_id, handle, icalc, icomb, icont, &
566 ikind, ipgf, iset, ix, mp_id, my_id, &
568 REAL(kind=
dp) :: coefficient_loss, contribution
569 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: coefficients_current
570 REAL(kind=
dp),
DIMENSION(:),
POINTER :: start_time
571 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_s_aux, matrix_s_aux_orb
575 DIMENSION(:) :: results
577 POINTER :: sab_aux, sab_aux_orb
581 CALL timeset(routinen, handle)
583 basis_type =
"AUX_OPT"
584 ncalc = opt_bas%ncombinations*opt_bas%ntraining_sets
585 ALLOCATE (results(ncalc))
586 ALLOCATE (coefficients_current, source=opt_bas%x_opt)
587 DO ikind = 1, opt_bas%nkind
588 DO iset = 1, opt_bas%kind_basis(ikind)%flex_basis(0)%nsets
589 DO ipgf = 1, opt_bas%kind_basis(ikind)%flex_basis(0)%subset(iset)%nexp
590 DO icont = 1, opt_bas%kind_basis(ikind)%flex_basis(0)%subset(iset)%ncon_tot
591 IF (opt_bas%kind_basis(ikind)%flex_basis(0)%subset(iset)%opt_coeff(ipgf, icont))
THEN
592 ix = opt_bas%kind_basis(ikind)%flex_basis(0)%subset(iset)%coeff_x_ind(ipgf, icont)
593 coefficients_current(ix) = &
594 opt_bas%kind_basis(ikind)%flex_basis(0)%subset(iset)%coeff(ipgf, icont)
600 coefficient_loss = 0.0_dp
601 IF (sum(opt_bas%x_initial**2) > tiny(1.0_dp))
THEN
602 coefficient_loss = sum((coefficients_current - opt_bas%x_initial)**2)/ &
603 sum(opt_bas%x_initial**2)
605 mp_id = opt_bas%opt_id
606 ALLOCATE (start_time(
SIZE(opt_bas%comp_group(mp_id)%member_list)))
608 DO icalc = 1,
SIZE(opt_bas%comp_group(mp_id)%member_list)
609 my_id = opt_bas%comp_group(mp_id)%member_list(icalc) + 1
612 NULLIFY (ks_env, matrix_s_aux, matrix_s_aux_orb, sab_aux, sab_aux_orb)
614 bas_id=bas_id, set_id=set_id)
615 IF (
PRESENT(qs_envs))
THEN
616 qs_env => qs_envs(icalc)
619 force_env => f_env%force_env
626 basis_type_a=basis_type, basis_type_b=basis_type, sab_nl=sab_aux)
628 basis_type_a=basis_type, basis_type_b=
"ORB", sab_nl=sab_aux_orb)
633 reference(icalc), matrix_s_aux(1)%matrix, matrix_s_aux_orb(1)%matrix, &
634 opt_bas%virtual_energy_cutoff, opt_bas%virtual_energy_smoothing, &
635 opt_bas%gap_energy_scale, results(my_id))
636 results(my_id)%reference_condition_number = reference(icalc)%condition_number
637 results(my_id)%number_reference_orbitals = reference(icalc)%number_reference_orbitals
638 results(my_id)%calculation_time =
m_walltime() - start_time(icalc)
643 DEALLOCATE (start_time)
645 CALL reduce_frontier_orbitals_results(results, para_env_top, para_env)
646 IF (
PRESENT(info))
THEN
647 cpassert(
SIZE(info) == ncalc)
651 opt_bas%powell_param%f = 0.0_dp
652 IF (para_env_top%is_source())
THEN
654 icomb = mod(icalc - 1, opt_bas%ncombinations)
655 contribution = opt_bas%occupied_weight*results(icalc)%loss_occupied_subspace + &
656 opt_bas%virtual_weight*results(icalc)%loss_virtual_subspace + &
657 opt_bas%empty_overlap_weight*results(icalc)%loss_empty_subspace + &
658 opt_bas%gap_weight*results(icalc)%loss_gap + &
659 opt_bas%coefficient_weight*coefficient_loss
660 IF (opt_bas%use_condition_number)
THEN
661 contribution = contribution + opt_bas%condition_weight(icomb)* &
662 log10(results(icalc)%condition_number)
664 opt_bas%powell_param%f = opt_bas%powell_param%f + &
665 opt_bas%fval_weight(icomb)*contribution
666 tot_time(icalc) = tot_time(icalc) + results(icalc)%calculation_time
669 CALL para_env_top%bcast(opt_bas%powell_param%f)
670 DEALLOCATE (coefficients_current, results)
672 CALL para_env_top%sync()
673 CALL timestop(handle)
675 END SUBROUTINE compute_frontier_orbitals_objective
683 SUBROUTINE reduce_frontier_orbitals_results(results, para_env_top, para_env)
685 DIMENSION(:),
INTENT(INOUT) :: results
689 CALL para_env_top%sum(results%loss_occupied_subspace)
690 CALL para_env_top%sum(results%loss_virtual_subspace)
691 CALL para_env_top%sum(results%loss_empty_subspace)
692 CALL para_env_top%sum(results%loss_gap)
693 CALL para_env_top%sum(results%occupied_subspace_overlap)
694 CALL para_env_top%sum(results%virtual_subspace_similarity)
695 CALL para_env_top%sum(results%empty_subspace_overlap)
696 CALL para_env_top%sum(results%gap_reference)
697 CALL para_env_top%sum(results%gap_candidate)
698 CALL para_env_top%sum(results%condition_number)
699 CALL para_env_top%sum(results%reference_condition_number)
700 CALL para_env_top%sum(results%calculation_time)
701 CALL para_env_top%sum(results%number_candidate_orbitals)
702 CALL para_env_top%sum(results%number_reference_orbitals)
704 END SUBROUTINE reduce_frontier_orbitals_results
715 SUBROUTINE print_frontier_orbitals_info(opt_bas, reference, initial, optimized, &
716 para_env_top, para_env)
719 DIMENSION(:),
INTENT(IN) :: reference
721 DIMENSION(:),
INTENT(IN) :: initial, optimized
724 CHARACTER(LEN=17) :: basis_label
725 CHARACTER(LEN=default_string_length), &
726 ALLOCATABLE,
DIMENSION(:) :: candidate_basis, element, reference_basis
727 INTEGER :: bas_id, icalc, ikind, iset, max_kinds, &
728 my_id, ncalc, unit_nr
729 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: kind_count
730 INTEGER,
ALLOCATABLE,
DIMENSION(:, :, :, :) :: metadata
733 ncalc = opt_bas%ncombinations*opt_bas%ntraining_sets
734 cpassert(
SIZE(initial) == ncalc)
735 cpassert(
SIZE(optimized) == ncalc)
738 DO icalc = 1,
SIZE(reference)
739 max_kinds = max(max_kinds, reference(icalc)%number_kinds)
741 CALL para_env_top%max(max_kinds)
742 ALLOCATE (kind_count(ncalc), source=0)
745 IF (para_env%is_source())
THEN
746 DO icalc = 1,
SIZE(reference)
747 my_id = opt_bas%comp_group(opt_bas%opt_id)%member_list(icalc) + 1
748 kind_count(my_id) = reference(icalc)%number_kinds
749 DO ikind = 1, reference(icalc)%number_kinds
750 CALL encode_string(reference(icalc)%element_symbol(ikind), metadata(my_id, ikind, 1, :))
751 CALL encode_string(reference(icalc)%reference_basis_name(ikind), metadata(my_id, ikind, 2, :))
752 CALL encode_string(reference(icalc)%candidate_basis_name(ikind), metadata(my_id, ikind, 3, :))
756 CALL para_env_top%sum(kind_count)
757 CALL para_env_top%sum(metadata)
762 IF (unit_nr > 0)
THEN
763 WRITE (unit_nr,
'(A)')
""
764 WRITE (unit_nr,
'(A)') repeat(
"=", 78)
765 WRITE (unit_nr,
'(A)')
"BASIS OPTIMIZATION SUMMARY"
766 WRITE (unit_nr,
'(A)') repeat(
"=", 78)
770 WRITE (unit_nr,
'(A)')
""
771 WRITE (unit_nr,
'(A,A,A,A)')
"Reference calculation: ", &
772 trim(opt_bas%training_dir(iset)),
"/", trim(opt_bas%training_input(iset))
773 IF (opt_bas%ncombinations > 1)
THEN
774 WRITE (unit_nr,
'(A,I0)')
"Basis combination: ", bas_id
776 WRITE (unit_nr,
'(A)')
""
777 WRITE (unit_nr,
'(A)')
"Atomic kind basis sets"
778 WRITE (unit_nr,
'(A)') repeat(
"-", 78)
779 ALLOCATE (candidate_basis(kind_count(my_id)), element(kind_count(my_id)), &
780 reference_basis(kind_count(my_id)))
781 DO ikind = 1, kind_count(my_id)
782 CALL decode_string(metadata(my_id, ikind, 1, :), element(ikind))
783 CALL decode_string(metadata(my_id, ikind, 2, :), reference_basis(ikind))
784 CALL decode_string(metadata(my_id, ikind, 3, :), candidate_basis(ikind))
787 DEALLOCATE (candidate_basis, element, reference_basis)
788 WRITE (unit_nr,
'(A)')
""
789 WRITE (unit_nr,
'(A,A)')
"Optimized basis file: ", trim(opt_bas%output_basis_file)
790 WRITE (unit_nr,
'(A)')
""
792 WRITE (unit_nr,
'(A)')
"Overall subspace quality and conditioning"
793 WRITE (unit_nr,
'(A)') repeat(
"-", 78)
794 basis_label =
"Basis"
795 WRITE (unit_nr,
'(A17,1X,A4,2(1X,A11),1X,A12,1X,A9,1X,A6)') basis_label,
"N_AO", &
796 "Occ.overlap",
"Vir.overlap",
"Emp.coverage",
"κ(S)",
"Gap/eV"
797 WRITE (unit_nr,
'(A)') repeat(
"-", 78)
798 basis_label =
"Ref. basis"
799 WRITE (unit_nr,
'(A17,1X,I4,2(1X,F10.1,A),1X,F11.1,A,1X,ES9.2,1X,F6.3)') &
800 basis_label, initial(my_id)%number_reference_orbitals, &
801 100.0_dp,
"%", 100.0_dp,
"%", 100.0_dp,
"%", &
802 initial(my_id)%reference_condition_number, &
803 initial(my_id)%gap_reference*
evolt
804 basis_label =
"Init. small basis"
805 WRITE (unit_nr,
'(A17,1X,I4,2(1X,F10.1,A),1X,F11.1,A,1X,ES9.2,1X,F6.3)') &
806 basis_label, initial(my_id)%number_candidate_orbitals, &
807 100.0_dp*initial(my_id)%occupied_subspace_overlap,
"%", &
808 100.0_dp*initial(my_id)%virtual_subspace_similarity,
"%", &
809 100.0_dp*initial(my_id)%empty_subspace_overlap,
"%", &
810 initial(my_id)%condition_number, initial(my_id)%gap_candidate*
evolt
811 basis_label =
"Opt. small basis"
812 WRITE (unit_nr,
'(A17,1X,I4,2(1X,F10.1,A),1X,F11.1,A,1X,ES9.2,1X,F6.3)') &
813 basis_label, optimized(my_id)%number_candidate_orbitals, &
814 100.0_dp*optimized(my_id)%occupied_subspace_overlap,
"%", &
815 100.0_dp*optimized(my_id)%virtual_subspace_similarity,
"%", &
816 100.0_dp*optimized(my_id)%empty_subspace_overlap,
"%", &
817 optimized(my_id)%condition_number, optimized(my_id)%gap_candidate*
evolt
818 WRITE (unit_nr,
'(A)') repeat(
"-", 78)
822 WRITE (unit_nr,
'(A)') repeat(
"=", 78)
823 WRITE (unit_nr,
'(A)')
""
826 DEALLOCATE (kind_count, metadata)
828 END SUBROUTINE print_frontier_orbitals_info
835 PURE SUBROUTINE encode_string(string, encoded)
836 CHARACTER(LEN=*),
INTENT(IN) :: string
837 INTEGER,
DIMENSION(:),
INTENT(OUT) :: encoded
842 DO i = 1, min(len_trim(string),
SIZE(encoded))
843 encoded(i) = iachar(string(i:i))
846 END SUBROUTINE encode_string
853 PURE SUBROUTINE decode_string(encoded, string)
854 INTEGER,
DIMENSION(:),
INTENT(IN) :: encoded
855 CHARACTER(LEN=*),
INTENT(OUT) :: string
860 DO i = 1, min(len(string),
SIZE(encoded))
861 IF (encoded(i) == 0)
EXIT
862 string(i:i) = achar(encoded(i))
865 END SUBROUTINE decode_string
877 SUBROUTINE init_training_qs_envs(opt_bas, qs_envs, input_declaration, para_env, globenv, &
878 training_input, reference)
881 INTENT(OUT),
TARGET :: qs_envs
887 DIMENSION(:),
INTENT(OUT),
OPTIONAL :: reference
889 CHARACTER(len=*),
PARAMETER :: routinen =
'init_training_qs_envs'
891 CHARACTER(len=default_path_length) :: main_dir, restart_file
892 CHARACTER(len=default_string_length) :: project_name
893 INTEGER :: bas_id, handle, icalc, ierr, mp_id, &
901 input_file, subsys_section
903 CALL timeset(routinen, handle)
905 mp_id = opt_bas%opt_id
907 DO icalc = 1,
SIZE(opt_bas%comp_group(mp_id)%member_list)
908 NULLIFY (dft_section, force_env_section, input_file, ks_env, matrix_s, qs_env, &
909 reference_qs_env, sab_orb, subsys_section)
911 set_id=set_id, bas_id=bas_id)
912 IF (
PRESENT(training_input))
THEN
915 CALL m_chdir(trim(opt_bas%training_dir(set_id)), ierr)
917 CALL cp_abort(__location__, &
918 "Could not change to directory <"//trim(opt_bas%training_dir(set_id))//
">")
921 opt_bas%training_input(set_id), &
922 initial_variables=empty_initial_variables, &
929 IF (
PRESENT(reference))
THEN
933 IF (n_rep_val == 0)
THEN
935 restart_file = trim(project_name)//
"-RESTART.wfn"
937 c_val=trim(restart_file))
941 ALLOCATE (reference_qs_env)
943 CALL qs_init(reference_qs_env, para_env, input_file, globenv=globenv, &
944 force_env_section=force_env_section, subsys_section=subsys_section, &
945 use_motion_section=.true., silent=.true.)
947 CALL get_qs_env(reference_qs_env, ks_env=ks_env)
949 force_env_section=reference_qs_env%input)
950 CALL get_ks_env(ks_env, matrix_s=matrix_s, sab_orb=sab_orb)
952 matrix_name=
"OVERLAP", &
953 basis_type_a=
"ORB", &
954 basis_type_b=
"ORB", &
960 DEALLOCATE (reference_qs_env)
966 qs_env => qs_envs(icalc)
968 CALL qs_init(qs_env, para_env, input_file, globenv=globenv, &
969 force_env_section=force_env_section, subsys_section=subsys_section, &
970 use_motion_section=.true., silent=.true.)
973 IF (.NOT.
PRESENT(training_input))
CALL m_chdir(trim(adjustl(main_dir)), ierr)
976 CALL timestop(handle)
978 END SUBROUTINE init_training_qs_envs
992 SUBROUTINE init_training_force_envs(opt_bas, f_env_id, input_declaration, para_env, mpi_comm_opt, &
993 matrix_s_inv, training_input, reference)
996 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: f_env_id
1000 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(OUT), &
1001 OPTIONAL :: matrix_s_inv
1004 DIMENSION(:),
INTENT(OUT),
OPTIONAL :: reference
1006 CHARACTER(len=*),
PARAMETER :: routinen =
'init_training_force_envs'
1008 CHARACTER(len=default_path_length) :: input_path, main_dir
1009 INTEGER :: bas_id, f_env_output_unit, handle, &
1010 icalc, ierr, mp_id, set_id, stat
1021 CALL timeset(routinen, handle)
1023 NULLIFY (matrix_s, blacs_env, ks_env)
1025 mp_id = opt_bas%opt_id
1029 DO icalc = 1,
SIZE(opt_bas%comp_group(mp_id)%member_list)
1030 NULLIFY (input_file)
1032 CALL get_set_and_basis_id(opt_bas%comp_group(mp_id)%member_list(icalc), opt_bas, set_id, bas_id)
1033 IF (
PRESENT(training_input))
THEN
1035 input_path =
"embedded frontier-orbital screening input"
1037 CALL m_chdir(trim(opt_bas%training_dir(set_id)), ierr)
1039 CALL cp_abort(__location__, &
1040 "Could not change to directory <"//trim(opt_bas%training_dir(set_id))//
">")
1042 input_file =>
read_input(input_declaration, &
1043 opt_bas%training_input(set_id), &
1044 initial_variables=empty_initial_variables, &
1046 input_path = opt_bas%training_input(set_id)
1051 IF (opt_bas%quiet_output)
THEN
1054 f_env_output_unit = -1
1057 input_declaration=input_declaration, &
1058 input_path=input_path, &
1060 output_unit=f_env_output_unit, &
1061 owns_out_unit=.false., &
1062 mpi_comm=mpi_comm_opt, &
1066 input_declaration=input_declaration, &
1067 input_path=input_path, &
1069 output_path=
"scrap_information", &
1070 mpi_comm=mpi_comm_opt, &
1077 force_env => f_env%force_env
1081 IF (.NOT.
PRESENT(training_input))
THEN
1084 force_env_section=qs_env%input)
1086 matrix_s=matrix_s, &
1089 matrix_name=
"OVERLAP", &
1090 basis_type_a=
"ORB", &
1091 basis_type_b=
"ORB", &
1094 IF (
PRESENT(matrix_s_inv))
THEN
1095 CALL get_qs_env(qs_env, matrix_s=matrix_s, blacs_env=blacs_env)
1097 para_env, blacs_env)
1109 IF (.NOT.
PRESENT(training_input))
CALL m_chdir(trim(adjustl(main_dir)), ierr)
1112 CALL timestop(handle)
1114 END SUBROUTINE init_training_force_envs
1122 SUBROUTINE update_free_vars(opt_bas)
1125 CHARACTER(len=*),
PARAMETER :: routinen =
'update_free_vars'
1127 INTEGER :: handle, ikind, iset, ix
1129 CALL timeset(routinen, handle)
1131 DO ikind = 1, opt_bas%nkind
1132 DO iset = 1, opt_bas%kind_basis(ikind)%flex_basis(0)%nsets
1133 CALL update_subset_freevars(opt_bas%kind_basis(ikind)%flex_basis(0)%subset(iset), ix, opt_bas%x_opt)
1136 CALL timestop(handle)
1138 END SUBROUTINE update_free_vars
1148 SUBROUTINE update_subset_freevars(subset, ix, x)
1151 REAL(kind=
dp),
DIMENSION(:) :: x
1153 CHARACTER(len=*),
PARAMETER :: routinen =
'update_subset_freevars'
1155 INTEGER :: handle, icon1, icon2, icont, iexp, il, &
1157 REAL(kind=
dp) :: fermi_f, gs_scale
1159 CALL timeset(routinen, handle)
1160 DO iexp = 1, subset%nexp
1161 IF (subset%opt_exps(iexp))
THEN
1163 subset%exps(iexp) = abs(x(ix))
1164 IF (subset%exp_has_const(iexp))
THEN
1166 fermi_f = 1.0_dp/(exp((x(ix) - 1.0_dp)/0.5_dp) + 1.0_dp)
1167 subset%exps(iexp) = (2.0_dp*fermi_f - 1.0_dp)*subset%exp_const(iexp)%var_fac*subset%exp_const(iexp)%init + &
1168 subset%exp_const(iexp)%init
1173 DO icont = 1, subset%ncon_tot
1174 IF (subset%opt_coeff(iexp, icont))
THEN
1176 subset%coeff(iexp, icont) = x(ix)
1183 DO il = 1, subset%nl
1184 DO icon1 = istart, istart + subset%l(il) - 2
1185 DO icon2 = icon1 + 1, istart + subset%l(il) - 1
1186 gs_scale = dot_product(subset%coeff(:, icon2), subset%coeff(:, icon1))/ &
1187 dot_product(subset%coeff(:, icon1), subset%coeff(:, icon1))
1188 subset%coeff(:, icon2) = subset%coeff(:, icon2) - gs_scale*subset%coeff(:, icon1)
1191 istart = istart + subset%l(il)
1194 DO icon1 = 1, subset%ncon_tot
1195 subset%coeff(:, icon1) = subset%coeff(:, icon1)/norm2(subset%coeff(:, icon1))
1197 CALL timestop(handle)
1199 END SUBROUTINE update_subset_freevars
1207 SUBROUTINE init_free_vars(opt_bas)
1210 CHARACTER(len=*),
PARAMETER :: routinen =
'init_free_vars'
1212 INTEGER :: handle, ikind, iset, ix
1214 CALL timeset(routinen, handle)
1216 DO ikind = 1, opt_bas%nkind
1217 DO iset = 1, opt_bas%kind_basis(ikind)%flex_basis(0)%nsets
1218 CALL init_subset_freevars(opt_bas%kind_basis(ikind)%flex_basis(0)%subset(iset), ix, opt_bas%x_opt)
1221 CALL timestop(handle)
1223 END SUBROUTINE init_free_vars
1234 SUBROUTINE init_subset_freevars(subset, ix, x)
1237 REAL(kind=
dp),
DIMENSION(:) :: x
1239 CHARACTER(len=*),
PARAMETER :: routinen =
'init_subset_freevars'
1241 INTEGER :: handle, icont, iexp
1242 REAL(kind=
dp) :: fract
1244 CALL timeset(routinen, handle)
1246 DO iexp = 1, subset%nexp
1247 IF (subset%opt_exps(iexp))
THEN
1249 x(ix) = subset%exps(iexp)
1250 IF (subset%exp_has_const(iexp))
THEN
1251 IF (subset%exp_const(iexp)%const_type == 0)
THEN
1252 fract = 1.0_dp + (subset%exps(iexp) - subset%exp_const(iexp)%init)/ &
1253 (subset%exp_const(iexp)%init*subset%exp_const(iexp)%var_fac)
1254 x(ix) = 0.5_dp*log((2.0_dp/fract - 1.0_dp)) + 1.0_dp
1256 IF (subset%exp_const(iexp)%const_type == 1)
THEN
1261 DO icont = 1, subset%ncon_tot
1262 IF (subset%opt_coeff(iexp, icont))
THEN
1264 x(ix) = subset%coeff(iexp, icont)
1268 CALL timestop(handle)
1270 END SUBROUTINE init_subset_freevars
1284 SUBROUTINE output_opt_info(f_vec, cond_vec, my_time, tot_time, opt_bas, iopt, para_env_top)
1285 REAL(kind=
dp),
DIMENSION(:) :: f_vec, cond_vec, my_time, tot_time
1290 CHARACTER(len=*),
PARAMETER :: routinen =
'output_opt_info'
1292 INTEGER :: handle, ibasis, icalc, iset, unit_nr
1295 CALL timeset(routinen, handle)
1298 tot_time = tot_time + my_time
1301 IF (para_env_top%is_source() .AND. (mod(iopt, opt_bas%write_frequency) == 0 .OR. iopt == opt_bas%powell_param%maxfun))
THEN
1305 IF (unit_nr > 0)
THEN
1306 WRITE (unit_nr,
'(1X,A,I8)')
"BASOPT| Information at iteration number:", iopt
1307 WRITE (unit_nr,
'(1X,A)')
"BASOPT| Training set | Combination | Rho difference | Condition num. | Time"
1308 WRITE (unit_nr,
'(1X,A)')
"BASOPT| -----------------------------------------------------------------------"
1310 DO iset = 1, opt_bas%ntraining_sets
1311 DO ibasis = 1, opt_bas%ncombinations
1313 WRITE (unit_nr,
'(1X,A,2(5X,I3,5X,A),2(1X,E14.8,1X,A),1X,F8.1)') &
1314 'BASOPT| ', iset,
"|", ibasis,
"|", f_vec(icalc),
"|", cond_vec(icalc),
"|", tot_time(icalc)
1317 WRITE (unit_nr,
'(1X,A)')
"BASOPT| -----------------------------------------------------------------------"
1318 WRITE (unit_nr,
'(1X,A,E14.8)')
"BASOPT| Total residuum value: ", opt_bas%powell_param%f
1319 WRITE (unit_nr,
'(A)')
""
1321 CALL timestop(handle)
1322 END SUBROUTINE output_opt_info
methods related to the blacs parallel environment
DBCSR operations in CP2K.
represent the structure of a full matrix
subroutine, public cp_fm_struct_create(fmstruct, para_env, context, nrow_global, ncol_global, nrow_block, ncol_block, descriptor, first_p_pos, local_leading_dimension, template_fmstruct, square_blocks, force_block)
allocates and initializes a full matrix structure
subroutine, public cp_fm_struct_release(fmstruct)
releases a full matrix structure
represent a full matrix distributed on many processors
various routines to log and control the output. The idea is that decisions about where to log should ...
recursive integer function, public cp_logger_get_default_unit_nr(logger, local, skip_not_ionode)
asks the default unit number of the given logger. try to use cp_logger_get_unit_nr
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer, parameter, public silent_print_level
interface to use cp2k as library
recursive subroutine, public destroy_force_env(env_id, ierr, q_finalize)
deallocates the force_env with the given id
subroutine, public f_env_get_from_id(f_env_id, f_env)
...
subroutine, public f_env_add_defaults(f_env_id, f_env, handle)
adds the default environments of the f_env to the stack of the defaults, and returns a new error and ...
recursive subroutine, public create_force_env(new_env_id, input_declaration, input_path, output_path, mpi_comm, output_unit, owns_out_unit, input, ierr, work_dir, initial_variables)
creates a new force environment using the given input, and writing the output to the given output uni...
subroutine, public f_env_rm_defaults(f_env, ierr, handle)
removes the default environments of the f_env to the stack of the defaults, and sets ierr accordingly...
Interface for the force calculations.
recursive subroutine, public force_env_get(force_env, in_use, fist_env, qs_env, meta_env, fp_env, subsys, para_env, potential_energy, additional_potential, kinetic_energy, harmonic_shell, kinetic_shell, cell, sub_force_env, qmmm_env, qmmmx_env, eip_env, pwdft_env, globenv, input, force_env_section, method_name_id, root_section, mixed_env, nnp_env, embed_env, ipi_env)
returns various attributes about the force environment
Define type storing the global information of a run. Keep the amount of stored data small....
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
integer, parameter, public default_path_length
Machine interface based on Fortran 2003 and POSIX.
subroutine, public m_getcwd(curdir)
...
subroutine, public m_chdir(dir, ierror)
...
real(kind=dp) function, public m_walltime()
returns time from a real-time clock, protected against rolling early/easily
Interface to the message passing library MPI.
subroutine, public mp_para_env_release(para_env)
releases the para object (to be called when you don't want anymore the shared copy of this object)
subroutine, public update_basis_set(opt_bas, bas_id, basis_type, qs_env)
...
subroutine, public modify_input_settings(basis_optimization, bas_id, input_file)
change settings in the training input files to initialize all needed structures and adjust settings t...
subroutine, public calculate_ks_matrix(qs_env)
...
subroutine, public calculate_overlap_inverse(matrix_s, matrix_s_inv, para_env, context)
...
subroutine, public allocate_mo_sets(qs_env)
...
Automatic screening of frontier-orbital basis optimizations.
subroutine, public run_frontier_orbital_screening(input_declaration, section, para_env, globenv, frontier_screening_section, optimize_basis_driver)
Run serial frontier-orbital optimizations and evaluate their HOMO-LUMO gaps with new SCFs.
Utilities for frontier-orbital basis optimization.
subroutine, public frontier_orbitals_reference_init(qs_env, reference)
Diagonalize and store the frozen reference Hamiltonian.
subroutine, public frontier_orbitals_reference_release(reference)
Release the stored reference eigenvalues and eigenvectors.
subroutine, public evaluate_frontier_orbitals_objective(reference, matrix_s_candidate, matrix_s_candidate_reference, virtual_cutoff, virtual_smoothing, gap_scale, objective_result)
Construct and diagonalize the candidate Hamiltonian and evaluate the loss function.
subroutine, public print_frontier_orbital_basis_sets(unit_nr, element_symbols, reference_basis_names, initial_basis_names)
Print reference and initial basis-set names for every fitted atom kind.
subroutine, public optbas_build_neighborlist(qs_env, sab_aux, sab_aux_orb, basis_type)
rebuilds neighborlist for absis sets
subroutine, public evaluate_optvals(mos, mos_aux_fit, matrix_ks, q, snew, s_inv_orb, fval, energy, s_cond_number)
...
subroutine, public fit_mo_coeffs(saux, sauxorb, mos, mosaux)
...
integer, parameter, public method_mo_fit_occ
subroutine, public deallocate_basis_optimization_type(opt_bas)
Deallocate everything which was allocated before. Note not all arrays are used depending on the type ...
integer, parameter, public method_mo_fit_occ_virtual
subroutine, public get_set_and_basis_id(calc_id, opt_bas, set_id, bas_id)
returns a mapping from the calculation id to the trainings set id and basis combination id
subroutine, public optimize_basis_init_read_input(opt_bas, root_section, para_env, quiet_output, embedded_training)
initialize all parts of the optimization type and read input settings
subroutine, public write_basis(basis, element, unit_nr)
Write a basis set file which can be used from CP2K.
subroutine, public update_derived_basis_sets(opt_bas, write_it, output_file, para_env)
Regenerate the basis sets from reference 0 after an update from the optimizer to reference was perfor...
subroutine, public run_optimize_basis(input_declaration, root_section, para_env, globenv)
main entry point for methods aimed at optimizing basis sets
Definition of physical constants:
real(kind=dp), parameter, public evolt
subroutine, public powell_optimize(n, x, optstate)
...
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.
subroutine, public qs_env_release(qs_env)
releases the given qs_env (see doc/ReferenceCounting.html)
subroutine, public qs_env_part_release(qs_env)
releases part of the given qs_env in order to save memory
subroutine, public qs_env_create(qs_env, globenv)
allocates and intitializes a qs_env
subroutine, public qs_init(qs_env, para_env, root_section, globenv, cp_subsys, kpoint_env, qmmm, qmmm_env_qm, force_env_section, subsys_section, use_motion_section, silent, multip, charge)
Read the input and the database files for the setup of the QUICKSTEP environment.
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind_set(qs_kind_set, all_potential_present, tnadd_potential_present, gth_potential_present, sgp_potential_present, paw_atom_present, dft_plus_u_atom_present, maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, maxlprj, maxnset, maxsgf_set, ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, maxppnl, nelectron, maxder, max_ngrid_rad, max_sph_harm, maxg_iso_not0, lmax_rho0, basis_rcut, do_mtlr_present, basis_type, total_zeff_corr, npgf_seg, cneo_potential_present, nkind_q, natom_q)
Get attributes of an atomic kind set.
subroutine, public set_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, exc_accint, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, kpoints, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, task_list, task_list_soft, subsys, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env)
...
subroutine, public get_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, exc_accint, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, rho, rho_xc, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, task_list, task_list_soft, kpoints, do_kpoints, atomic_kind_set, qs_kind_set, cell, cell_ref, use_ref_cell, particle_set, energy, force, local_particles, local_molecules, molecule_kind_set, molecule_set, subsys, cp_subsys, virial, results, atprop, nkind, natom, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env, nelectron_total, nelectron_spin)
...
Definition and initialisation of the mo data type.
subroutine, public init_mo_set(mo_set, fm_pool, fm_ref, fm_struct, name, counter)
initializes an allocated mo_set. eigenvalues, mo_coeff, occupation_numbers are valid only after this ...
subroutine, public allocate_mo_set(mo_set, nao, nmo, nelectron, n_el_f, maxocc, flexible_electron_count)
Allocates a mo set and partially initializes it (nao,nmo,nelectron, and flexible_electron_count are v...
subroutine, public deallocate_mo_set(mo_set)
Deallocate a wavefunction data structure.
subroutine, public get_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, mo_coeff, mo_coeff_b, uniform_occupation, kts, mu, flexible_electron_count)
Get the components of a MO set data structure.
Define the neighbor list data types and the corresponding functionality.
subroutine, public release_neighbor_list_sets(nlists)
releases an array of neighbor_list_sets
Generate the atomic neighbor lists.
subroutine, public build_qs_neighbor_lists(qs_env, para_env, molecular, force_env_section)
Build all the required neighbor lists for Quickstep.
Calculation of overlap matrix, its derivatives and forces.
subroutine, public build_overlap_matrix(ks_env, matrix_s, matrixkp_s, matrix_name, nderivative, basis_type_a, basis_type_b, sab_nl, calculate_forces, matrix_p, matrixkp_p, ext_kpoints)
Calculation of the overlap matrix over Cartesian Gaussian functions.
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
keeps the information about the structure of a full matrix
type of a logger, at the moment it contains just a print level starting at which level it should be l...
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
type containing all information needed for basis matching
Provides all information about a quickstep kind.
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...