35 USE dbcsr_api,
ONLY: dbcsr_add,&
70 #include "./base/base_uses.f90"
77 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_dcdr'
88 TYPE(dcdr_env_type) :: dcdr_env
89 TYPE(qs_environment_type),
POINTER :: qs_env
91 CHARACTER(LEN=*),
PARAMETER :: routinen =
'prepare_per_atom'
93 INTEGER :: handle, i, ispin, j, natom
94 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
96 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
97 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
99 CALL timeset(routinen, handle)
101 NULLIFY (sab_all, qs_kind_set, particle_set)
104 qs_kind_set=qs_kind_set, &
105 particle_set=particle_set)
107 natom =
SIZE(particle_set)
108 IF (dcdr_env%distributed_origin) dcdr_env%ref_point(:) = particle_set(dcdr_env%lambda)%r(:)
110 dcdr_env%delta_basis_function = 0._dp
111 dcdr_env%delta_basis_function(:, dcdr_env%lambda) = 1._dp
127 CALL dbcsr_set(dcdr_env%matrix_nosym_temp(i)%matrix, 0._dp)
128 CALL dbcsr_desymmetrize(dcdr_env%matrix_s(1 + i)%matrix, dcdr_env%matrix_s1(1 + i)%matrix)
129 CALL dbcsr_desymmetrize(dcdr_env%matrix_s(1 + i)%matrix, dcdr_env%matrix_nosym_temp(i)%matrix)
132 sab_all, dcdr_env%lambda, direction_or=.true.)
134 sab_all, dcdr_env%lambda, direction_or=.false.)
136 CALL dbcsr_add(dcdr_env%matrix_s1(1 + i)%matrix, dcdr_env%matrix_nosym_temp(i)%matrix, -1._dp, +1._dp)
137 CALL dbcsr_set(dcdr_env%matrix_nosym_temp(i)%matrix, 0._dp)
140 CALL dbcsr_set(dcdr_env%matrix_nosym_temp(i)%matrix, 0._dp)
141 CALL dbcsr_desymmetrize(dcdr_env%matrix_t(1 + i)%matrix, dcdr_env%matrix_t1(1 + i)%matrix)
142 CALL dbcsr_desymmetrize(dcdr_env%matrix_t(1 + i)%matrix, dcdr_env%matrix_nosym_temp(i)%matrix)
145 sab_all, dcdr_env%lambda, direction_or=.true.)
147 sab_all, dcdr_env%lambda, direction_or=.false.)
149 CALL dbcsr_add(dcdr_env%matrix_t1(1 + i)%matrix, dcdr_env%matrix_nosym_temp(i)%matrix, -1._dp, +1._dp)
150 CALL dbcsr_set(dcdr_env%matrix_nosym_temp(i)%matrix, 0._dp)
154 DO ispin = 1, dcdr_env%nspins
156 CALL dbcsr_set(dcdr_env%matrix_ppnl_1(i)%matrix, 0.0_dp)
157 CALL dbcsr_set(dcdr_env%matrix_hc(i)%matrix, 0.0_dp)
158 CALL dbcsr_set(dcdr_env%matrix_vhxc_perturbed_basis(ispin, i)%matrix, 0.0_dp)
159 CALL dbcsr_set(dcdr_env%matrix_vhxc_perturbed_basis(ispin, i + 3)%matrix, 0.0_dp)
160 CALL dbcsr_set(dcdr_env%matrix_d_vhxc_dR(i, ispin)%matrix, 0.0_dp)
161 CALL dbcsr_set(dcdr_env%matrix_core_charge_1(i)%matrix, 0.0_dp)
173 CALL dbcsr_set(dcdr_env%matrix_difdip(i, j)%matrix, 0._dp)
177 CALL dipole_deriv_ao(qs_env, dcdr_env%matrix_difdip, dcdr_env%delta_basis_function, 1, dcdr_env%ref_point)
179 CALL timestop(handle)
190 TYPE(dcdr_env_type) :: dcdr_env
191 TYPE(qs_environment_type),
POINTER :: qs_env
193 CHARACTER(LEN=*),
PARAMETER :: routinen =
'dcdr_build_op_dR'
194 REAL(kind=
dp),
PARAMETER :: one = 1.0_dp, zero = 0.0_dp
196 INTEGER :: handle, ispin, nao, nmo
197 TYPE(cp_fm_type) :: buf
198 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: opdr_sym
200 CALL timeset(routinen, handle)
207 ALLOCATE (opdr_sym(1)%matrix)
208 CALL dbcsr_copy(opdr_sym(1)%matrix, dcdr_env%matrix_s1(1)%matrix)
209 CALL dbcsr_set(opdr_sym(1)%matrix, 0.0_dp)
211 DO ispin = 1, dcdr_env%nspins
212 nmo = dcdr_env%nmo(ispin)
216 CALL dbcsr_add(opdr_sym(1)%matrix, dcdr_env%matrix_core_charge_1(dcdr_env%beta)%matrix, zero, one)
217 CALL dbcsr_add(opdr_sym(1)%matrix, dcdr_env%matrix_d_vhxc_dR(dcdr_env%beta, ispin)%matrix, one, one)
218 CALL dbcsr_add(opdr_sym(1)%matrix, dcdr_env%matrix_vhxc_perturbed_basis(ispin, dcdr_env%beta)%matrix, one, one)
221 CALL dbcsr_add(opdr_sym(1)%matrix, dcdr_env%matrix_hc(dcdr_env%beta)%matrix, one, one)
222 CALL dbcsr_add(opdr_sym(1)%matrix, dcdr_env%matrix_ppnl_1(dcdr_env%beta)%matrix, one, one)
223 CALL dbcsr_add(opdr_sym(1)%matrix, dcdr_env%matrix_apply_op_constant(ispin)%matrix, one, one)
225 CALL dbcsr_desymmetrize(opdr_sym(1)%matrix, dcdr_env%hamiltonian1(1)%matrix)
226 CALL dbcsr_add(dcdr_env%hamiltonian1(1)%matrix, dcdr_env%matrix_t1(dcdr_env%beta + 1)%matrix, one, one)
229 dcdr_env%op_dR(ispin), ncol=nmo)
233 CALL cp_fm_create(buf, dcdr_env%likemos_fm_struct(ispin)%struct)
234 CALL parallel_gemm(
'N',
'N', nao, nmo, nmo, &
235 -1.0_dp, dcdr_env%mo_coeff(ispin), dcdr_env%chc(ispin), &
239 nmo, alpha=1.0_dp, beta=1.0_dp)
240 CALL cp_fm_release(buf)
248 CALL timestop(handle)
260 TYPE(dcdr_env_type) :: dcdr_env
261 TYPE(qs_p_env_type) :: p_env
262 TYPE(qs_environment_type),
POINTER :: qs_env
264 CHARACTER(LEN=*),
PARAMETER :: routinen =
'dcdr_response_dR'
266 INTEGER :: handle, ispin, output_unit
267 LOGICAL :: should_stop
268 TYPE(cp_fm_type),
ALLOCATABLE,
DIMENSION(:) :: h1_psi0, psi0_order, psi1
269 TYPE(cp_fm_type),
POINTER :: mo_coeff
270 TYPE(cp_logger_type),
POINTER :: logger
271 TYPE(linres_control_type),
POINTER :: linres_control
272 TYPE(mo_set_type),
DIMENSION(:),
POINTER :: mos
273 TYPE(section_vals_type),
POINTER :: lr_section
275 CALL timeset(routinen, handle)
276 NULLIFY (linres_control, lr_section, logger)
279 linres_control=linres_control, &
286 extension=
".linresLog")
287 IF (output_unit > 0)
THEN
288 WRITE (unit=output_unit, fmt=
"(T10,A,/)") &
289 "*** Self consistent optimization of the response wavefunction ***"
293 ALLOCATE (psi0_order(dcdr_env%nspins))
294 ALLOCATE (psi1(dcdr_env%nspins))
295 ALLOCATE (h1_psi0(dcdr_env%nspins))
297 DO ispin = 1, dcdr_env%nspins
298 CALL cp_fm_create(psi1(ispin), dcdr_env%likemos_fm_struct(ispin)%struct)
299 CALL cp_fm_create(h1_psi0(ispin), dcdr_env%likemos_fm_struct(ispin)%struct)
300 CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff)
301 psi0_order(ispin) = mo_coeff
305 IF (linres_control%linres_restart)
THEN
306 CALL dcdr_read_restart(qs_env, lr_section, psi1, dcdr_env%lambda, dcdr_env%beta,
"dCdR")
308 DO ispin = 1, dcdr_env%nspins
313 IF (output_unit > 0)
THEN
314 WRITE (output_unit,
"(T10,A,I4,A)") &
315 "Response to the perturbation operator referring to atom ", dcdr_env%lambda, &
316 " displaced in "//achar(dcdr_env%beta + 119)
318 DO ispin = 1, dcdr_env%nspins
320 CALL cp_fm_to_fm(dcdr_env%op_dR(ispin), h1_psi0(ispin))
323 linres_control%lr_triplet = .false.
324 linres_control%do_kernel = .true.
325 linres_control%converged = .false.
332 CALL linres_solver(p_env, qs_env, psi1, h1_psi0, psi0_order, &
333 output_unit, should_stop)
334 DO ispin = 1, dcdr_env%nspins
335 CALL cp_fm_to_fm(psi1(ispin), dcdr_env%dCR(ispin))
339 IF (linres_control%linres_restart)
THEN
340 CALL dcdr_write_restart(qs_env, lr_section, psi1, dcdr_env%lambda, dcdr_env%beta,
"dCdR")
344 DO ispin = 1, dcdr_env%nspins
345 CALL cp_fm_release(psi1(ispin))
346 CALL cp_fm_release(h1_psi0(ispin))
348 DEALLOCATE (psi1, h1_psi0, psi0_order)
350 "PRINT%PROGRAM_RUN_INFO")
352 CALL timestop(handle)
363 TYPE(qs_environment_type),
POINTER :: qs_env
364 TYPE(dcdr_env_type) :: dcdr_env
366 CHARACTER(LEN=*),
PARAMETER :: routinen =
'apt_dR'
368 INTEGER :: alpha, handle, ikind, ispin, nao, nmo
370 REAL(
dp) :: apt_basis_derivative, &
371 apt_coeff_derivative, charge, f_spin
372 REAL(
dp),
DIMENSION(:, :, :),
POINTER :: apt_el, apt_nuc
373 TYPE(cp_fm_type) :: overlap1_mo, tmp_fm_like_mos
374 TYPE(cp_fm_type),
POINTER :: mo_coeff
375 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
376 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
378 apt_basis_derivative = 0._dp
379 apt_coeff_derivative = 0._dp
381 CALL timeset(routinen, handle)
383 NULLIFY (qs_kind_set, particle_set)
385 qs_kind_set=qs_kind_set, &
386 particle_set=particle_set)
389 apt_el => dcdr_env%apt_el_dcdr
390 apt_nuc => dcdr_env%apt_nuc_dcdr
392 f_spin = 2._dp/dcdr_env%nspins
394 DO ispin = 1, dcdr_env%nspins
396 CALL cp_fm_create(tmp_fm_like_mos, dcdr_env%likemos_fm_struct(ispin)%struct)
397 CALL cp_fm_create(overlap1_mo, dcdr_env%momo_fm_struct(ispin)%struct)
398 nmo = dcdr_env%nmo(ispin)
399 mo_coeff => dcdr_env%mo_coeff(ispin)
403 tmp_fm_like_mos, ncol=nmo)
404 CALL parallel_gemm(
"T",
"N", nmo, nmo, nao, &
405 1.0_dp, mo_coeff, tmp_fm_like_mos, &
411 CALL parallel_gemm(
"N",
"N", nao, nmo, nmo, &
412 -0.5_dp, mo_coeff, overlap1_mo, &
413 -1.0_dp, dcdr_env%dCR_prime(ispin))
414 CALL cp_fm_release(overlap1_mo)
419 CALL dbcsr_desymmetrize(dcdr_env%matrix_s1(1)%matrix, dcdr_env%matrix_nosym_temp(1)%matrix)
420 CALL dbcsr_desymmetrize(dcdr_env%moments(alpha)%matrix, dcdr_env%matrix_nosym_temp(2)%matrix)
421 CALL dbcsr_add(dcdr_env%matrix_nosym_temp(1)%matrix, dcdr_env%matrix_nosym_temp(2)%matrix, &
422 -dcdr_env%ref_point(alpha), 1._dp)
425 tmp_fm_like_mos, ncol=nmo)
426 CALL cp_fm_trace(mo_coeff, tmp_fm_like_mos, apt_coeff_derivative)
428 apt_coeff_derivative = (-2._dp)*f_spin*apt_coeff_derivative
429 apt_el(dcdr_env%beta, alpha, dcdr_env%lambda) &
430 = apt_el(dcdr_env%beta, alpha, dcdr_env%lambda) + apt_coeff_derivative
438 tmp_fm_like_mos, ncol=nmo)
439 CALL cp_fm_trace(mo_coeff, tmp_fm_like_mos, apt_basis_derivative)
442 apt_basis_derivative = -f_spin*apt_basis_derivative
443 apt_el(dcdr_env%beta, alpha, dcdr_env%lambda) = &
444 apt_el(dcdr_env%beta, alpha, dcdr_env%lambda) + apt_basis_derivative
447 CALL cp_fm_release(tmp_fm_like_mos)
451 CALL get_atomic_kind(particle_set(dcdr_env%lambda)%atomic_kind, kind_number=ikind)
452 CALL get_qs_kind(qs_kind_set(ikind), core_charge=charge, ghost=ghost)
453 IF (.NOT. ghost)
THEN
454 apt_nuc(dcdr_env%beta, dcdr_env%beta, dcdr_env%lambda) = &
455 apt_nuc(dcdr_env%beta, dcdr_env%beta, dcdr_env%lambda) + charge
459 CALL cp_fm_release(tmp_fm_like_mos)
460 CALL cp_fm_release(overlap1_mo)
462 CALL timestop(handle)
472 TYPE(qs_environment_type),
POINTER :: qs_env
473 TYPE(dcdr_env_type) :: dcdr_env
475 CHARACTER(LEN=*),
PARAMETER :: routinen =
'apt_dR_localization'
477 INTEGER :: alpha, handle, i, icenter, ikind, ispin, &
478 map_atom, map_molecule, &
479 max_nbr_center, nao, natom, nmo, &
481 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: mapping_atom_molecule
482 INTEGER,
ALLOCATABLE,
DIMENSION(:, :) :: mapping_wannier_atom
484 REAL(
dp) :: apt_basis_derivative, &
485 apt_coeff_derivative, charge, f_spin, &
486 smallest_r, this_factor, tmp_aptcontr, &
488 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: diagonal_elements
489 REAL(
dp),
DIMENSION(3) :: distance, r_shifted
490 REAL(
dp),
DIMENSION(:, :, :),
POINTER :: apt_el, apt_nuc
491 REAL(
dp),
DIMENSION(:, :, :, :),
POINTER :: apt_center, apt_subset
492 TYPE(cell_type),
POINTER :: cell
493 TYPE(cp_2d_r_p_type),
DIMENSION(:),
POINTER :: centers_set
494 TYPE(cp_fm_type),
POINTER :: mo_coeff, overlap1_mo, tmp_fm, &
495 tmp_fm_like_mos, tmp_fm_momo
496 TYPE(molecule_type),
DIMENSION(:),
POINTER :: molecule_set
497 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
498 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
500 CALL timeset(routinen, handle)
502 NULLIFY (qs_kind_set, particle_set, molecule_set, cell)
505 qs_kind_set=qs_kind_set, &
506 particle_set=particle_set, &
507 molecule_set=molecule_set, &
510 nsubset =
SIZE(molecule_set)
511 natom =
SIZE(particle_set)
512 apt_el => dcdr_env%apt_el_dcdr
513 apt_nuc => dcdr_env%apt_nuc_dcdr
514 apt_subset => dcdr_env%apt_el_dcdr_per_subset
515 apt_center => dcdr_env%apt_el_dcdr_per_center
518 IF (dcdr_env%nspins == 1)
THEN
519 max_nbr_center = dcdr_env%nbr_center(1)
521 max_nbr_center = max(dcdr_env%nbr_center(1), dcdr_env%nbr_center(2))
523 ALLOCATE (mapping_wannier_atom(max_nbr_center, dcdr_env%nspins))
524 ALLOCATE (mapping_atom_molecule(natom))
525 centers_set => dcdr_env%centers_set
527 DO ispin = 1, dcdr_env%nspins
528 DO icenter = 1, dcdr_env%nbr_center(ispin)
534 smallest_r = huge(0._dp)
536 distance =
pbc(r_shifted, particle_set(i)%r(1:3), cell)
537 tmp_r = sum(distance**2)
538 IF (tmp_r < smallest_r)
THEN
539 mapping_wannier_atom(icenter, ispin) = i
547 IF (dcdr_env%lambda == 1 .AND. dcdr_env%beta == 1)
THEN
548 DO icenter = 1, dcdr_env%nbr_center(ispin)
549 map_atom = mapping_wannier_atom(icenter, ispin)
550 map_molecule = mapping_atom_molecule(map_atom)
556 f_spin = 2._dp/dcdr_env%nspins
558 DO ispin = 1, dcdr_env%nspins
561 ALLOCATE (tmp_fm_like_mos)
562 ALLOCATE (overlap1_mo)
563 CALL cp_fm_create(tmp_fm_like_mos, dcdr_env%likemos_fm_struct(ispin)%struct)
564 CALL cp_fm_create(overlap1_mo, dcdr_env%momo_fm_struct(ispin)%struct)
565 nmo = dcdr_env%nmo(ispin)
566 mo_coeff => dcdr_env%mo_coeff(ispin)
570 tmp_fm_like_mos, ncol=nmo)
571 CALL parallel_gemm(
"T",
"N", nmo, nmo, nao, &
572 1.0_dp, mo_coeff, tmp_fm_like_mos, &
578 CALL parallel_gemm(
"N",
"N", nao, nmo, nmo, &
579 -0.5_dp, mo_coeff, overlap1_mo, &
580 -1.0_dp, dcdr_env%dCR_prime(ispin))
581 CALL cp_fm_release(overlap1_mo)
583 ALLOCATE (diagonal_elements(nmo))
587 ALLOCATE (tmp_fm_momo)
588 CALL cp_fm_create(tmp_fm, dcdr_env%likemos_fm_struct(ispin)%struct)
589 CALL cp_fm_create(tmp_fm_momo, dcdr_env%momo_fm_struct(ispin)%struct)
592 this_factor = -2._dp*f_spin
594 DO icenter = 1, dcdr_env%nbr_center(ispin)
595 CALL dbcsr_set(dcdr_env%moments(alpha)%matrix, 0.0_dp)
597 ref_point=centers_set(ispin)%array(1:3, icenter))
599 mo_coeff=dcdr_env%dCR_prime(ispin), work=tmp_fm, nmo=nmo, &
604 CALL parallel_gemm(
"T",
"N", nmo, nmo, nao, &
605 1.0_dp, mo_coeff, tmp_fm_like_mos, &
609 DO icenter = 1, dcdr_env%nbr_center(ispin)
610 map_atom = mapping_wannier_atom(icenter, ispin)
611 map_molecule = mapping_atom_molecule(map_atom)
612 tmp_aptcontr = this_factor*diagonal_elements(icenter)
614 apt_subset(dcdr_env%beta, alpha, dcdr_env%lambda, map_molecule) &
615 = apt_subset(dcdr_env%beta, alpha, dcdr_env%lambda, map_molecule) + tmp_aptcontr
617 apt_center(dcdr_env%beta, alpha, dcdr_env%lambda, icenter) &
618 = apt_center(dcdr_env%beta, alpha, dcdr_env%lambda, icenter) + tmp_aptcontr
621 apt_coeff_derivative = this_factor*sum(diagonal_elements)
622 apt_el(dcdr_env%beta, alpha, dcdr_env%lambda) &
623 = apt_el(dcdr_env%beta, alpha, dcdr_env%lambda) + apt_coeff_derivative
630 this_factor = -f_spin
632 DO icenter = 1, dcdr_env%nbr_center(ispin)
634 CALL dbcsr_set(dcdr_env%matrix_difdip(1, dcdr_env%beta)%matrix, 0._dp)
635 CALL dbcsr_set(dcdr_env%matrix_difdip(2, dcdr_env%beta)%matrix, 0._dp)
636 CALL dbcsr_set(dcdr_env%matrix_difdip(3, dcdr_env%beta)%matrix, 0._dp)
637 CALL dipole_deriv_ao(qs_env, dcdr_env%matrix_difdip, dcdr_env%delta_basis_function, &
638 1, centers_set(ispin)%array(1:3, icenter))
640 mo_coeff=mo_coeff, work=tmp_fm, nmo=nmo, &
645 CALL parallel_gemm(
"T",
"N", nmo, nmo, nao, &
646 1.0_dp, mo_coeff, tmp_fm_like_mos, &
650 DO icenter = 1, dcdr_env%nbr_center(ispin)
651 map_atom = mapping_wannier_atom(icenter, ispin)
652 map_molecule = mapping_atom_molecule(map_atom)
653 tmp_aptcontr = this_factor*diagonal_elements(icenter)
655 apt_subset(dcdr_env%beta, alpha, dcdr_env%lambda, map_molecule) &
656 = apt_subset(dcdr_env%beta, alpha, dcdr_env%lambda, map_molecule) + tmp_aptcontr
658 apt_center(dcdr_env%beta, alpha, dcdr_env%lambda, icenter) &
659 = apt_center(dcdr_env%beta, alpha, dcdr_env%lambda, icenter) + tmp_aptcontr
663 apt_basis_derivative = this_factor*sum(diagonal_elements)
665 apt_el(dcdr_env%beta, alpha, dcdr_env%lambda) &
666 = apt_el(dcdr_env%beta, alpha, dcdr_env%lambda) + apt_basis_derivative
669 DEALLOCATE (diagonal_elements)
671 CALL cp_fm_release(tmp_fm)
672 CALL cp_fm_release(tmp_fm_like_mos)
673 CALL cp_fm_release(tmp_fm_momo)
674 DEALLOCATE (overlap1_mo)
676 DEALLOCATE (tmp_fm_like_mos)
677 DEALLOCATE (tmp_fm_momo)
681 CALL get_atomic_kind(particle_set(dcdr_env%lambda)%atomic_kind, kind_number=ikind)
682 CALL get_qs_kind(qs_kind_set(ikind), core_charge=charge, ghost=ghost)
683 IF (.NOT. ghost)
THEN
684 apt_nuc(dcdr_env%beta, dcdr_env%beta, dcdr_env%lambda) = &
685 apt_nuc(dcdr_env%beta, dcdr_env%beta, dcdr_env%lambda) + charge
687 map_molecule = mapping_atom_molecule(dcdr_env%lambda)
688 apt_subset(dcdr_env%beta, dcdr_env%beta, dcdr_env%lambda, map_molecule) &
689 = apt_subset(dcdr_env%beta, dcdr_env%beta, dcdr_env%lambda, map_molecule) + charge
694 CALL timestop(handle)
subroutine pbc(r, r_pbc, s, s_pbc, a, b, c, alpha, beta, gamma, debug, info, pbc0, h, hinv)
...
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.
various utilities that regard array of different kinds: output, allocation,... maybe it is not a good...
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_scale_and_add(alpha, matrix_a, beta, matrix_b)
calc A <- alpha*A + beta*B optimized for alpha == 1.0 (just add beta*B) and beta == 0....
subroutine, public cp_fm_scale(alpha, matrix_a)
scales a matrix matrix_a = alpha * matrix_b
represent a full matrix distributed on many processors
subroutine, public cp_fm_get_diag(matrix, diag)
returns the diagonal elements of a fm
subroutine, public cp_fm_set_all(matrix, alpha, beta)
set all elements of a matrix to the same value, and optionally the diagonal to a different one
subroutine, public cp_fm_create(matrix, matrix_struct, name, use_sp)
creates a new full matrix with the given structure
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
Define the data structure for the molecule information.
subroutine, public molecule_of_atom(molecule_set, atom_to_mol)
finds for each atom the molecule it belongs to
basic linear algebra operations for full matrixes
Define the data structure for the particle information.
Calculate the derivatives of the MO coefficients wrt nuclear coordinates.
subroutine, public core_dr(qs_env, dcdr_env)
Core Hamiltonian contributions to the operator (the pseudopotentials)
subroutine, public apply_op_constant_term(qs_env, dcdr_env, overlap1)
Build the perturbed density matrix correction depending on the overlap derivative.
subroutine, public vhxc_r_perturbed_basis_functions(qs_env, dcdr_env)
The derivatives of the basis functions over which the HXC potential is integrated,...
subroutine, public hr_mult_by_delta_1d(matrix, qs_kind_set, basis_type, sab_nl, lambda, direction_Or)
Enforce that one of the basis functions in < a | O | b > is centered on atom lambda.
subroutine, public d_vhxc_dr(qs_env, dcdr_env)
The derivatives of the basis functions going into the HXC potential wrt nuclear positions.
subroutine, public d_core_charge_density_dr(qs_env, dcdr_env)
Calculate the derivative of the Hartree term due to the core charge density.
Calculate the derivatives of the MO coefficients wrt nuclear coordinates.
subroutine, public multiply_localization(ao_matrix, mo_coeff, work, nmo, icenter, res)
Multiply (ao_matrix @ mo_coeff) and store the column icenter in res.
subroutine, public dcdr_read_restart(qs_env, linres_section, vec, lambda, beta, tag)
Copied from linres_read_restart.
subroutine, public shift_wannier_into_cell(r, cell, r_shifted)
...
subroutine, public dcdr_write_restart(qs_env, linres_section, vec, lambda, beta, tag)
Copied from linres_write_restart.
Calculate the derivatives of the MO coefficients wrt nuclear coordinates.
subroutine, public prepare_per_atom(dcdr_env, qs_env)
Prepare the environment for a choice of lambda.
subroutine, public apt_dr_localization(qs_env, dcdr_env)
Calculate atomic polar tensor using the localized dipole operator.
subroutine, public apt_dr(qs_env, dcdr_env)
Calculate atomic polar tensor.
subroutine, public dcdr_response_dr(dcdr_env, p_env, qs_env)
Get the dC/dR by solving the Sternheimer equation, using the op_dR matrix.
subroutine, public dcdr_build_op_dr(dcdr_env, qs_env)
Build the operator for the position perturbation.
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.
localize wavefunctions linear response scf
subroutine, public linres_solver(p_env, qs_env, psi1, h1_psi0, psi0_order, iounit, should_stop)
scf loop to optimize the first order wavefunctions (psi1) given a perturbation as an operator applied...
Type definitiona for linear response calculations.
Definition and initialisation of the mo data type.
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.
Calculates the moment integrals <a|r^m|b> and <a|r x d/dr|b>
subroutine, public build_local_moment_matrix(qs_env, moments, nmoments, ref_point, ref_points, basis_type)
...
subroutine, public dipole_deriv_ao(qs_env, difdip, deltaR, order, rcc)
...
Define the neighbor list data types and the corresponding functionality.
basis types for the calculation of the perturbation of density theory.