From 0c8d955468e508ba91a32d1cee482252fb6bef24 Mon Sep 17 00:00:00 2001
From: Paolo Giannozzi
Date: Fri, 8 Jul 2022 20:49:48 +0200
Subject: [PATCH] FoX no longer the default (not sure how to do that in cmake)
---
CPV/src/cp_restart_new.f90 | 10 +++++-----
Doc/user_guide.tex | 2 +-
Modules/fox_init_module.f90 | 4 ++--
Modules/qes_read_module.f90 | 8 ++++----
Modules/qes_write_module.f90 | 8 ++++----
Modules/qexsd.f90 | 16 ++++++++--------
Modules/read_mol.f90 | 6 +++---
Modules/xml_io_rism.f90 | 8 ++++----
PP/src/globalmod.f90 | 6 +++---
PP/src/vasp_xml_module.f90 | 6 +++---
include/defs.h.README | 1 +
install/configure | 16 ++++++++++------
install/m4/x_ac_qe_fox.m4 | 33 +++++++++++++++++++++++++++++++++
install/make.inc.in | 4 ++--
14 files changed, 83 insertions(+), 45 deletions(-)
create mode 100644 install/m4/x_ac_qe_fox.m4
diff --git a/CPV/src/cp_restart_new.f90 b/CPV/src/cp_restart_new.f90
index 91e6815b4..0188c59f9 100644
--- a/CPV/src/cp_restart_new.f90
+++ b/CPV/src/cp_restart_new.f90
@@ -28,14 +28,14 @@ MODULE cp_restart_new
USE io_global, ONLY : ionode, ionode_id, stdout
USE mp, ONLY : mp_bcast
USE matrix_inversion
-#if defined (__outfoxed)
- USE wxml
- USE dom, ONLY : Node, parseFile, item, getElementsByTagname, &
+#if defined (__fox)
+ USE FoX_wxml
+ USE FoX_dom, ONLY : Node, parseFile, item, getElementsByTagname, &
hasAttribute, extractDataAttribute, &
extractDataContent, destroy
#else
- USE FoX_wxml
- USE FoX_dom, ONLY : Node, parseFile, item, getElementsByTagname, &
+ USE wxml
+ USE dom, ONLY : Node, parseFile, item, getElementsByTagname, &
hasAttribute, extractDataAttribute, &
extractDataContent, destroy
#endif
diff --git a/Doc/user_guide.tex b/Doc/user_guide.tex
index b0ccc760e..1b09c9caa 100644
--- a/Doc/user_guide.tex
+++ b/Doc/user_guide.tex
@@ -606,7 +606,7 @@ is between bracket:\\
\\
and the following optional packages:\\
\begin{tabular}{ll}
-\texttt{--with-fox} & Use official FoX library instead of built-in replacement (default:yes)\\
+\texttt{--with-fox} & Use official FoX library instead of built-in replacement (default:no)\\
\texttt{--with-scalapack}& (yes$|$no$|$intel) Use scalapack if available. \\
&Set to \texttt{intel} to use Intel MPI and BLACS (default: use OpenMPI)\\
\texttt{--with-elpa-include}& Specify full path of ELPA include and modules
diff --git a/Modules/fox_init_module.f90 b/Modules/fox_init_module.f90
index 59ee502ae..defecdad5 100644
--- a/Modules/fox_init_module.f90
+++ b/Modules/fox_init_module.f90
@@ -1,5 +1,5 @@
MODULE fox_init_module
-#if ! defined(__outfoxed)
+#if defined(__fox)
USE mp, ONLY: mp_bcast, mp_barrier
USE io_global, ONLY: ionode, ionode_id
USE mp_images, ONLY: intra_image_comm
@@ -12,7 +12,7 @@ PUBLIC :: fox_init
CONTAINS
SUBROUTINE fox_init()
INTEGER :: errcodes(3)
-#if ! defined(__outfoxed)
+#if defined(__fox)
IF (ionode) THEN
call setup_io()
errcodes(1) = io_err
diff --git a/Modules/qes_read_module.f90 b/Modules/qes_read_module.f90
index 349ceee14..f5b87029d 100644
--- a/Modules/qes_read_module.f90
+++ b/Modules/qes_read_module.f90
@@ -12,10 +12,10 @@ MODULE qes_read_module
!
! Quantum Espresso XSD namespace: http://www.quantum-espresso.org/ns/qes/qes-1.0
!
-#if defined (__outfoxed)
- USE dom
-#else
+#if defined (__fox)
USE FoX_dom
+#else
+ USE dom
#endif
USE qes_types_module
!
@@ -14931,4 +14931,4 @@ MODULE qes_read_module
END SUBROUTINE qes_read_rismlaue
!
!
-END MODULE qes_read_module
\ No newline at end of file
+END MODULE qes_read_module
diff --git a/Modules/qes_write_module.f90 b/Modules/qes_write_module.f90
index 17558e62a..0f770c6fa 100644
--- a/Modules/qes_write_module.f90
+++ b/Modules/qes_write_module.f90
@@ -11,10 +11,10 @@ MODULE qes_write_module
!
! Quantum Espresso XSD namespace: http://www.quantum-espresso.org/ns/qes/qes-1.0
!
-#if defined (__outfoxed)
- USE wxml
-#else
+#if defined (__fox)
USE FoX_wxml
+#else
+ USE wxml
#endif
USE qes_types_module
!
@@ -3542,4 +3542,4 @@ MODULE qes_write_module
END SUBROUTINE qes_write_rismlaue
!
-END MODULE qes_write_module
\ No newline at end of file
+END MODULE qes_write_module
diff --git a/Modules/qexsd.f90 b/Modules/qexsd.f90
index bd4b4571b..36205e8f7 100644
--- a/Modules/qexsd.f90
+++ b/Modules/qexsd.f90
@@ -30,18 +30,18 @@ MODULE qexsd_module
USE qes_reset_module, ONLY : qes_reset
USE qes_init_module, ONLY : qes_init
!
-#if defined (__outfoxed)
- USE wxml, ONLY : xmlf_t, xml_OpenFile, xml_DeclareNamespace, &
- xml_NewElement, xml_addAttribute, xml_addComment,&
- xml_AddCharacters, xml_EndElement, xml_Close
- USE dom, ONLY : parseFile, item, getElementsByTagname, &
- destroy, nodeList, Node
-#else
+#if defined (__fox)
USE FoX_wxml, ONLY : xmlf_t, xml_OpenFile, xml_DeclareNamespace, &
xml_NewElement, xml_addAttribute, xml_addComment,&
xml_AddCharacters, xml_EndElement, xml_Close
USE FoX_dom, ONLY : parseFile, item, getElementsByTagname, &
destroy, nodeList, Node
+#else
+ USE wxml, ONLY : xmlf_t, xml_OpenFile, xml_DeclareNamespace, &
+ xml_NewElement, xml_addAttribute, xml_addComment,&
+ xml_AddCharacters, xml_EndElement, xml_Close
+ USE dom, ONLY : parseFile, item, getElementsByTagname, &
+ destroy, nodeList, Node
#endif
!
IMPLICIT NONE
@@ -149,7 +149,7 @@ CONTAINS
CALL qes_reset (parallel_info)
IF ( check_file_exst(input_xml_schema_file) ) THEN
CALL xml_addComment( XF = qexsd_xf, COMMENT= "")
-#if ! defined(__outfoxed)
+#if defined(__fox)
CALL qexsd_cp_line_by_line(ounit ,input_xml_schema_file, spec_tag="input")
#else
CALL qexsd_cp_line_by_line(qexsd_xf%unit,input_xml_schema_file, spec_tag="input")
diff --git a/Modules/read_mol.f90 b/Modules/read_mol.f90
index 5e46c1f2b..04d524c5e 100644
--- a/Modules/read_mol.f90
+++ b/Modules/read_mol.f90
@@ -17,10 +17,10 @@ MODULE read_mol_module
USE molecule_const, ONLY : RY_TO_KJMOLm1, RY_TO_KCALMOLm1, BOHRm3_TO_MOLCMm3, BOHRm3_TO_MOLLm1
USE molecule_types, ONLY : molecule, deallocate_molecule
USE upf_utils, ONLY : version_compare
-#if defined(__outfoxed)
- USE dom
-#else
+#if defined(__fox)
USE FoX_dom
+#else
+ USE dom
#endif
!
IMPLICIT NONE
diff --git a/Modules/xml_io_rism.f90 b/Modules/xml_io_rism.f90
index a40385b15..c6240f968 100644
--- a/Modules/xml_io_rism.f90
+++ b/Modules/xml_io_rism.f90
@@ -13,12 +13,12 @@ MODULE xml_io_rism
! ... this module contains subroutines used to read and write
! ... 1D- and 3D-RISM data in XML format
!
-#if defined(__outfoxed)
- USE dom
- USE wxml
-#else
+#if defined(__fox)
USE FoX_dom
USE FoX_wxml
+#else
+ USE dom
+ USE wxml
#endif
USE constants, ONLY : eps8
USE fft_types, ONLY : fft_type_descriptor
diff --git a/PP/src/globalmod.f90 b/PP/src/globalmod.f90
index 223051475..6277edd68 100644
--- a/PP/src/globalmod.f90
+++ b/PP/src/globalmod.f90
@@ -44,11 +44,11 @@ subroutine read_xml_input ()
!
use qes_read_module, ONLY : qes_read
use qes_types_module, ONLY : band_structure_type, atomic_structure_type, symmetries_type, basis_set_type
-#if defined (__outfoxed)
- USE dom, ONLY : parseFile, node, item, getElementsByTagname, &
+#if defined (__fox)
+ USE FoX_dom, ONLY : parseFile, node, item, getElementsByTagname, &
destroy
#else
- USE FoX_dom, ONLY : parseFile, node, item, getElementsByTagname, &
+ USE dom, ONLY : parseFile, node, item, getElementsByTagname, &
destroy
#endif
use input_parameters, ONLY : nkstot
diff --git a/PP/src/vasp_xml_module.f90 b/PP/src/vasp_xml_module.f90
index c644a1202..0acdbd9ba 100644
--- a/PP/src/vasp_xml_module.f90
+++ b/PP/src/vasp_xml_module.f90
@@ -19,12 +19,12 @@ MODULE vasp_xml
! vasp_readschema_* read variables into internal varables
!
USE kinds, ONLY : DP
-#if defined (__outfoxed)
- USE dom, ONLY : parseFile, item, getElementsByTagname, destroy, &
+#if defined (__fox)
+ USE FoX_dom, ONLY : parseFile, item, getElementsByTagname, destroy, &
nodeList, Node, getLength, getTagName, hasAttribute, &
extractDataContent, extractDataAttribute
#else
- USE FoX_dom, ONLY : parseFile, item, getElementsByTagname, destroy, &
+ USE dom, ONLY : parseFile, item, getElementsByTagname, destroy, &
nodeList, Node, getLength, getTagName, hasAttribute, &
extractDataContent, extractDataAttribute
#endif
diff --git a/include/defs.h.README b/include/defs.h.README
index 0de07c11a..e25183339 100644
--- a/include/defs.h.README
+++ b/include/defs.h.README
@@ -62,6 +62,7 @@ Libraries:
(obsolete?)
__SX6 Use MathKeisan libraries for NEC SX machines
ASL, MICRO SX-6 specific libraries (obsolescent)
+ __fox Use true FoX library instead of built-in replacement
Signals:
__PTRACE Enable traceback
diff --git a/install/configure b/install/configure
index 2ad2c5ac6..9db8fca5c 100755
--- a/install/configure
+++ b/install/configure
@@ -665,6 +665,7 @@ mpi_libs
mass_line
mass_libs
foxlibs
+foxmods
extfox
libxc_line
LIBS_LIBXC
@@ -1444,7 +1445,7 @@ Optional Packages:
--with-libxc-include=DIR
Directory where libxc Fortran headers were
installed.
- --with-fox use FoX library (default: yes)
+ --with-fox use FoX library (default: no)
--with-scalapack (yes|no|intel) Use scalapack if available. Set to
"intel" to use Intel MPI and blacs (default: use
openMPI)
@@ -5901,25 +5902,27 @@ fi
# Check whether --with-fox was given.
if test "${with_fox+set}" = set; then :
- withval=$with_fox; if test "$withval" = "no" ; then
- with_fox=0
- else
+ withval=$with_fox; if test "$withval" = "yes" ; then
with_fox=1
+ else
+ with_fox=0
fi
else
- with_fox=1
+ with_fox=0
fi
# Use internal code for xml read/write
if test "$with_fox" -eq 0 ; then
- try_dflags="$try_dflags -D__outfoxed"
extfox=""
+ foxmods=""
foxlibs=""
else
extfox="libfox"
+ foxmods="\$(MOD_FLAG)\$(TOPDIR)/FoX/finclude"
foxlibs="-L\$(TOPDIR)/FoX/lib -lFoX_dom -lFoX_sax -lFoX_wxml -lFoX_common -lFoX_utils -lFoX_fsys "
try_iflags="$try_iflags -I\$(TOPDIR)/FoX/finclude "
+ try_dflags="$try_dflags -D__fox"
fi
@@ -5928,6 +5931,7 @@ fi
+
# Checking for IBM MASS library...
diff --git a/install/m4/x_ac_qe_fox.m4 b/install/m4/x_ac_qe_fox.m4
new file mode 100644
index 000000000..44f8ada4d
--- /dev/null
+++ b/install/m4/x_ac_qe_fox.m4
@@ -0,0 +1,33 @@
+# Copyright (C) 2022 Quantum ESPRESSO Foundation
+
+AC_DEFUN([X_AC_QE_FOX], [
+
+ AC_ARG_WITH(fox,
+ [AS_HELP_STRING([--with-fox],
+ [use FoX library (default: no)])],
+ [if test "$withval" = "yes" ; then
+ with_fox=1
+ else
+ with_fox=0
+ fi],
+ [with_fox=0])
+
+ # Use internal code for xml read/write
+ if test "$with_fox" -eq 0 ; then
+ extfox=""
+ foxmods=""
+ foxlibs=""
+ else
+ extfox="libfox"
+ foxmods="\$(MOD_FLAG)\$(TOPDIR)/FoX/finclude"
+ foxlibs="-L\$(TOPDIR)/FoX/lib -lFoX_dom -lFoX_sax -lFoX_wxml -lFoX_common -lFoX_utils -lFoX_fsys "
+ try_iflags="$try_iflags -I\$(TOPDIR)/FoX/finclude "
+ try_dflags="$try_dflags -D__fox"
+fi
+
+AC_SUBST(extfox)
+AC_SUBST(foxmods)
+AC_SUBST(foxlibs)
+
+ ]
+)
diff --git a/install/make.inc.in b/install/make.inc.in
index 9a092121c..b43c22201 100644
--- a/install/make.inc.in
+++ b/install/make.inc.in
@@ -66,8 +66,7 @@ BASEMOD_FLAGS= $(MOD_FLAG)$(TOPDIR)/upflib \
$(MOD_FLAG)$(TOPDIR)/LAXlib \
$(MOD_FLAG)$(TOPDIR)/UtilXlib \
$(MOD_FLAG)$(TOPDIR)/MBD \
- $(MOD_FLAG)$(TOPDIR)/KS_Solvers \
- $(MOD_FLAG)$(TOPDIR)/FoX/finclude
+ $(MOD_FLAG)$(TOPDIR)/KS_Solvers $(FOX_MOD)
# If A depends upon B, A should come before B in the list below
# (most compilers don't care but some don't resolve cross links)
@@ -160,6 +159,7 @@ HDF5_LIBS = @hdf5_libs@
# FOX
FOX = @extfox@
+FOX_MOD = @foxmods@
FOX_LIB = @foxlibs@
FOX_FLAGS = @foxflags@