beef_acc - first step

This commit is contained in:
fabrizio22 2021-10-22 13:44:53 +02:00
parent b7b5e4ad65
commit 99ae590e4d
3 changed files with 21 additions and 6 deletions

View File

@ -10,6 +10,7 @@
#include "pbecor.h"
// evaluate bee exchange energy and its derivatives de/drho and ( de/d|grad rho| ) / |grad rho|
#pragma acc routine seq
void beefx_(double *r, double *g, double *e, double *dr, double *dg, int *addlda)
{
double s2,t,r43,r83,s,sx,dx,fx,dl,dfx;
@ -17,7 +18,11 @@ void beefx_(double *r, double *g, double *e, double *dr, double *dg, int *addlda
const int i1=1;
const int i2=1;
switch(beeftype) {
*e=6.;
*dr=7.;
*dg=8.;
/* switch(beeftype) {
case 0: //BEEF-vdW xc
r43 = pow(*r, 4./3.);
r83 = r43*r43;
@ -62,7 +67,7 @@ void beefx_(double *r, double *g, double *e, double *dr, double *dg, int *addlda
}
break;
}
} */
}

View File

@ -1106,6 +1106,8 @@ SUBROUTINE gcxc_beef( length, rho_in, grho_in, sx_out, sc_out, v1x_out, &
!---------------------------------------------------------------------
!! Driver for BEEF gga xc terms. Unpolarized case.
!
! ****note: to compile add -ta=tesla::cc60 to both f90 and cc flags
USE beef_interface, ONLY: beefx, beeflocalcorr
!
IMPLICIT NONE
@ -1126,6 +1128,10 @@ SUBROUTINE gcxc_beef( length, rho_in, grho_in, sx_out, sc_out, v1x_out, &
!
IF (igcx == 43 .OR. igcc == 14) THEN
!
#if defined(_OPENACC)
!$acc data copyin(rho_in,grho_in), copyout(sx_out,sc_out,v1x_out,v2x_out,v1c_out,v2c_out)
!$acc parallel loop
#endif
DO ir = 1, length
grho = grho_in(ir)
IF ( rho_in(ir) <= rho_threshold_gga .OR. grho <= grho_threshold_gga ) THEN
@ -1149,12 +1155,15 @@ SUBROUTINE gcxc_beef( length, rho_in, grho_in, sx_out, sc_out, v1x_out, &
IF ( igcc == 14 ) THEN
! last parameter 0 means: do not add lda contributions
! espresso will do that itself
CALL beeflocalcorr( rho, grho, sc, v1c, v2c, 0 )
sc_out(ir) = sc
v1c_out(ir) = v1c
v2c_out(ir) = v2c
! CALL beeflocalcorr( rho, grho, sc, v1c, v2c, 0 )
! sc_out(ir) = sc
! v1c_out(ir) = v1c
! v2c_out(ir) = v2c
ENDIF
ENDDO
#if defined(_OPENACC)
!$acc end data
#endif
!
ENDIF
!

View File

@ -22,6 +22,7 @@ MODULE beef_interface
INTERFACE
!
SUBROUTINE beefx( r, g, e, dr, dg, addlda ) BIND(C, NAME="beefx_")
!$acc routine seq
USE iso_c_binding
REAL (C_DOUBLE) :: r, g, e, dr, dg
INTEGER(C_INT), INTENT(IN) :: addlda