(git:374b731)
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-2024 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
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 IF (ounit > 0) THEN
100 IF (ASSOCIATED(orb_basis)) THEN
101 bname = "local_orbital"
102 CALL basis_out(orb_basis, element_symbol, bname, iunit)
103 END IF
104 IF (ASSOCIATED(ri_aux_basis)) THEN
105 bname = "local_ri_aux"
106 CALL basis_out(ri_aux_basis, element_symbol, bname, iunit)
107 END IF
108 IF (ASSOCIATED(ri_hxc_basis)) THEN
109 bname = "local_ri_hxc"
110 CALL basis_out(ri_hxc_basis, element_symbol, bname, iunit)
111 END IF
112 IF (ASSOCIATED(lri_aux_basis)) THEN
113 bname = "local_lri_aux"
114 CALL basis_out(lri_aux_basis, element_symbol, bname, iunit)
115 END IF
116 IF (ASSOCIATED(p_lri_aux_basis)) THEN
117 bname = "local_p_lri_aux"
118 CALL basis_out(p_lri_aux_basis, element_symbol, bname, iunit)
119 END IF
120 IF (ASSOCIATED(aux_fit_basis)) THEN
121 bname = "local_aux_fit"
122 CALL basis_out(aux_fit_basis, element_symbol, bname, iunit)
123 END IF
124 IF (ASSOCIATED(ri_xas_basis)) THEN
125 bname = "local_ri_xas"
126 CALL basis_out(ri_xas_basis, element_symbol, bname, iunit)
127 END IF
128 IF (ASSOCIATED(ri_hfx_basis)) THEN
129 bname = "local_ri_hfx"
130 CALL basis_out(ri_hfx_basis, element_symbol, bname, iunit)
131 END IF
132 END IF
133 END DO
134
135 IF (ounit > 0) THEN
136 CALL close_file(iunit)
137 END IF
138
139 END SUBROUTINE print_basis_set_file
140
141! **************************************************************************************************
142
143! **************************************************************************************************
144!> \brief ...
145!> \param basis ...
146!> \param element_symbol ...
147!> \param bname ...
148!> \param iunit ...
149! **************************************************************************************************
150 SUBROUTINE basis_out(basis, element_symbol, bname, iunit)
151 TYPE(gto_basis_set_type), POINTER :: basis
152 CHARACTER(LEN=*), INTENT(IN) :: element_symbol, bname
153 INTEGER, INTENT(IN) :: iunit
154
155 INTEGER :: ipgf, iset, ishell, ll, nset
156 INTEGER, DIMENSION(0:9) :: lset
157 INTEGER, DIMENSION(:), POINTER :: lmax, lmin, npgf, nshell
158 INTEGER, DIMENSION(:, :), POINTER :: l, n
159 REAL(kind=dp), DIMENSION(:, :), POINTER :: zet
160 REAL(kind=dp), DIMENSION(:, :, :), POINTER :: gcc
161
162 WRITE (iunit, "(A1)") "#"
163 WRITE (iunit, "(A2,T5,A)") element_symbol, adjustl(trim(bname))
164
165 CALL get_gto_basis_set(basis, nset=nset, npgf=npgf, lmax=lmax, lmin=lmin, &
166 nshell=nshell, n=n, l=l, &
167 gcc=gcc, zet=zet)
168
169 WRITE (iunit, "(I5)") nset
170 DO iset = 1, nset
171 lset = 0
172 DO ishell = 1, nshell(iset)
173 ll = l(ishell, iset)
174 lset(ll) = lset(ll) + 1
175 END DO
176 WRITE (iunit, "(I5,2I3,I5,2X,10(I3))") n(1, iset), lmin(iset), lmax(iset), npgf(iset), &
177 (lset(ll), ll=lmin(iset), lmax(iset))
178 DO ipgf = 1, npgf(iset)
179 WRITE (iunit, "(F20.10,50(F15.10))") zet(ipgf, iset), (gcc(ipgf, ishell, iset), ishell=1, nshell(iset))
180 END DO
181 END DO
182
183 END SUBROUTINE basis_out
184
185! **************************************************************************************************
186
187END 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)
...
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:67
character(len= *), parameter, public compile_revision
Definition cp2k_info.F:37
character(len= *), parameter, public cp2k_version
Definition cp2k_info.F:41
character(len=default_string_length), public r_user_name
Definition cp2k_info.F:67
character(len=26), public r_datx
Definition cp2k_info.F:65
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_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, 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, 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, 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_r3d_rs_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_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.