From cabeb0889e20a504a8056217195d4a4b488ca47b Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Sat, 31 Mar 2018 22:31:26 +0200
Subject: [PATCH] Handle the case when atoms are on top of each other

Do the same as NACCESS: assign 0.0
---
 modules/mol/alg/src/accessibility.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/mol/alg/src/accessibility.cc b/modules/mol/alg/src/accessibility.cc
index a1becdd7f..276b53ba2 100644
--- a/modules/mol/alg/src/accessibility.cc
+++ b/modules/mol/alg/src/accessibility.cc
@@ -203,6 +203,11 @@ Real GetAtomAccessibilityNACCESS(Real x_pos, Real y_pos, Real z_pos,
     Real a = x_pos - x[i];
     Real b = y_pos - y[i];  
     Real c = a*a + b*b;
+
+    if(c == Real(0.0)) {
+      return 0.0;
+    }
+
     dx[i] = a;
     dy[i] = b;
     dsqr[i] = c;
-- 
GitLab