34#include "./base/base_uses.f90"
40 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'mao_io'
44 INTEGER,
PARAMETER,
PRIVATE :: file_format_version = 4
57 CHARACTER(len=*),
PARAMETER :: printkey_section =
'DFT%PRINT%MAO_ANALYSIS', &
58 routinen =
'mao_write_pao_restart'
60 INTEGER :: handle, unit_nr
65 CALL timeset(routinen, handle)
68 CALL get_qs_env(qs_env, input=input, para_env=para_env)
70 IF (
SIZE(mao_coef) == 1)
THEN
76 file_action=
"WRITE", &
77 file_position=
"REWIND", &
78 file_status=
"UNKNOWN", &
81 IF (unit_nr > 0)
CALL write_restart_header(qs_env, unit_nr)
83 CALL write_diagonal_blocks(para_env, mao_coef(1)%matrix,
"Xblock", unit_nr)
84 IF (unit_nr > 0)
WRITE (unit_nr,
'(A)')
"THE_END"
88 cpwarn(
"MAO/PAO restart only for restricted case available.")
102 SUBROUTINE write_diagonal_blocks(para_env, matrix, label, unit_nr)
105 CHARACTER(LEN=*),
INTENT(IN) :: label
106 INTEGER,
INTENT(IN) :: unit_nr
108 INTEGER :: i, iatom, m, n, natoms
109 INTEGER,
DIMENSION(:),
POINTER :: col_blk_sizes, row_blk_sizes
111 REAL(
dp),
DIMENSION(:, :),
POINTER :: local_block, mpi_buffer
114 CALL dbcsr_get_info(matrix, row_blk_size=row_blk_sizes, col_blk_size=col_blk_sizes)
115 cpassert(
SIZE(row_blk_sizes) ==
SIZE(col_blk_sizes))
116 natoms =
SIZE(row_blk_sizes)
119 n = row_blk_sizes(iatom)
120 m = col_blk_sizes(iatom)
121 ALLOCATE (mpi_buffer(n, m))
122 NULLIFY (local_block)
123 CALL dbcsr_get_block_p(matrix=matrix, row=iatom, col=iatom, block=local_block, found=found)
124 IF (
ASSOCIATED(local_block))
THEN
125 IF (
SIZE(local_block) > 0) &
126 mpi_buffer(:, :) = local_block(:, :)
128 mpi_buffer(:, :) = 0.0_dp
131 CALL para_env%sum(mpi_buffer)
132 IF (unit_nr > 0)
THEN
135 mpi_buffer(:, i) = mpi_buffer(:, i)/norm2(mpi_buffer(:, i))
138 WRITE (unit_nr, fmt=
"(A,1X,I10,1X)", advance=
'no') label, iatom
139 WRITE (unit_nr, *) mpi_buffer
141 DEALLOCATE (mpi_buffer)
145 IF (unit_nr > 0)
FLUSH (unit_nr)
147 END SUBROUTINE write_diagonal_blocks
154 SUBROUTINE write_restart_header(qs_env, unit_nr)
156 INTEGER,
INTENT(IN) :: unit_nr
158 CHARACTER(LEN=default_string_length) :: kindname
159 INTEGER :: iatom, ikind, ipot, istep, nmao, &
161 REAL(kind=
dp) :: energy
166 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
170 particle_set=particle_set, &
171 atomic_kind_set=atomic_kind_set, &
172 qs_kind_set=qs_kind_set)
174 WRITE (unit_nr,
"(A,5X,I0)")
"Version", file_format_version
176 WRITE (unit_nr,
"(A,5X,F20.10)")
"Energy", energy
178 WRITE (unit_nr,
"(A,5X,I0)")
"Step", istep
179 WRITE (unit_nr,
"(A,5X,A)")
"Parametrization",
"EQUIVARIANT"
182 WRITE (unit_nr,
"(A,5X,I0)")
"Nkinds",
SIZE(atomic_kind_set)
183 DO ikind = 1,
SIZE(atomic_kind_set)
185 CALL get_qs_kind(qs_kind_set(ikind), mao=nmao, nsgf=nsgf, basis_set=basis_set)
187 WRITE (unit_nr,
"(A,5X,I10,1X,A,1X,I3)")
"Kind", ikind, trim(kindname), z
188 WRITE (unit_nr,
"(A,5X,I10,1X,I3)")
"NParams", ikind, nparams
189 WRITE (unit_nr,
"(A,5X,I10,1X,I10,1X,A)")
"PrimBasis", ikind, nsgf, trim(basis_set%name)
190 WRITE (unit_nr,
"(A,5X,I10,1X,I3)")
"PaoBasis", ikind, nmao
192 WRITE (unit_nr,
"(A,5X,I10,1X,I3)")
"NPaoPotentials", ikind, ipot
196 WRITE (unit_nr, fmt=
"(A,5X)", advance=
'no')
"Cell"
197 WRITE (unit_nr, *) cell%hmat*
angstrom
200 WRITE (unit_nr,
"(A,5X,I0)")
"Natoms",
SIZE(particle_set)
201 DO iatom = 1,
SIZE(particle_set)
202 kindname = particle_set(iatom)%atomic_kind%name
203 WRITE (unit_nr, fmt=
"(A,5X,I10,5X,A,1X)", advance=
'no')
"Atom ", iatom, trim(kindname)
204 WRITE (unit_nr, *) particle_set(iatom)%r*
angstrom
207 END SUBROUTINE write_restart_header
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
Handles all functions related to the CELL.
subroutine, public dbcsr_get_block_p(matrix, row, col, block, found, row_size, col_size)
...
subroutine, public dbcsr_get_info(matrix, nblkrows_total, nblkcols_total, nfullrows_total, nfullcols_total, nblkrows_local, nblkcols_local, nfullrows_local, nfullcols_local, my_prow, my_pcol, local_rows, local_cols, proc_row_dist, proc_col_dist, row_blk_size, col_blk_size, row_blk_offset, col_blk_offset, distribution, name, matrix_type, group)
...
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Routines for writing PAO restart files from MAO.
subroutine, public mao_write_pao_restart(mao_coef, qs_env)
Writes restart file.
Interface to the message passing library MPI.
Define the data structure for the particle information.
Definition of physical constants:
real(kind=dp), parameter, public angstrom
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, 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.
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, cneo_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, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.