From 7df761564a1ce134bc104bd38a009013878c64a4 Mon Sep 17 00:00:00 2001
From: Cody Melton <cmelton@sandia.gov>
Date: Mon, 2 Mar 2020 10:58:33 -0700
Subject: [PATCH] Qmcpack: new variant +afqmc (#14882)

* add preliminary afqmc support in qmcpack

* afqmc updates

* fix spack typos

* edit AFQMC to only allow up 3.7 or above

* added NCCL library support for AFQMC build

* add CMAKE args for BUILD_AFQMC_WITH_NCCL

* update for just AFQMC support. No AFQMC+GPU support

* remove nccl for afqmc

* flake8 whitespace fix
---
 var/spack/repos/builtin/packages/qmcpack/package.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/var/spack/repos/builtin/packages/qmcpack/package.py b/var/spack/repos/builtin/packages/qmcpack/package.py
index 0ad9ac2418..64a0e2c283 100644
--- a/var/spack/repos/builtin/packages/qmcpack/package.py
+++ b/var/spack/repos/builtin/packages/qmcpack/package.py
@@ -57,6 +57,8 @@ class Qmcpack(CMakePackage, CudaPackage):
             description='Install with Matplotlib (long installation time)')
     variant('qe', default=False,
             description='Install with patched Quantum Espresso 6.4.1')
+    variant('afqmc', default=False,
+            description='Install with AFQMC support')
 
     # cuda variant implies mixed precision variant by default, but there is
     # no way to express this in variant syntax, need something like
@@ -94,6 +96,12 @@ class Qmcpack(CMakePackage, CudaPackage):
     conflicts('%pgi@:17', when='@3.6.0:', msg=compiler_warning)
     conflicts('%llvm@:3.4', when='@3.6.0:', msg=compiler_warning)
 
+    conflicts('+afqmc', when='@:3.6.0', msg='AFQMC not recommended before v3.7')
+    conflicts('+afqmc', when='~mpi', msg='AFQMC requires building with +mpi')
+    conflicts('+afqmc', when='%gcc@:6.0', msg='AFQMC code requires gcc@6.1 or greater')
+    conflicts('+afqmc', when='%clang@:4.0', msg='AFQMC code requires clang 4.1 or greater')
+    conflicts('+afqmc', when='%intel@:18', msg='AFQMC code requires intel19 or greater')
+
     # Prior to QMCPACK 3.5.0 Intel MKL was not properly detected with
     # non-Intel compilers without a Spack-based hack. This hack
     # had the potential for negative side effects and led to more
@@ -231,6 +239,11 @@ def cmake_args(self):
         else:
             args.append('-DQMC_COMPLEX=0')
 
+        if '+afqmc' in spec:
+            args.append('-DBUILD_AFQMC=1')
+        else:
+            args.append('-DBUILD_AFQMC=0')
+
         # When '-DQMC_CUDA=1', CMake automatically sets:
         # '-DQMC_MIXED_PRECISION=1'
         #
-- 
GitLab