(git:98357aa)
Loading...
Searching...
No Matches
qs_mom_methods.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief methods for deltaSCF calculations
10! **************************************************************************************************
12 USE bibliography, ONLY: barca2018,&
14 cite_reference
16 USE cp_dbcsr_api, ONLY: dbcsr_p_type
22 USE cp_fm_types, ONLY: cp_fm_create,&
29 USE input_constants, ONLY: momproj_norm,&
34 USE kinds, ONLY: dp
37 USE qs_mo_types, ONLY: get_mo_set,&
44 USE util, ONLY: sort,&
46#include "./base/base_uses.f90"
47
48 IMPLICIT NONE
49
50 PRIVATE
51
52 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_mom_methods'
53
54 PUBLIC :: do_mom_guess, do_mom_diag
55 PRIVATE :: mom_is_unique_orbital_indices, mom_reoccupy_orbitals
56
57CONTAINS
58
59! **************************************************************************************************
60!> \brief check that every molecular orbital index appears only once in each
61!> (de-)occupation list supplied by user. Check that all the indices
62!> are positive integers and abort if it is not the case.
63!> \param iarr list of molecular orbital indices to be checked
64!> \return .true. if all the elements are unique or the list contains
65!> exactly one 0 element (meaning no excitation)
66!> \par History
67!> 01.2016 created [Sergey Chulkov]
68! **************************************************************************************************
69 FUNCTION mom_is_unique_orbital_indices(iarr) RESULT(is_unique)
70 INTEGER, DIMENSION(:), POINTER :: iarr
71 LOGICAL :: is_unique
72
73 CHARACTER(len=*), PARAMETER :: routineN = 'mom_is_unique_orbital_indices'
74
75 INTEGER :: handle, norbs
76 INTEGER, DIMENSION(:), POINTER :: tmp_iarr
77
78 CALL timeset(routinen, handle)
79
80 cpassert(ASSOCIATED(iarr))
81 norbs = SIZE(iarr)
82
83 IF (norbs > 0) THEN
84 ALLOCATE (tmp_iarr(norbs))
85
86 tmp_iarr(:) = iarr(:)
87 CALL sort_unique(tmp_iarr, is_unique)
88
89 ! Ensure that all orbital indices are positive integers.
90 ! A special value '0' means 'disabled keyword',
91 ! it must appear once to be interpreted in such a way
92 IF (tmp_iarr(1) < 0 .OR. (tmp_iarr(1) == 0 .AND. norbs > 1)) THEN
93 cpabort("MOM: all molecular orbital indices must be positive integer numbers")
94 END IF
95
96 DEALLOCATE (tmp_iarr)
97 END IF
98
99 is_unique = .true.
100
101 CALL timestop(handle)
102
103 END FUNCTION mom_is_unique_orbital_indices
104
105! **************************************************************************************************
106!> \brief swap occupation numbers between molecular orbitals
107!> from occupation and de-occupation lists
108!> \param mo_set set of molecular orbitals
109!> \param deocc_orb_set list of de-occupied orbital indices
110!> \param occ_orb_set list of newly occupied orbital indices
111!> \param spin spin component of the molecular orbitals;
112!> to be used for diagnostic messages
113!> \par History
114!> 01.2016 created [Sergey Chulkov]
115! **************************************************************************************************
116 SUBROUTINE mom_reoccupy_orbitals(mo_set, deocc_orb_set, occ_orb_set, spin)
117 TYPE(mo_set_type), INTENT(INOUT) :: mo_set
118 INTEGER, DIMENSION(:), POINTER :: deocc_orb_set, occ_orb_set
119 CHARACTER(len=*), INTENT(in) :: spin
120
121 CHARACTER(len=*), PARAMETER :: routineN = 'mom_reoccupy_orbitals'
122
123 CHARACTER(len=10) :: str_iorb, str_norbs
124 CHARACTER(len=3) :: str_prefix
125 INTEGER :: handle, homo, iorb, lfomo, nao, nmo, &
126 norbs
127 REAL(kind=dp) :: maxocc
128 REAL(kind=dp), DIMENSION(:), POINTER :: occ_nums
129
130 CALL timeset(routinen, handle)
131
132 ! MOM electron excitation should preserve both the number of electrons and
133 ! multiplicity of the electronic system thus ensuring the following constraint :
134 ! norbs = SIZE(deocc_orb_set) == SIZE(occ_orb_set)
135 norbs = SIZE(deocc_orb_set)
136
137 ! the following assertion should never raise an exception
138 cpassert(SIZE(deocc_orb_set) == SIZE(occ_orb_set))
139
140 ! MOM does not follow aufbau principle producing non-uniformly occupied orbitals
141 CALL set_mo_set(mo_set=mo_set, uniform_occupation=.false.)
142
143 IF (deocc_orb_set(1) /= 0 .AND. occ_orb_set(1) /= 0) THEN
144 CALL get_mo_set(mo_set=mo_set, maxocc=maxocc, &
145 nao=nao, nmo=nmo, occupation_numbers=occ_nums)
146
147 IF (deocc_orb_set(norbs) > nao .OR. occ_orb_set(norbs) > nao) THEN
148 ! STOP: one of the molecular orbital index exceeds the number of atomic basis functions available
149 CALL integer_to_string(nao, str_norbs)
150
151 IF (deocc_orb_set(norbs) >= occ_orb_set(norbs)) THEN
152 iorb = deocc_orb_set(norbs)
153 str_prefix = 'de-'
154 ELSE
155 iorb = occ_orb_set(norbs)
156 str_prefix = ''
157 END IF
158 CALL integer_to_string(iorb, str_iorb)
159
160 CALL cp_abort(__location__, "Unable to "//trim(str_prefix)//"occupy "// &
161 trim(spin)//" orbital No. "//trim(str_iorb)// &
162 " since its index exceeds the number of atomic orbital functions available ("// &
163 trim(str_norbs)//"). Please consider using a larger basis set.")
164 END IF
165
166 IF (deocc_orb_set(norbs) > nmo .OR. occ_orb_set(norbs) > nmo) THEN
167 ! STOP: one of the molecular orbital index exceeds the number of constructed molecular orbitals
168 IF (deocc_orb_set(norbs) >= occ_orb_set(norbs)) THEN
169 iorb = deocc_orb_set(norbs)
170 ELSE
171 iorb = occ_orb_set(norbs)
172 END IF
173
174 IF (iorb - nmo > 1) THEN
175 CALL integer_to_string(iorb - nmo, str_iorb)
176 str_prefix = 's'
177 ELSE
178 str_iorb = 'an'
179 str_prefix = ''
180 END IF
181
182 CALL integer_to_string(nmo, str_norbs)
183
184 CALL cp_abort(__location__, "The number of molecular orbitals ("//trim(str_norbs)// &
185 ") is not enough to perform MOM calculation. Please add "// &
186 trim(str_iorb)//" extra orbital"//trim(str_prefix)// &
187 " using the ADDED_MOS keyword in the SCF section of your input file.")
188 END IF
189
190 DO iorb = 1, norbs
191 ! swap occupation numbers between two adjoint molecular orbitals
192 IF (occ_nums(deocc_orb_set(iorb)) <= 0.0_dp) THEN
193 CALL integer_to_string(deocc_orb_set(iorb), str_iorb)
194
195 CALL cp_abort(__location__, "The "//trim(spin)//" orbital No. "// &
196 trim(str_iorb)//" is not occupied thus it cannot be deoccupied.")
197 END IF
198
199 IF (occ_nums(occ_orb_set(iorb)) > 0.0_dp) THEN
200 CALL integer_to_string(occ_orb_set(iorb), str_iorb)
201
202 CALL cp_abort(__location__, "The "//trim(spin)//" orbital No. "// &
203 trim(str_iorb)//" is already occupied thus it cannot be reoccupied.")
204 END IF
205
206 occ_nums(occ_orb_set(iorb)) = occ_nums(deocc_orb_set(iorb))
207 occ_nums(deocc_orb_set(iorb)) = 0.0_dp
208 END DO
209
210 ! locate the lowest non-maxocc occupied orbital
211 DO lfomo = 1, nmo
212 IF (occ_nums(lfomo) /= maxocc) EXIT
213 END DO
214
215 ! locate the highest occupied orbital
216 DO homo = nmo, 1, -1
217 IF (occ_nums(homo) > 0.0_dp) EXIT
218 END DO
219
220 CALL set_mo_set(mo_set=mo_set, homo=homo, lfomo=lfomo)
221
222 ELSE IF (deocc_orb_set(1) /= 0 .OR. occ_orb_set(1) /= 0) THEN
223 CALL cp_abort(__location__, &
224 "Incorrect multiplicity of the MOM reference electronic state")
225 END IF
226
227 CALL timestop(handle)
228
229 END SUBROUTINE mom_reoccupy_orbitals
230
231! **************************************************************************************************
232!> \brief initial guess for the maximum overlap method
233!> \param nspins number of spin components
234!> \param mos array of molecular orbitals
235!> \param scf_control SCF control variables
236!> \param p_rmpv density matrix to be computed
237!> \par History
238!> * 01.2016 created [Sergey Chulkov]
239! **************************************************************************************************
240 SUBROUTINE do_mom_guess(nspins, mos, scf_control, p_rmpv)
241 INTEGER, INTENT(in) :: nspins
242 TYPE(mo_set_type), DIMENSION(:), INTENT(INOUT) :: mos
243 TYPE(scf_control_type), POINTER :: scf_control
244 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: p_rmpv
245
246 CHARACTER(len=*), PARAMETER :: routinen = 'do_mom_guess'
247
248 CHARACTER(len=10) :: str_iter
249 INTEGER :: handle, ispin, scf_iter
250 LOGICAL :: is_mo
251 REAL(kind=dp) :: maxa
252 TYPE(cp_fm_type), POINTER :: mo_coeff
253
254 CALL timeset(routinen, handle)
255
256 ! we are about to initialise the maximum overlap method,
257 ! so cite the relevant reference first
258 IF (scf_control%diagonalization%mom_type == momtype_mom) THEN
259 CALL cite_reference(gilbert2008)
260 ELSE IF (scf_control%diagonalization%mom_type == momtype_imom) THEN
261 CALL cite_reference(barca2018)
262 END IF
263
264 ! ensure we do not have duplicated orbital indices
265 IF (.NOT. &
266 (mom_is_unique_orbital_indices(scf_control%diagonalization%mom_deoccA) .AND. &
267 mom_is_unique_orbital_indices(scf_control%diagonalization%mom_deoccB) .AND. &
268 mom_is_unique_orbital_indices(scf_control%diagonalization%mom_occA) .AND. &
269 mom_is_unique_orbital_indices(scf_control%diagonalization%mom_occB))) THEN
270 CALL cp_abort(__location__, &
271 "Duplicate orbital indices were found in the MOM section")
272 END IF
273
274 ! ignore beta orbitals for spin-unpolarized calculations
275 IF (nspins == 1 .AND. (scf_control%diagonalization%mom_deoccB(1) /= 0 &
276 .OR. scf_control%diagonalization%mom_occB(1) /= 0)) THEN
277
278 CALL cp_warn(__location__, "Maximum overlap method will"// &
279 " ignore beta orbitals since neither UKS nor ROKS calculation is performed")
280 END IF
281
282 ! compute the change in multiplicity and number of electrons
283 IF (SIZE(scf_control%diagonalization%mom_deoccA) /= &
284 SIZE(scf_control%diagonalization%mom_occA) .OR. &
285 (nspins > 1 .AND. &
286 SIZE(scf_control%diagonalization%mom_deoccB) /= &
287 SIZE(scf_control%diagonalization%mom_occB))) THEN
288
289 CALL cp_abort(__location__, "Incorrect multiplicity of the MOM reference"// &
290 " electronic state or inconsistent number of electrons")
291 END IF
292
293 is_mo = .false.
294 ! by default activate MOM at the second SCF iteration as the
295 ! 'old' molecular orbitals are unavailable from the very beginning
296 scf_iter = 2
297 ! check if the molecular orbitals are actually there
298 ! by finding at least one MO coefficient > 0
299 DO ispin = 1, nspins
300 CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff)
301 CALL cp_fm_maxabsval(mo_coeff, maxa)
302 ! is_mo |= maxa > 0.0_dp
303 IF (maxa > 0.0_dp) THEN
304 is_mo = .true.
305 ! we already have the molecular orbitals (e.g. from a restart file);
306 ! activate MOM immediately if the input keyword START_ITER is not given
307 scf_iter = 1
308 EXIT
309 END IF
310 END DO
311
312 ! proceed alpha orbitals
313 IF (nspins >= 1) THEN
314 CALL mom_reoccupy_orbitals(mos(1), &
315 scf_control%diagonalization%mom_deoccA, &
316 scf_control%diagonalization%mom_occA, 'alpha')
317 END IF
318
319 ! proceed beta orbitals (if any)
320 IF (nspins >= 2) THEN
321 CALL mom_reoccupy_orbitals(mos(2), &
322 scf_control%diagonalization%mom_deoccB, &
323 scf_control%diagonalization%mom_occB, 'beta')
324 END IF
325
326 ! recompute the density matrix if the molecular orbitals are here;
327 ! otherwise do nothing to prevent zeroing out the density matrix
328 ! obtained from atomic guess
329 IF (is_mo) THEN
330 DO ispin = 1, nspins
331 CALL calculate_density_matrix(mos(ispin), p_rmpv(ispin)%matrix)
332 END DO
333 END IF
334
335 ! adjust the start SCF iteration number if needed
336 IF (scf_control%diagonalization%mom_start < scf_iter) THEN
337 IF (scf_control%diagonalization%mom_start > 0) THEN
338 ! inappropriate iteration number has been provided through the input file;
339 ! fix it and issue a warning message
340 CALL integer_to_string(scf_iter, str_iter)
341 CALL cp_warn(__location__, &
342 "The maximum overlap method will be activated at the SCF iteration No. "// &
343 trim(str_iter)//" due to the SCF guess method used.")
344 END IF
345 scf_control%diagonalization%mom_start = scf_iter
346 ELSE IF (scf_control%diagonalization%mom_start > scf_iter .AND. &
347 (scf_control%diagonalization%mom_occA(1) > 0 .OR. scf_control%diagonalization%mom_occB(1) > 0)) THEN
348 ! the keyword START_ITER has been provided for an excited state calculation, ignore it
349 CALL integer_to_string(scf_iter, str_iter)
350 CALL cp_warn(__location__, &
351 "The maximum overlap method will be activated at the SCF iteration No. "// &
352 trim(str_iter)//" because an excited state calculation has been requested")
353 scf_control%diagonalization%mom_start = scf_iter
354 END IF
355
356 ! MOM is now initialised properly
357 scf_control%diagonalization%mom_didguess = .true.
358
359 CALL timestop(handle)
360
361 END SUBROUTINE do_mom_guess
362
363! **************************************************************************************************
364!> \brief do an SCF iteration, then compute occupation numbers of the new
365!> molecular orbitals according to their overlap with the previous ones
366!> \param scf_env SCF environment information
367!> \param mos array of molecular orbitals
368!> \param matrix_ks sparse Kohn-Sham matrix
369!> \param matrix_s sparse overlap matrix
370!> \param scf_control SCF control variables
371!> \param scf_section SCF input section
372!> \param diis_step have we done a DIIS step
373!> \par History
374!> * 07.2014 created [Matt Watkins]
375!> * 01.2016 release version [Sergey Chulkov]
376!> * 03.2018 initial maximum overlap method [Sergey Chulkov]
377! **************************************************************************************************
378 SUBROUTINE do_mom_diag(scf_env, mos, matrix_ks, matrix_s, scf_control, scf_section, diis_step)
379 TYPE(qs_scf_env_type), POINTER :: scf_env
380 TYPE(mo_set_type), DIMENSION(:), INTENT(INOUT) :: mos
381 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks, matrix_s
382 TYPE(scf_control_type), POINTER :: scf_control
383 TYPE(section_vals_type), POINTER :: scf_section
384 LOGICAL, INTENT(INOUT) :: diis_step
385
386 CHARACTER(len=*), PARAMETER :: routinen = 'do_mom_diag'
387
388 INTEGER :: handle, homo, iproj, ispin, lfomo, nao, &
389 nmo, nspins
390 INTEGER, ALLOCATABLE, DIMENSION(:) :: inds
391 REAL(kind=dp) :: maxocc
392 REAL(kind=dp), DIMENSION(:), POINTER :: occ_nums, proj, tmp_occ_nums
393 TYPE(cp_blacs_env_type), POINTER :: blacs_env
394 TYPE(cp_fm_struct_type), POINTER :: ao_mo_fmstruct, mo_mo_fmstruct
395 TYPE(cp_fm_type), POINTER :: mo_coeff, mo_coeff_ref, overlap, svec
396
397 CALL timeset(routinen, handle)
398
399 IF (.NOT. scf_control%diagonalization%mom_didguess) THEN
400 CALL cp_abort(__location__, &
401 "The current implementation of the maximum overlap method is incompatible with the initial SCF guess")
402 END IF
403
404 ! number of spins == dft_control%nspins
405 nspins = SIZE(matrix_ks)
406
407 ! copy old molecular orbitals
408 IF (scf_env%iter_count >= scf_control%diagonalization%mom_start) THEN
409 IF (.NOT. ASSOCIATED(scf_env%mom_ref_mo_coeff)) THEN
410 ALLOCATE (scf_env%mom_ref_mo_coeff(nspins))
411 DO ispin = 1, nspins
412 NULLIFY (ao_mo_fmstruct)
413 CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff, occupation_numbers=occ_nums)
414 CALL cp_fm_get_info(mo_coeff, matrix_struct=ao_mo_fmstruct)
415 CALL cp_fm_create(scf_env%mom_ref_mo_coeff(ispin), ao_mo_fmstruct)
416
417 ! Initial Maximum Overlap Method: keep initial molecular orbitals
418 IF (scf_control%diagonalization%mom_type == momtype_imom) THEN
419 CALL cp_fm_to_fm(mo_coeff, scf_env%mom_ref_mo_coeff(ispin))
420 CALL cp_fm_column_scale(scf_env%mom_ref_mo_coeff(ispin), occ_nums)
421 END IF
422 END DO
423 END IF
424
425 ! allocate the molecular orbitals overlap matrix
426 IF (.NOT. ASSOCIATED(scf_env%mom_overlap)) THEN
427 ALLOCATE (scf_env%mom_overlap(nspins))
428 DO ispin = 1, nspins
429 NULLIFY (blacs_env, mo_mo_fmstruct)
430 CALL get_mo_set(mo_set=mos(ispin), nmo=nmo, mo_coeff=mo_coeff)
431 CALL cp_fm_get_info(mo_coeff, context=blacs_env)
432 CALL cp_fm_struct_create(mo_mo_fmstruct, nrow_global=nmo, ncol_global=nmo, context=blacs_env)
433 CALL cp_fm_create(scf_env%mom_overlap(ispin), mo_mo_fmstruct)
434 CALL cp_fm_struct_release(mo_mo_fmstruct)
435 END DO
436 END IF
437
438 ! allocate a matrix to store the product S * mo_coeff
439 IF (.NOT. ASSOCIATED(scf_env%mom_s_mo_coeff)) THEN
440 ALLOCATE (scf_env%mom_s_mo_coeff(nspins))
441 DO ispin = 1, nspins
442 NULLIFY (ao_mo_fmstruct)
443 CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff)
444 CALL cp_fm_get_info(mo_coeff, matrix_struct=ao_mo_fmstruct)
445 CALL cp_fm_create(scf_env%mom_s_mo_coeff(ispin), ao_mo_fmstruct)
446 END DO
447 END IF
448
449 ! Original Maximum Overlap Method: keep orbitals from the previous SCF iteration
450 IF (scf_control%diagonalization%mom_type == momtype_mom) THEN
451 DO ispin = 1, nspins
452 CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff, occupation_numbers=occ_nums)
453 CALL cp_fm_to_fm(mo_coeff, scf_env%mom_ref_mo_coeff(ispin))
454 CALL cp_fm_column_scale(scf_env%mom_ref_mo_coeff(ispin), occ_nums)
455 END DO
456 END IF
457 END IF
458
459 ! solve the eigenproblem
460 CALL general_eigenproblem(scf_env, mos, matrix_ks, matrix_s, scf_control, scf_section, diis_step)
461
462 IF (scf_env%iter_count >= scf_control%diagonalization%mom_start) THEN
463 DO ispin = 1, nspins
464
465 ! TO DO: sparse-matrix variant; check if use_mo_coeff_b is set, and if yes use mo_coeff_b instead
466 CALL get_mo_set(mo_set=mos(ispin), maxocc=maxocc, mo_coeff=mo_coeff, &
467 nao=nao, nmo=nmo, occupation_numbers=occ_nums)
468
469 mo_coeff_ref => scf_env%mom_ref_mo_coeff(ispin)
470 overlap => scf_env%mom_overlap(ispin)
471 svec => scf_env%mom_s_mo_coeff(ispin)
472
473 ! svec = S * C(new)
474 CALL cp_dbcsr_sm_fm_multiply(matrix_s(1)%matrix, mo_coeff, svec, nmo)
475
476 ! overlap = C(reference occupied)^T * S * C(new)
477 CALL parallel_gemm('T', 'N', nmo, nmo, nao, 1.0_dp, mo_coeff_ref, svec, 0.0_dp, overlap)
478
479 ALLOCATE (proj(nmo))
480 ALLOCATE (inds(nmo))
481 ALLOCATE (tmp_occ_nums(nmo))
482
483 ! project the new molecular orbitals into the space of the reference occupied orbitals
484 SELECT CASE (scf_control%diagonalization%mom_proj_formula)
485 CASE (momproj_sum)
486 ! proj_j = abs( \sum_i overlap(i, j) )
487 CALL cp_fm_vectorssum(overlap, proj)
488
489 DO iproj = 1, nmo
490 proj(iproj) = abs(proj(iproj))
491 END DO
492
493 CASE (momproj_norm)
494 ! proj_j = (\sum_i overlap(i, j)**2) ** 0.5
495 CALL cp_fm_vectorsnorm(overlap, proj)
496
497 CASE DEFAULT
498 cpabort("Unimplemented projection formula")
499 END SELECT
500
501 tmp_occ_nums(:) = occ_nums(:)
502 ! sort occupation numbers in ascending order
503 CALL sort(tmp_occ_nums, nmo, inds)
504 ! sort overlap projection in ascending order
505 CALL sort(proj, nmo, inds)
506
507 ! reorder occupation numbers according to overlap projections
508 DO iproj = 1, nmo
509 occ_nums(inds(iproj)) = tmp_occ_nums(iproj)
510 END DO
511
512 DEALLOCATE (tmp_occ_nums)
513 DEALLOCATE (inds)
514 DEALLOCATE (proj)
515
516 ! locate the lowest non-fully occupied orbital
517 DO lfomo = 1, nmo
518 IF (occ_nums(lfomo) /= maxocc) EXIT
519 END DO
520
521 ! locate the highest occupied orbital
522 DO homo = nmo, 1, -1
523 IF (occ_nums(homo) > 0.0_dp) EXIT
524 END DO
525
526 CALL set_mo_set(mo_set=mos(ispin), homo=homo, lfomo=lfomo)
527 END DO
528 END IF
529
530 ! recompute density matrix
531 DO ispin = 1, nspins
532 CALL calculate_density_matrix(mos(ispin), scf_env%p_mix_new(ispin, 1)%matrix)
533 END DO
534
535 CALL timestop(handle)
536
537 END SUBROUTINE do_mom_diag
538
539END MODULE qs_mom_methods
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public barca2018
integer, save, public gilbert2008
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
Basic linear algebra operations for full matrices.
subroutine, public cp_fm_column_scale(matrixa, scaling)
scales column i of matrix a with scaling(i)
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_vectorssum(matrix, sum_array, dir)
summing up all the elements along the matrix's i-th index or
subroutine, public cp_fm_vectorsnorm(matrix, norm_array)
find the inorm of each column norm_{j}= sqrt( \sum_{i} A_{ij}*A_{ij} )
subroutine, public cp_fm_maxabsval(matrix, a_max, ir_max, ic_max)
find the maximum absolute value of the matrix element maxval(abs(matrix))
subroutine, public cp_fm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
creates a new full matrix with the given structure
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public momproj_norm
integer, parameter, public momtype_mom
integer, parameter, public momproj_sum
integer, parameter, public momtype_imom
objects that represent the structure of input sections and the data contained in an input section
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
basic linear algebra operations for full matrixes
collects routines that calculate density matrices
Definition and initialisation of the mo data type.
Definition qs_mo_types.F:22
subroutine, public set_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, uniform_occupation, kts, mu, flexible_electron_count)
Set the components of a MO set 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.
methods for deltaSCF calculations
subroutine, public do_mom_diag(scf_env, mos, matrix_ks, matrix_s, scf_control, scf_section, diis_step)
do an SCF iteration, then compute occupation numbers of the new molecular orbitals according to their...
subroutine, public do_mom_guess(nspins, mos, scf_control, p_rmpv)
initial guess for the maximum overlap method
Different diagonalization schemes that can be used for the iterative solution of the eigenvalue probl...
subroutine, public general_eigenproblem(scf_env, mos, matrix_ks, matrix_s, scf_control, scf_section, diis_step)
the inner loop of scf, specific to diagonalization with S matrix basically, in goes the ks matrix out...
module that contains the definitions of the scf types
parameters that control an scf iteration
Utilities for string manipulations.
subroutine, public integer_to_string(inumber, string)
Converts an integer number to a string. The WRITE statement will return an error message,...
All kind of helpful little routines.
Definition util.F:14
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