0% found this document useful (0 votes)
19 views1 page

Reci

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views1 page

Reci

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include "libinclude.

h"
#include "const.h"
#include "fundec.h"

#define ENABLE_OMP 1

double reci0(double **PosIons, float *charge_prod, int natoms, double betaa, float
**box){
double energy = 0;
double
Length[3]={sqrt(dotProduct(box[0],box[0],3)),sqrt(dotProduct(box[1],box[1],3)),sqrt
(dotProduct(box[2],box[2],3))};

#if defined ENABLE_OMP


omp_set_num_threads(thread::hardware_concurrency());
#pragma omp parallel for schedule(runtime) reduction(+: energy)
#endif

for (int i = 1; i < natoms; i++){


for (int j = 0; j < i; j++){
energy+=charge_prod[i*(i-1)/2+j]*F_0((PosIons[i][2]-PosIons[j]
[2])*betaa);
}
}

return 2*sqrt(M_PI)*energy/(betaa*Length[0]*Length[1]);;
}

You might also like