From ec58f28c209d1ffef51424b5d1423aa219c143a4 Mon Sep 17 00:00:00 2001
From: "Nichols A. Romero" <naromero77@users.noreply.github.com>
Date: Wed, 24 Jun 2020 09:30:00 -0500
Subject: [PATCH] quantum-espresso: fix for scalapack with openmpi (#17179)

---
 .../repos/builtin/packages/quantum-espresso/package.py    | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/var/spack/repos/builtin/packages/quantum-espresso/package.py b/var/spack/repos/builtin/packages/quantum-espresso/package.py
index 35454ae3ef..2fe01f864f 100644
--- a/var/spack/repos/builtin/packages/quantum-espresso/package.py
+++ b/var/spack/repos/builtin/packages/quantum-espresso/package.py
@@ -307,7 +307,13 @@ def install(self, spec, prefix):
             options.append('BLAS_LIBS={0}'.format(lapack_blas.ld_flags))
 
         if '+scalapack' in spec:
-            scalapack_option = 'intel' if '^mkl' in spec else 'yes'
+            if '^mkl' in spec:
+                if '^openmpi' in spec:
+                    scalapack_option = 'yes'
+                else:  # mpich, intel-mpi
+                    scalapack_option = 'intel'
+            else:
+                scalapack_option = 'yes'
             options.append('--with-scalapack={0}'.format(scalapack_option))
 
         if '+elpa' in spec:
-- 
GitLab