(git:33f85d8)
Loading...
Searching...
No Matches
basis_set_output.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2025 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Print basis sets in CP2K format
10!> \par History
11!> \author JGH (12.2017)
12! **************************************************************************************************
16 USE cp2k_info, ONLY: compile_revision,&
18 r_datx,&
21 USE cp_files, ONLY: close_file,&
28 USE kinds, ONLY: default_string_length,&
29 dp
32 USE qs_kind_types, ONLY: get_qs_kind,&
34#include "./base/base_uses.f90"
35
36 IMPLICIT NONE
37 PRIVATE
38
39 ! Global parameters
40 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'basis_set_output'
41 PUBLIC :: print_basis_set_file
42
43! **************************************************************************************************
44
45CONTAINS
46
47! **************************************************************************************************
48!> \brief ...
49!> \param qs_env ...
50!> \param base_section ...
51! **************************************************************************************************
52 SUBROUTINE print_basis_set_file(qs_env, base_section)
53
54 TYPE(qs_environment_type), POINTER :: qs_env
55 TYPE(section_vals_type), POINTER :: base_section
56
57 CHARACTER(LEN=2) :: element_symbol
58 CHARACTER(LEN=default_string_length) :: bname, filename
59 INTEGER :: ikind, iunit, nkind, ounit
60 INTEGER, SAVE :: ncalls = 0
61 TYPE(cp_logger_type), POINTER :: logger
62 TYPE(gto_basis_set_type), POINTER :: aux_fit_basis, lri_aux_basis, orb_basis, &
63 p_lri_aux_basis, ri_aux_basis, ri_hfx_basis, ri_hxc_basis, ri_xas_basis, tda_hfx_basis
64 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
65 TYPE(qs_kind_type), POINTER :: qs_kind
66
67 IF (ncalls > 0) RETURN
68 ncalls = ncalls + 1
69
70 logger => cp_get_default_logger()
71 ounit = cp_logger_get_default_io_unit(logger)
72
73 CALL section_vals_val_get(base_section, "FILENAME", c_val=filename)
74
75 IF (ounit > 0) THEN
76 WRITE (unit=ounit, fmt='(/,(T2,A))') repeat("-", 79)
77 WRITE (unit=ounit, fmt='((T2,A,A))') "Print Basis Set File: ", trim(filename)
78 WRITE (unit=ounit, fmt='((T2,A))') repeat("-", 79)
79 CALL open_file(filename, unit_number=iunit, file_status="UNKNOWN", file_action="WRITE")
80 WRITE (unit=iunit, fmt="(A8,T11,A)") &
81 "# TITLE ", "Basis set file created by "//trim(cp2k_version)//" (revision "//trim(compile_revision)//")", &
82 "# AUTHOR", trim(r_user_name)//"@"//trim(r_host_name)//" "//r_datx(1:19)
83
84 END IF
85
86 CALL get_qs_env(qs_env, qs_kind_set=qs_kind_set, nkind=nkind)
87 DO ikind = 1, nkind
88 qs_kind => qs_kind_set(ikind)
89 CALL get_qs_kind(qs_kind, element_symbol=element_symbol)
90 NULLIFY (orb_basis, ri_aux_basis, lri_aux_basis, p_lri_aux_basis, aux_fit_basis)
91 CALL get_qs_kind(qs_kind, basis_set=orb_basis, basis_type="ORB")
92 CALL get_qs_kind(qs_kind, basis_set=ri_aux_basis, basis_type="RI_AUX")
93 CALL get_qs_kind(qs_kind, basis_set=ri_hxc_basis, basis_type="RI_HXC")
94 CALL get_qs_kind(qs_kind, basis_set=ri_hfx_basis, basis_type="RI_HFX")
95 CALL get_qs_kind(qs_kind, basis_set=lri_aux_basis, basis_type="LRI_AUX")
96 CALL get_qs_kind(qs_kind, basis_set=p_lri_aux_basis, basis_type="P_LRI_AUX")
97 CALL get_qs_kind(qs_kind, basis_set=aux_fit_basis, basis_type="AUX_FIT")
98 CALL get_qs_kind(qs_kind, basis_set=ri_xas_basis, basis_type="RI_XAS")
99 CALL get_qs_kind(qs_kind, basis_set=tda_hfx_basis, basis_type="TDA_HFX")
100 IF (ounit > 0) THEN
101 IF (ASSOCIATED(orb_basis)) THEN
102 bname = "local_orbital"
103 CALL basis_out(orb_basis, element_symbol, bname, iunit)
104 END IF
105 IF (ASSOCIATED(ri_aux_basis)) THEN
106 bname = "local_ri_aux"
107 CALL basis_out(ri_aux_basis, element_symbol, bname, iunit)
108 END IF
109 IF (ASSOCIATED(ri_hxc_basis)) THEN
110 bname = "local_ri_hxc"
111 CALL basis_out(ri_hxc_basis, element_symbol, bname, iunit)
112 END IF
113 IF (ASSOCIATED(lri_aux_basis)) THEN
114 bname = "local_lri_aux"
115 CALL basis_out(lri_aux_basis, element_symbol, bname, iunit)
116 END IF
117 IF (ASSOCIATED(p_lri_aux_basis)) THEN
118 bname = "local_p_lri_aux"
119 CALL basis_out(p_lri_aux_basis, element_symbol, bname, iunit)
120 END IF
121 IF (ASSOCIATED(aux_fit_basis)) THEN
122 bname = "local_aux_fit"
123 CALL basis_out(aux_fit_basis, element_symbol, bname, iunit)
124 END IF
125 IF (ASSOCIATED(ri_xas_basis)) THEN
126 bname = "local_ri_xas"
127 CALL basis_out(ri_xas_basis, element_symbol, bname, iunit)
128 END IF
129 IF (ASSOCIATED(ri_hfx_basis)) THEN
130 bname = "local_ri_hfx"
131 CALL basis_out(ri_hfx_basis, element_symbol, bname, iunit)
132 END IF
133 IF (ASSOCIATED(tda_hfx_basis)) THEN
134 bname = "local_tda_hfx"
135 CALL basis_out(tda_hfx_basis, element_symbol, bname, iunit)
136 END IF
137 END IF
138 END DO
139
140 IF (ounit > 0) THEN
141 CALL close_file(iunit)
142 END IF
143
144 END SUBROUTINE print_basis_set_file
145
146! **************************************************************************************************
147
148! **************************************************************************************************
149!> \brief ...
150!> \param basis ...
151!> \param element_symbol ...
152!> \param bname ...
153!> \param iunit ...
154! **************************************************************************************************
155 SUBROUTINE basis_out(basis, element_symbol, bname, iunit)
156 TYPE(gto_basis_set_type), POINTER :: basis
157 CHARACTER(LEN=*), INTENT(IN) :: element_symbol, bname
158 INTEGER, INTENT(IN) :: iunit
159
160 INTEGER :: ipgf, iset, ishell, ll, nset
161 INTEGER, DIMENSION(0:9) :: lset
162 INTEGER, DIMENSION(:), POINTER :: lmax, lmin, npgf, nshell
163 INTEGER, DIMENSION(:, :), POINTER :: l, n
164 REAL(kind=dp), DIMENSION(:, :), POINTER :: zet
165 REAL(kind=dp), DIMENSION(:, :, :), POINTER :: gcc
166
167 WRITE (iunit, "(A1)") "#"
168 WRITE (iunit, "(A2,T5,A)") element_symbol, adjustl(trim(bname))
169
170 CALL get_gto_basis_set(basis, nset=nset, npgf=npgf, lmax=lmax, lmin=lmin, &
171 nshell=nshell, n=n, l=l, &
172 gcc=gcc, zet=zet)
173
174 WRITE (iunit, "(I5)") nset
175 DO iset = 1, nset
176 lset = 0
177 DO ishell = 1, nshell(iset)
178 ll = l(ishell, iset)
179 lset(ll) = lset(ll) + 1
180 END DO
181 WRITE (iunit, "(I5,2I3,I5,2X,10(I3))") n(1, iset), lmin(iset), lmax(iset), npgf(iset), &
182 (lset(ll), ll=lmin(iset), lmax(iset))
183 DO ipgf = 1, npgf(iset)
184 WRITE (iunit, "(F20.10,50(F15.10))") zet(ipgf, iset), (gcc(ipgf, ishell, iset), ishell=1, nshell(iset))
185 END DO
186 END DO
187
188 END SUBROUTINE basis_out
189
190! **************************************************************************************************
191
192END MODULE basis_set_output
Print basis sets in CP2K format.
subroutine, public print_basis_set_file(qs_env, base_section)
...
subroutine, public get_gto_basis_set(gto_basis_set, name, aliases, norm_type, kind_radius, ncgf, nset, nsgf, cgf_symbol, sgf_symbol, norm_cgf, set_radius, lmax, lmin, lx, ly, lz, m, ncgf_set, npgf, nsgf_set, nshell, cphi, pgf_radius, sphi, scon, zet, first_cgf, first_sgf, l, last_cgf, last_sgf, n, gcc, maxco, maxl, maxpgf, maxsgf_set, maxshell, maxso, nco_sum, npgf_sum, nshell_sum, maxder, short_kind_radius, npgf_seg_sum)
...
some minimal info about CP2K, including its version and license
Definition cp2k_info.F:16
character(len=default_string_length), public r_host_name
Definition cp2k_info.F:68
character(len= *), parameter, public compile_revision
Definition cp2k_info.F:38
character(len= *), parameter, public cp2k_version
Definition cp2k_info.F:42
character(len=default_string_length), public r_user_name
Definition cp2k_info.F:68
character(len=26), public r_datx
Definition cp2k_info.F:66
Utility routines to open and close files. Tracking of preconnections.
Definition cp_files.F:16
subroutine, public open_file(file_name, file_status, file_form, file_action, file_position, file_pad, unit_number, debug, skip_get_unit_number, file_access)
Opens the requested file using a free unit number.
Definition cp_files.F:308
subroutine, public close_file(unit_number, file_status, keep_preconnection)
Close an open file given by its logical unit number. Optionally, keep the file and unit preconnected.
Definition cp_files.F:119
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_string_length
Definition kinds.F:57
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, 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, 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, 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, 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, ecoul_1c, rho0_s_rs, rho0_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)
Get the QUICKSTEP environment.
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
Provides all information about a quickstep kind.