Skip to content

Commit

Permalink
Fixed pseudo-inverse (extrapolations)
Browse files Browse the repository at this point in the history
  • Loading branch information
scemama committed Feb 12, 2024
1 parent 419ed79 commit 1b9a75f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 23 deletions.
7 changes: 7 additions & 0 deletions src/mol_properties/EZFIO.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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

File renamed without changes.
7 changes: 6 additions & 1 deletion src/mol_properties/print_mol_properties.irp.f
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
42 changes: 20 additions & 22 deletions src/utils/linear_algebra.irp.f
Original file line number Diff line number Diff line change
Expand Up @@ -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

!$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)
! 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
!$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
! enddo
! enddo

deallocate(U,D,Vt,work,A_tmp)

Expand Down

0 comments on commit 1b9a75f

Please sign in to comment.