Skip to content

Commit c896953

Browse files
committed
Gauss' theorem check on relative difference
1 parent 9b97343 commit c896953

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/interface/Meddle.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -550,14 +550,17 @@ void Meddle::GaussCheck() const {
550550
double gauss_nuclear_asc = GaussEstimate(input_.molecule().charges(),
551551
input_.outsideStaticGreenParams().epsilon,
552552
input_.correction());
553-
double difference = total_nuclear_asc - gauss_nuclear_asc;
553+
double abs_rel_diff =
554+
std::abs((total_nuclear_asc - gauss_nuclear_asc) / gauss_nuclear_asc);
554555
std::stringstream tmp;
555-
if (!utils::isZero(difference, 1.0e-2)) {
556+
if (!utils::isZero(abs_rel_diff, 1.0e-2)) {
556557
std::ostringstream errmsg;
557-
errmsg << "The Gauss' theorem (" << gauss_nuclear_asc << ") ";
558+
errmsg
559+
<< "Absolute value of the relative difference between the Gauss' theorem ("
560+
<< gauss_nuclear_asc << ") ";
558561
errmsg << "and computed (" << total_nuclear_asc << ") values ";
559-
errmsg << "of the total nuclear ASC differ significantly (" << difference << ")."
560-
<< std::endl;
562+
errmsg << "of the total nuclear ASC higher than threshold (" << abs_rel_diff
563+
<< ")." << std::endl;
561564
errmsg << "Consider changing the average area of the cavity finite elements."
562565
<< std::endl;
563566
errmsg

0 commit comments

Comments
 (0)