From c29b236d4472690f8215ddf7c7e5a63485029601 Mon Sep 17 00:00:00 2001
From: graham <g.macpherson@opencfd.co.uk>
Date: Mon, 18 May 2009 11:49:32 +0100
Subject: [PATCH] Bug fixes from:

http://www.cfd-online.com/Forums/openfoam-bugs/64379-bugs-moleculedynamics-
model.html

http://www.cfd-online.com/Forums/openfoam-bugs/64383-fix-taking-reference-
temporary-object-tetherpotentiallist-c.html
---
 .../directInteractionList/directInteractionList.C             | 4 ++--
 .../pairPotential/pairPotentialList/pairPotentialList.C       | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/lagrangian/molecularDynamics/molecule/interactionLists/directInteractionList/directInteractionList.C b/src/lagrangian/molecularDynamics/molecule/interactionLists/directInteractionList/directInteractionList.C
index ba3a3d90669..a28d5300150 100644
--- a/src/lagrangian/molecularDynamics/molecule/interactionLists/directInteractionList/directInteractionList.C
+++ b/src/lagrangian/molecularDynamics/molecule/interactionLists/directInteractionList/directInteractionList.C
@@ -119,8 +119,6 @@ void Foam::directInteractionList::buildDirectInteractionList
 
                     const label cellO(mesh.faceOwner()[f]);
 
-                    const label cellN(mesh.faceNeighbour()[f]);
-
                     forAll(pCells, pC)
                     {
                         const label cellI(pCells[pC]);
@@ -156,6 +154,8 @@ void Foam::directInteractionList::buildDirectInteractionList
                             // boundary faces will not have neighbour
                             // information
 
+                            const label cellN(mesh.faceNeighbour()[f]);
+
                             if (cellN > cellI)
                             {
                                 if
diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialList.C b/src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialList.C
index c9ff27fe1db..8720368a5dd 100644
--- a/src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialList.C
+++ b/src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialList.C
@@ -225,7 +225,7 @@ const Foam::pairPotential& Foam::pairPotentialList::pairPotentialFunction
 
 bool Foam::pairPotentialList::rCutMaxSqr(const scalar rIJMagSqr) const
 {
-    if (rIJMagSqr <= rCutMaxSqr_)
+    if (rIJMagSqr < rCutMaxSqr_)
     {
         return true;
     }
@@ -243,7 +243,7 @@ bool Foam::pairPotentialList::rCutSqr
     const scalar rIJMagSqr
 ) const
 {
-    if (rIJMagSqr <= rCutSqr (a, b))
+    if (rIJMagSqr < rCutSqr (a, b))
     {
         return true;
     }
-- 
GitLab