From fec87c070dd8bc143e5752012be409893a9cbd7f Mon Sep 17 00:00:00 2001
From: Axel Kohlmeyer <akohlmey@gmail.com>
Date: Wed, 9 Nov 2016 16:53:39 -0500
Subject: [PATCH] simplify compiling USER-INTEL package, by defaulting to
 -DLAMMPS_MEMALIGN=64 in case it is not set

---
 src/USER-INTEL/intel_preprocess.h | 10 ++++------
 src/memory.cpp                    |  4 ++++
 src/my_page.h                     |  4 ++++
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/USER-INTEL/intel_preprocess.h b/src/USER-INTEL/intel_preprocess.h
index 6657bd31eb..48378d3840 100644
--- a/src/USER-INTEL/intel_preprocess.h
+++ b/src/USER-INTEL/intel_preprocess.h
@@ -28,12 +28,10 @@
 #ifndef LMP_INTEL_PREPROCESS_H
 #define LMP_INTEL_PREPROCESS_H
 
-#ifndef LAMMPS_MEMALIGN
-#error Please set -DLAMMPS_MEMALIGN=64 in CCFLAGS for your LAMMPS makefile.
-#else
-#if (LAMMPS_MEMALIGN != 64)
-#error Please set -DLAMMPS_MEMALIGN=64 in CCFLAGS for your LAMMPS makefile.
-#endif
+// LAMMPS_MEMALIGN is set to 64 by default for -DLMP_USER_INTEL
+// so we only need to error out in case of a different alignment
+#if LAMMPS_MEMALIGN && (LAMMPS_MEMALIGN != 64)
+#error Please set -DLAMMPS_MEMALIGN=64 in CCFLAGS of your LAMMPS makefile for USER-INTEL package
 #endif
 
 #if defined(_OPENMP)
diff --git a/src/memory.cpp b/src/memory.cpp
index d7c3e1d535..1ab5074079 100644
--- a/src/memory.cpp
+++ b/src/memory.cpp
@@ -22,6 +22,10 @@
 #include "tbb/scalable_allocator.h"
 #endif
 
+#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN)
+#define LAMMPS_MEMALIGN 64
+#endif
+
 using namespace LAMMPS_NS;
 
 /* ---------------------------------------------------------------------- */
diff --git a/src/my_page.h b/src/my_page.h
index 9df08dc31c..a6b69db1b5 100644
--- a/src/my_page.h
+++ b/src/my_page.h
@@ -48,6 +48,10 @@ methods:
 #ifndef LAMMPS_MY_PAGE_H
 #define LAMMPS_MY_PAGE_H
 
+#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN)
+#define LAMMPS_MEMALIGN 64
+#endif
+
 #include <stdlib.h>
 namespace LAMMPS_NS {
 
-- 
GitLab