It seems that the following code could lead to an overflow (1/0) if the grid points coincide with the atoms.
void compute_grid_nucpot(double* coordinates, double* charges, long natom,
double* points, double* output, long npoint) {
for (long ipoint=npoint-1; ipoint >= 0; ipoint--) {
double tmp = 0.0;
for (long iatom=natom-1; iatom >= 0; iatom--) {
double delta = points[0]-coordinates[3*iatom];
double dsq = delta*delta;
delta = points[1]-coordinates[3*iatom+1];
dsq += delta*delta;
delta = points[2]-coordinates[3*iatom+2];
dsq += delta*delta;
tmp += charges[iatom]/sqrt(dsq);
}
*output += tmp;
points += 3;
output++;
}
}
It seems that the following code could lead to an overflow (1/0) if the grid points coincide with the atoms.