@@ -56,6 +56,7 @@ __host__ __device__ void pbeOS_main(
56
56
// The limit 1e-18 is the one set in PBE's original paper, which
57
57
// works in double precision. For single precision, we take 1e-12
58
58
// so that rho^3 is still within precision.
59
+ // For Ec calculation, the limit is a bit lower (1e-10).
59
60
#if FULL_DOUBLE
60
61
const scalar_type MINIMUM_DENSITY_VALUE = (scalar_type) 1e-18 ;
61
62
#else
@@ -72,7 +73,7 @@ __host__ __device__ void pbeOS_main(
72
73
vxpbe_a = (scalar_type)0 .0f ;
73
74
vxpbe_b = (scalar_type)0 .0f ;
74
75
75
-
76
+
76
77
scalar_type twodens = (scalar_type)2 .0f * dens_a;
77
78
if (twodens > MINIMUM_DENSITY_VALUE) {
78
79
twodens2 = twodens * twodens;
@@ -117,7 +118,7 @@ __host__ __device__ void pbeOS_main(
117
118
// Construct total density and contribution to Ex
118
119
scalar_type rho = dens_a + dens_b;
119
120
expbe = (expbe_a * (dens_a / rho) + expbe_b * (dens_b/rho));
120
- if (rho < MINIMUM_DENSITY_VALUE) { return ; };
121
+ if (rho < ( MINIMUM_DENSITY_VALUE * (scalar_type) 1E5 ) ) { return ; };
121
122
122
123
/* -------------------------------------------------------------//
123
124
// PBE correlation
@@ -187,14 +188,16 @@ __host__ __device__ void pbeOS_main(
187
188
vcpbe_a = vc_a + dvc_a;
188
189
vcpbe_b = vc_b + dvc_b;
189
190
190
- // if (expbe_a != expbe_a) { printf("NaN in expbe_a \n");};
191
- // if (expbe_b != expbe_b) { printf("NaN in expbe_b \n");};
192
- // if (ec != ec) { printf("NaN in ec \n");};
193
- // if (h != h) { printf("NaN in h \n");};
194
- // if (vc_a != vc_a) { printf("NaN in vc_a \n");};
195
- // if (dvc_a != dvc_a) { printf("NaN in dvc_a \n");};
196
- // if (vc_b != vc_b) { printf("NaN in vc_b \n");};
197
- // if (dvc_b!= dvc_b) { printf("NaN in dvc_b \n");};
191
+ #ifdef _DEBUG
192
+ if (expbe_a != expbe_a) { printf (" NaN in expbe_a \n " );};
193
+ if (expbe_b != expbe_b) { printf (" NaN in expbe_b \n " );};
194
+ if (ec != ec) { printf (" NaN in ec \n " );};
195
+ if (h != h) { printf (" NaN in h \n " );};
196
+ if (vc_a != vc_a) { printf (" NaN in vc_a \n " );};
197
+ if (dvc_a != dvc_a) { printf (" NaN in dvc_a \n " );};
198
+ if (vc_b != vc_b) { printf (" NaN in vc_b \n " );};
199
+ if (dvc_b!= dvc_b) { printf (" NaN in dvc_b \n " );};
200
+ #endif
198
201
} // pbeOS_main
199
202
200
203
#undef EASYPBE_PI
0 commit comments