9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-30 15:15:38 +01:00

Fixed pseudo-inverse (extrapolations)

This commit is contained in:
Anthony Scemama 2024-02-12 18:18:53 +01:00
parent 419ed79c49
commit 1b9a75f488
4 changed files with 34 additions and 24 deletions

View File

@ -21,3 +21,10 @@ type: logical
doc: If true and N_states > 1, the oscillator strength will be computed
interface: ezfio,provider,ocaml
default: false
[calc_energy_components]
type: logical
doc: If true, the components of the energy (1e, 2e, kinetic) will be computed
interface: ezfio,provider,ocaml
default: false

View File

@ -6,6 +6,11 @@ subroutine print_mol_properties()
! Run the propertie calculations
END_DOC
! Energy components
if (calc_energy_components) then
call print_energy_components
endif
! Electric dipole moment
if (calc_dipole_moment) then
call print_dipole_moment
@ -18,7 +23,7 @@ subroutine print_mol_properties()
! Oscillator strength
if (calc_osc_str .and. N_states > 1) then
call print_oscillator_strength
call print_oscillator_strength
endif
end

View File

@ -1377,31 +1377,29 @@ subroutine get_pseudo_inverse(A, LDA, m, n, C, LDC, cutoff)
enddo
endif
print*, ' n_svd = ', n_svd
!$OMP PARALLEL &
!$OMP DEFAULT (NONE) &
!$OMP PRIVATE (i, j) &
!$OMP SHARED (n, n_svd, D, Vt)
!$OMP DO
do j = 1, n
do i = 1, n_svd
Vt(i,j) = D(i) * Vt(i,j)
enddo
enddo
!$OMP END DO
!$OMP END PARALLEL
call dgemm("N", "N", m, n, n_svd, 1.d0, U, m, Vt, n, 0.d0, C, LDC)
! C = 0.d0
! do i=1,m
! do j=1,n
! do k=1,n
! C(j,i) = C(j,i) + U(i,k) * D(k) * Vt(k,j)
! enddo
! !$OMP PARALLEL &
! !$OMP DEFAULT (NONE) &
! !$OMP PRIVATE (i, j) &
! !$OMP SHARED (n, n_svd, D, Vt)
! !$OMP DO
! do j = 1, n
! do i = 1, n_svd
! Vt(i,j) = D(i) * Vt(i,j)
! enddo
! enddo
! !$OMP END DO
! !$OMP END PARALLEL
! call dgemm('N', 'N', n, m, n_svd, 1.d0, Vt, size(Vt,1), U, size(U,1), 0.d0, C, size(C,1))
C = 0.d0
do i=1,m
do j=1,n
do k=1,n_svd
C(j,i) = C(j,i) + U(i,k) * D(k) * Vt(k,j)
enddo
enddo
enddo
deallocate(U,D,Vt,work,A_tmp)