Commit f461c7df authored by ccavazzoni's avatar ccavazzoni

- one more helper function


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@13743 c92efa57-630b-4861-b058-cf58834340f0
parent 03e9fa09
......@@ -150,5 +150,33 @@ CONTAINS
val = desc%nnr
END SUBROUTINE
SUBROUTINE fftx_add_field( r, f, desc )
USE fft_param
USE fft_types, ONLY : fft_type_descriptor
TYPE(fft_type_descriptor), INTENT(in) :: desc
REAL(DP), INTENT(INOUT) :: r(:,:)
REAL(DP), INTENT(IN) :: f(:)
INTEGER :: nspin, ir
nspin = SIZE( r, 2 )
IF (nspin.EQ.1) THEN
!$omp parallel do
DO ir=1,desc%nr1*desc%nr2*desc%my_nr3p
r(ir,1)=r(ir,1)+f(ir)
END DO
!$omp end parallel do
ELSE IF (nspin.EQ.2) THEN
!$omp parallel do
DO ir=1,desc%nr1*desc%nr2*desc%my_nr3p
r(ir,1)=r(ir,1)+f(ir)
END DO
!$omp end parallel do
!$omp parallel do
DO ir=1,desc%nr1*desc%nr2*desc%my_nr3p
r(ir,2)=r(ir,2)+f(ir)
END DO
!$omp end parallel do
END IF
END SUBROUTINE
END MODULE fft_helper_subroutines
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment