From a6dfab6f27573e82a9fc89dbd2899f91f9f770e6 Mon Sep 17 00:00:00 2001
From: Axel Kohlmeyer <akohlmey@gmail.com>
Date: Tue, 4 Sep 2018 09:13:22 -0400
Subject: [PATCH] recover some const'ness in Domain class, that was lost when
 merging MESSAGE package. fixes lib/atc compilation issue

---
 src/domain.cpp | 10 +++++-----
 src/domain.h   |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/domain.cpp b/src/domain.cpp
index 4e9b414050..8238ab7eea 100644
--- a/src/domain.cpp
+++ b/src/domain.cpp
@@ -1176,12 +1176,12 @@ int Domain::closest_image(int i, int j)
    if J is not a valid index like -1, just return it
 ------------------------------------------------------------------------- */
 
-int Domain::closest_image(double *pos, int j)
+int Domain::closest_image(const double * const pos, int j)
 {
   if (j < 0) return j;
 
-  int *sametag = atom->sametag;
-  double **x = atom->x;
+  const int * const sametag = atom->sametag;
+  const double * const * const x = atom->x;
 
   int closest = j;
   double delx = pos[0] - x[j][0];
@@ -1208,10 +1208,10 @@ int Domain::closest_image(double *pos, int j)
 /* ----------------------------------------------------------------------
    find and return Xj image = periodic image of Xj that is closest to Xi
    for triclinic, add/subtract tilt factors in other dims as needed
-   called by ServerMD class
+   called by ServerMD class and LammpsInterface in lib/atc.
 ------------------------------------------------------------------------- */
 
-void Domain::closest_image(double *xi, double *xj, double *xjimage)
+void Domain::closest_image(const double * const xi, const double * const xj, double * const xjimage)
 {
   double dx = xj[0] - xi[0];
   double dy = xj[1] - xi[1];
diff --git a/src/domain.h b/src/domain.h
index ed24116cf4..9ebdd6ae94 100644
--- a/src/domain.h
+++ b/src/domain.h
@@ -115,8 +115,8 @@ class Domain : protected Pointers {
   void minimum_image(double *);
   void minimum_image_once(double *);
   int closest_image(int, int);
-  int closest_image(double *, int);
-  void closest_image(double *, double *, double *);
+  int closest_image(const double * const, int);
+  void closest_image(const double * const, const double * const, double * const);
   void remap(double *, imageint &);
   void remap(double *);
   void remap_near(double *, double *);
-- 
GitLab