(git:374b731)
Loading...
Searching...
No Matches
optbas_opt_utils.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!--------------------------------------------------------------------------------------------------!
12 USE cell_types, ONLY: cell_type
18 USE cp_fm_diag, ONLY: cp_fm_power
22 USE cp_fm_types, ONLY: cp_fm_create,&
26 USE dbcsr_api, ONLY: dbcsr_create,&
27 dbcsr_distribution_type,&
28 dbcsr_get_info,&
29 dbcsr_p_type,&
30 dbcsr_release,&
31 dbcsr_transposed,&
32 dbcsr_type,&
33 dbcsr_type_no_symmetry
37 USE kinds, ONLY: dp
45 USE qs_kind_types, ONLY: get_qs_kind,&
48 USE qs_mo_types, ONLY: get_mo_set,&
56#include "./base/base_uses.f90"
57
58 IMPLICIT NONE
59 PRIVATE
60
62
63 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'optbas_opt_utils'
64
65CONTAINS
66
67! **************************************************************************************************
68!> \brief ...
69!> \param mos ...
70!> \param mos_aux_fit ...
71!> \param matrix_ks ...
72!> \param Q ...
73!> \param Snew ...
74!> \param S_inv_orb ...
75!> \param fval ...
76!> \param energy ...
77!> \param S_cond_number ...
78! **************************************************************************************************
79 SUBROUTINE evaluate_optvals(mos, mos_aux_fit, matrix_ks, Q, Snew, S_inv_orb, &
80 fval, energy, S_cond_number)
81 TYPE(mo_set_type), DIMENSION(:), INTENT(IN) :: mos, mos_aux_fit
82 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks
83 TYPE(dbcsr_type), POINTER :: q, snew
84 TYPE(cp_fm_type), INTENT(IN) :: s_inv_orb
85 REAL(kind=dp) :: fval, energy, s_cond_number
86
87 CHARACTER(len=*), PARAMETER :: routinen = 'evaluate_optvals'
88
89 INTEGER :: handle, ispin, iunit, naux, nmo, norb, &
90 nspins
91 INTEGER, DIMENSION(:), POINTER :: col_blk_sizes, row_blk_sizes
92 REAL(kind=dp) :: tmp_energy, trace
93 REAL(kind=dp), DIMENSION(2) :: condnum
94 TYPE(cp_blacs_env_type), POINTER :: blacs_env
95 TYPE(cp_fm_type) :: tmp1, tmp2
96 TYPE(cp_fm_type), POINTER :: mo_coeff, mo_coeff_aux_fit
97 TYPE(dbcsr_distribution_type) :: dbcsr_dist
98 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: smat
99 TYPE(dbcsr_type) :: qt
100
101 CALL timeset(routinen, handle)
102
103 nspins = SIZE(mos)
104
105 NULLIFY (col_blk_sizes, row_blk_sizes)
106 CALL dbcsr_get_info(q, distribution=dbcsr_dist, &
107 nfullrows_total=naux, nfullcols_total=norb, &
108 row_blk_size=row_blk_sizes, col_blk_size=col_blk_sizes)
109 CALL dbcsr_create(matrix=qt, name="Qt", &
110 dist=dbcsr_dist, matrix_type=dbcsr_type_no_symmetry, &
111 row_blk_size=col_blk_sizes, col_blk_size=row_blk_sizes, &
112 nze=0)
113 CALL dbcsr_transposed(qt, q)
114 !
115 fval = 0.0_dp
116 energy = 0.0_dp
117 DO ispin = 1, nspins
118 CALL get_mo_set(mos(ispin), mo_coeff=mo_coeff)
119 CALL get_mo_set(mos_aux_fit(ispin), mo_coeff=mo_coeff_aux_fit)
120 CALL cp_fm_get_info(mo_coeff, ncol_global=nmo)
121 CALL cp_fm_create(tmp1, matrix_struct=mo_coeff%matrix_struct)
122 CALL cp_dbcsr_sm_fm_multiply(qt, mo_coeff_aux_fit, tmp1, nmo)
123 CALL cp_fm_trace(tmp1, mo_coeff, trace)
124 fval = fval - 2.0_dp*trace + 2.0_dp*nmo
125 !
126 CALL cp_fm_create(tmp2, matrix_struct=mo_coeff%matrix_struct)
127 CALL parallel_gemm('N', 'N', norb, nmo, norb, 1.0_dp, s_inv_orb, tmp1, 0.0_dp, tmp2)
128 CALL cp_dbcsr_sm_fm_multiply(matrix_ks(ispin)%matrix, tmp2, tmp1, nmo)
129 CALL cp_fm_trace(tmp2, tmp1, tmp_energy)
130 energy = energy + tmp_energy*(3.0_dp - real(nspins, kind=dp))
131 CALL cp_fm_release(tmp1)
132 CALL cp_fm_release(tmp2)
133 END DO
134 CALL dbcsr_release(qt)
135
136 ALLOCATE (smat(1, 1))
137 smat(1, 1)%matrix => snew
138 iunit = -1
139 CALL cp_fm_get_info(s_inv_orb, context=blacs_env)
140 CALL overlap_condnum(smat, condnum, iunit, .false., .true., .false., blacs_env)
141 s_cond_number = condnum(2)
142 DEALLOCATE (smat)
143
144 CALL timestop(handle)
145
146 END SUBROUTINE evaluate_optvals
147
148! **************************************************************************************************
149!> \brief ...
150!> \param saux ...
151!> \param sauxorb ...
152!> \param mos ...
153!> \param mosaux ...
154! **************************************************************************************************
155 SUBROUTINE fit_mo_coeffs(saux, sauxorb, mos, mosaux)
156 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: saux, sauxorb
157 TYPE(mo_set_type), DIMENSION(:), INTENT(IN) :: mos, mosaux
158
159 CHARACTER(len=*), PARAMETER :: routinen = 'fit_mo_coeffs'
160 REAL(kind=dp), PARAMETER :: threshold = 1.e-12_dp
161
162 INTEGER :: handle, ispin, naux, ndep, nmo, norb, &
163 nspins
164 TYPE(cp_fm_struct_type), POINTER :: fm_struct
165 TYPE(cp_fm_type) :: fm_s, fm_sinv, tmat, tmp1, tmp2, work
166 TYPE(cp_fm_type), POINTER :: mo_coeff, mo_coeff_aux
167
168 CALL timeset(routinen, handle)
169
170 CALL dbcsr_get_info(saux(1)%matrix, nfullrows_total=naux)
171 CALL dbcsr_get_info(sauxorb(1)%matrix, nfullcols_total=norb)
172 CALL get_mo_set(mos(1), mo_coeff=mo_coeff)
173
174 CALL cp_fm_struct_create(fm_struct, nrow_global=naux, ncol_global=naux, &
175 context=mo_coeff%matrix_struct%context, &
176 para_env=mo_coeff%matrix_struct%para_env)
177 CALL cp_fm_create(fm_s, fm_struct, name="s_aux")
178 CALL cp_fm_create(fm_sinv, fm_struct, name="s_aux_inv")
179 CALL copy_dbcsr_to_fm(saux(1)%matrix, fm_s)
180 CALL cp_fm_invert(fm_s, fm_sinv)
181 CALL cp_fm_release(fm_s)
182 CALL cp_fm_struct_release(fm_struct)
183 nspins = SIZE(mos)
184 DO ispin = 1, nspins
185 CALL get_mo_set(mos(ispin), mo_coeff=mo_coeff)
186 CALL get_mo_set(mosaux(ispin), mo_coeff=mo_coeff_aux)
187 CALL cp_fm_get_info(mo_coeff, ncol_global=nmo)
188 CALL cp_fm_create(tmp1, matrix_struct=mo_coeff_aux%matrix_struct)
189 CALL cp_fm_create(tmp2, matrix_struct=mo_coeff_aux%matrix_struct)
190 CALL cp_fm_struct_create(fm_struct, nrow_global=nmo, ncol_global=nmo, &
191 context=mo_coeff%matrix_struct%context, &
192 para_env=mo_coeff%matrix_struct%para_env)
193 CALL cp_fm_create(tmat, fm_struct, name="tmat")
194 CALL cp_fm_create(work, fm_struct, name="work")
195 CALL cp_fm_struct_release(fm_struct)
196 !
197 CALL cp_dbcsr_sm_fm_multiply(sauxorb(1)%matrix, mo_coeff, tmp1, nmo)
198 CALL parallel_gemm('N', 'N', naux, nmo, naux, 1.0_dp, fm_sinv, tmp1, 0.0_dp, tmp2)
199 CALL parallel_gemm('T', 'N', nmo, nmo, naux, 1.0_dp, tmp1, tmp2, 0.0_dp, tmat)
200 CALL cp_fm_power(tmat, work, -0.5_dp, threshold, ndep)
201 CALL parallel_gemm('N', 'N', naux, nmo, nmo, 1.0_dp, tmp2, tmat, 0.0_dp, mo_coeff_aux)
202 !
203 CALL cp_fm_release(work)
204 CALL cp_fm_release(tmat)
205 CALL cp_fm_release(tmp1)
206 CALL cp_fm_release(tmp2)
207 END DO
208 CALL cp_fm_release(fm_sinv)
209
210 CALL timestop(handle)
211
212 END SUBROUTINE fit_mo_coeffs
213
214! **************************************************************************************************
215!> \brief rebuilds neighborlist for absis sets
216!> \param qs_env ...
217!> \param sab_aux ...
218!> \param sab_aux_orb ...
219!> \param basis_type ...
220!> \par History
221!> adapted from kg_build_neighborlist
222! **************************************************************************************************
223 SUBROUTINE optbas_build_neighborlist(qs_env, sab_aux, sab_aux_orb, basis_type)
224 TYPE(qs_environment_type), POINTER :: qs_env
225 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
226 POINTER :: sab_aux, sab_aux_orb
227 CHARACTER(*) :: basis_type
228
229 CHARACTER(LEN=*), PARAMETER :: routinen = 'optbas_build_neighborlist'
230
231 INTEGER :: handle, ikind, nkind
232 LOGICAL :: mic, molecule_only
233 LOGICAL, ALLOCATABLE, DIMENSION(:) :: aux_fit_present, orb_present
234 REAL(dp) :: subcells
235 REAL(dp), ALLOCATABLE, DIMENSION(:) :: aux_fit_radius, orb_radius
236 REAL(dp), ALLOCATABLE, DIMENSION(:, :) :: pair_radius
237 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
238 TYPE(cell_type), POINTER :: cell
239 TYPE(distribution_1d_type), POINTER :: distribution_1d
240 TYPE(distribution_2d_type), POINTER :: distribution_2d
241 TYPE(gto_basis_set_type), POINTER :: aux_fit_basis_set, orb_basis_set
242 TYPE(local_atoms_type), ALLOCATABLE, DIMENSION(:) :: atom2d
243 TYPE(molecule_type), DIMENSION(:), POINTER :: molecule_set
244 TYPE(mp_para_env_type), POINTER :: para_env
245 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
246 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
247 TYPE(qs_ks_env_type), POINTER :: ks_env
248
249 CALL timeset(routinen, handle)
250 NULLIFY (para_env)
251
252 ! restrict lists to molecular subgroups
253 molecule_only = .false.
254 mic = molecule_only
255
256 CALL get_qs_env(qs_env=qs_env, &
257 ks_env=ks_env, &
258 atomic_kind_set=atomic_kind_set, &
259 qs_kind_set=qs_kind_set, &
260 cell=cell, &
261 distribution_2d=distribution_2d, &
262 molecule_set=molecule_set, &
263 local_particles=distribution_1d, &
264 particle_set=particle_set, &
265 para_env=para_env)
266
267 CALL section_vals_val_get(qs_env%input, "DFT%SUBCELLS", r_val=subcells)
268
269 ! Allocate work storage
270 nkind = SIZE(atomic_kind_set)
271 ALLOCATE (orb_radius(nkind), aux_fit_radius(nkind))
272 orb_radius(:) = 0.0_dp
273 aux_fit_radius(:) = 0.0_dp
274 ALLOCATE (orb_present(nkind), aux_fit_present(nkind))
275 ALLOCATE (pair_radius(nkind, nkind))
276 ALLOCATE (atom2d(nkind))
277
278 CALL atom2d_build(atom2d, distribution_1d, distribution_2d, atomic_kind_set, &
279 molecule_set, molecule_only, particle_set=particle_set)
280
281 DO ikind = 1, nkind
282 CALL get_atomic_kind(atomic_kind_set(ikind), atom_list=atom2d(ikind)%list)
283 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set, basis_type="ORB")
284 IF (ASSOCIATED(orb_basis_set)) THEN
285 orb_present(ikind) = .true.
286 CALL get_gto_basis_set(gto_basis_set=orb_basis_set, kind_radius=orb_radius(ikind))
287 ELSE
288 orb_present(ikind) = .false.
289 orb_radius(ikind) = 0.0_dp
290 END IF
291 CALL get_qs_kind(qs_kind_set(ikind), basis_set=aux_fit_basis_set, basis_type=basis_type)
292 IF (ASSOCIATED(aux_fit_basis_set)) THEN
293 aux_fit_present(ikind) = .true.
294 CALL get_gto_basis_set(gto_basis_set=aux_fit_basis_set, kind_radius=aux_fit_radius(ikind))
295 ELSE
296 aux_fit_present(ikind) = .false.
297 aux_fit_radius(ikind) = 0.0_dp
298 END IF
299 END DO
300 !
301 CALL pair_radius_setup(aux_fit_present, aux_fit_present, aux_fit_radius, aux_fit_radius, pair_radius)
302 CALL build_neighbor_lists(sab_aux, particle_set, atom2d, cell, pair_radius, &
303 mic=mic, molecular=molecule_only, subcells=subcells, nlname="sab_aux")
304 CALL pair_radius_setup(aux_fit_present, orb_present, aux_fit_radius, orb_radius, pair_radius)
305 CALL build_neighbor_lists(sab_aux_orb, particle_set, atom2d, cell, pair_radius, &
306 mic=mic, symmetric=.false., molecular=molecule_only, subcells=subcells, &
307 nlname="sab_aux_orb")
308
309 ! Release work storage
310 CALL atom2d_cleanup(atom2d)
311 DEALLOCATE (atom2d)
312 DEALLOCATE (orb_present, aux_fit_present)
313 DEALLOCATE (orb_radius, aux_fit_radius)
314 DEALLOCATE (pair_radius)
315
316 CALL timestop(handle)
317
318 END SUBROUTINE optbas_build_neighborlist
319
320END MODULE optbas_opt_utils
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.
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)
...
Handles all functions related to the CELL.
Definition cell_types.F:15
methods related to the blacs parallel environment
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_sm_fm_multiply(matrix, fm_in, fm_out, ncol, alpha, beta)
multiply a dbcsr with a fm matrix
subroutine, public copy_dbcsr_to_fm(matrix, fm)
Copy a DBCSR matrix to a BLACS matrix.
basic linear algebra operations for full matrices
subroutine, public cp_fm_invert(matrix_a, matrix_inverse, det_a, eps_svd, eigval)
Inverts a cp_fm_type matrix, optionally returning the determinant of the input matrix.
used for collecting some of the diagonalization schemes available for cp_fm_type. cp_fm_power also mo...
Definition cp_fm_diag.F:17
subroutine, public cp_fm_power(matrix, work, exponent, threshold, n_dependent, verbose, eigvals)
...
Definition cp_fm_diag.F:896
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
Definition cp_fm_types.F:15
subroutine, public cp_fm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, nrow_locals, ncol_locals, matrix_struct, para_env)
returns all kind of information about the full matrix
subroutine, public cp_fm_create(matrix, matrix_struct, name, use_sp)
creates a new full matrix with the given structure
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
stores a mapping of 2D info (e.g. matrix) on a 2D processor distribution (i.e. blacs grid) where cpus...
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
Interface to the message passing library MPI.
Define the data structure for the molecule information.
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)
...
basic linear algebra operations for full matrixes
Define the data structure for the particle information.
Calculation of overlap matrix condition numbers.
Definition qs_condnum.F:13
subroutine, public overlap_condnum(matrixkp_s, condnum, iunit, norml1, norml2, use_arnoldi, blacs_env)
Calculation of the overlap matrix Condition Number.
Definition qs_condnum.F:64
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.
Definition and initialisation of the mo data type.
Definition qs_mo_types.F:22
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.
Generate the atomic neighbor lists.
subroutine, public atom2d_cleanup(atom2d)
free the internals of atom2d
subroutine, public pair_radius_setup(present_a, present_b, radius_a, radius_b, pair_radius, prmin)
...
subroutine, public build_neighbor_lists(ab_list, particle_set, atom, cell, pair_radius, subcells, mic, symmetric, molecular, subset_of_mol, current_subset, operator_type, nlname, atomb_to_keep)
Build simple pair neighbor lists.
subroutine, public atom2d_build(atom2d, distribution_1d, distribution_2d, atomic_kind_set, molecule_set, molecule_only, particle_set)
Build some distribution structure of atoms, refactored from build_qs_neighbor_lists.
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
Definition cell_types.F:55
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
keeps the information about the structure of a full matrix
represent a full matrix
structure to store local (to a processor) ordered lists of integers.
distributes pairs on a 2d grid of processors
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...