Skip to content

Commit 123354e

Browse files
authored
FPLO: add new package (#32580)
1 parent eaf3f7c commit 123354e

File tree

6 files changed

+373
-0
lines changed

6 files changed

+373
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
--- a/FPLO22.00-62/install/MMakefile 2022-07-06 01:06:19.000000000 -0500
2+
+++ b/FPLO22.00-62/install/MMakefile 2022-08-28 16:23:30.921835477 -0500
3+
@@ -106,7 +106,7 @@
4+
5+
# directories with source code to compile
6+
parentpath=../..
7+
-srcdir="COMMON ISO SLABIFY FEDIT CALC CIF OPTICS"
8+
+srcdir="COMMON SLABIFY ISO FEDIT CALC CIF OPTICS"
9+
doxinstall=0
10+
xsrcdir="XFPLO"
11+
moddir="MODULES"
12+
@@ -245,17 +245,15 @@
13+
14+
###########################
15+
# mkl
16+
-echo "Please enter if you want to use the MKL eigenvalue solver (y/n) [default n]:" ; read YN
17+
-if [ "x$YN" = "xy" -o "x$YN" = "xY" ];then mkl=1; fi
18+
+#echo "Please enter if you want to use the MKL eigenvalue solver (y/n) [default n]:" ; read YN
19+
+#if [ "x$YN" = "xy" -o "x$YN" = "xY" ];then mkl=1; fi
20+
if [ $mkl = 1 ] ; then
21+
nmkl=$(echo "$MKLROOT" | sed -e "s/[\t\n ]*//g" | wc -c)
22+
if [ $nmkl -gt 1 ] ; then
23+
echo "I found an mkl path"
24+
else
25+
echo "I did not find the mkl path you will have to setup the \n\
26+
-linkage yourself (README) or restart and answer no."
27+
- echo "Press enter to continue:" ;read YN
28+
- mkl=1
29+
+linkage yourself (README)."
30+
fi
31+
else
32+
use_own_lapack=1
33+
@@ -346,27 +344,7 @@
34+
echo ""
35+
################################################################################
36+
echo " C-Compiler C++-Compiler F90-Compiler system specification"
37+
-echo "probing $CC $CXX $F90 $hostname"
38+
-if [ -f "$configdir/$CC-$F90-$hostname" ]
39+
-then
40+
- conffile="$configdir/$CC-$F90-$hostname"
41+
-else
42+
- echo "probing $CC $CXX $F90 $hostname"
43+
- if [ -f "$configdir/$CC-$F90-$sname-$os_rel" ]
44+
- then
45+
- conffile="$configdir/$CC-$F90-$sname-$os_rel"
46+
- else
47+
- echo "probing $CC $CXX $F90 $hostname"
48+
- if [ -f "$configdir/$CC-$F90-$sname" ]
49+
- then
50+
- conffile="$configdir/$CC-$F90-$sname"
51+
- else
52+
- echo "No configuration file for your settings are available!"
53+
- exit
54+
- fi
55+
- fi
56+
-fi
57+
-
58+
+conffile=$configdir/
59+
60+
61+
# make installdir
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--- a/FPLO22.00-62/PYTHON/fedit.py 2022-09-03 13:05:21.631163009 -0500
2+
+++ b/FPLO22.00-62/PYTHON/fedit.py 2022-09-03 13:06:37.636210691 -0500
3+
@@ -20,8 +20,8 @@
4+
Checkout the examples delivered with **fplo**.
5+
'''
6+
import sys,os
7+
-import pyfplo.fploio as fploio
8+
import pyfplo.common
9+
+import pyfplo.fploio as fploio
10+
version=pyfplo.common.Version()
11+
Version=pyfplo.common.Version
12+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/FPLO22.00-62/PYTHON/setuphelper.py 2022-08-28 19:19:42.693913426 -0500
2+
+++ b/FPLO22.00-62/PYTHON/setuphelper.py 2022-08-28 19:20:54.902954741 -0500
3+
@@ -233,7 +233,7 @@
4+
self.ccompiler\
5+
=CompilerConfig.find(ccompilerconfigs,'gcc')
6+
7+
- self.lapackconfig=LapackConfig.find(lapackconfigs,'our own copy')
8+
+ self.lapackconfig=LapackConfig.find(lapackconfigs,'mkl 64bit integer 32bit')
9+
10+
if "--lapackgeneric" in sys.argv:
11+
sys.argv.remove("--lapackgeneric")
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
diff -ur a/FPLO22.00-62/install/conf/gcc-gfortran-Linux-i386 b/FPLO22.00-62/install/conf/gcc-gfortran-Linux-i386
2+
--- a/FPLO22.00-62/install/conf/gcc-gfortran-Linux-i386 2022-07-03 08:48:02.000000000 -0500
3+
+++ b/FPLO22.00-62/install/conf/gcc-gfortran-Linux-i386 2022-08-28 14:02:03.303297840 -0500
4+
@@ -41,7 +41,7 @@
5+
#TODO: set here the curses system library
6+
# on Linux systems it must be -lncurses
7+
#
8+
-LIBS_CURSES=" -lncurses"
9+
+LIBS_CURSES=" -lncurses -ltinfo"
10+
11+
12+
13+
diff -ur a/FPLO22.00-62/install/conf/gcc-gfortran-Linux-x86_64 b/FPLO22.00-62/install/conf/gcc-gfortran-Linux-x86_64
14+
--- a/FPLO22.00-62/install/conf/gcc-gfortran-Linux-x86_64 2022-07-03 08:48:24.000000000 -0500
15+
+++ b/FPLO22.00-62/install/conf/gcc-gfortran-Linux-x86_64 2022-08-28 14:02:14.381306024 -0500
16+
@@ -42,7 +42,7 @@
17+
#TODO: set here the curses system library
18+
# on Linux systems it must be -lncurses
19+
#
20+
-LIBS_CURSES=" -lncurses"
21+
+LIBS_CURSES=" -lncurses -ltinfo"
22+
23+
24+
25+
diff -ur a/FPLO22.00-62/install/conf/gcc-ifort-Darwin-i386 b/FPLO22.00-62/install/conf/gcc-ifort-Darwin-i386
26+
--- a/FPLO22.00-62/install/conf/gcc-ifort-Darwin-i386 2021-01-19 04:09:45.000000000 -0600
27+
+++ b/FPLO22.00-62/install/conf/gcc-ifort-Darwin-i386 2022-08-28 14:02:25.597314302 -0500
28+
@@ -47,7 +47,7 @@
29+
#TODO: set here the curses system library
30+
# on Linux systems it must be -lncurses
31+
#
32+
-LIBS_CURSES=" -lncurses"
33+
+LIBS_CURSES=" -lncurses -ltinfo"
34+
35+
36+
37+
diff -ur a/FPLO22.00-62/install/conf/gcc-ifort-Linux-i386 b/FPLO22.00-62/install/conf/gcc-ifort-Linux-i386
38+
--- a/FPLO22.00-62/install/conf/gcc-ifort-Linux-i386 2021-01-19 04:09:50.000000000 -0600
39+
+++ b/FPLO22.00-62/install/conf/gcc-ifort-Linux-i386 2022-08-28 14:02:37.508323085 -0500
40+
@@ -47,7 +47,7 @@
41+
#TODO: set here the curses system library
42+
# on Linux systems it must be -lncurses
43+
#
44+
-LIBS_CURSES=" -lncurses"
45+
+LIBS_CURSES=" -lncurses -ltinfo"
46+
47+
48+
49+
diff -ur a/FPLO22.00-62/install/conf/gcc-ifort-Linux-ia64 b/FPLO22.00-62/install/conf/gcc-ifort-Linux-ia64
50+
--- a/FPLO22.00-62/install/conf/gcc-ifort-Linux-ia64 2021-01-19 04:09:55.000000000 -0600
51+
+++ b/FPLO22.00-62/install/conf/gcc-ifort-Linux-ia64 2022-08-28 14:02:53.211334647 -0500
52+
@@ -32,7 +32,7 @@
53+
#TODO: set here the curses system library
54+
# on Linux systems it must be -lncurses
55+
#
56+
-LIBS_CURSES=" -lncurses"
57+
+LIBS_CURSES=" -lncurses -ltinfo"
58+
59+
60+
61+
diff -ur a/FPLO22.00-62/install/conf/gcc-ifort-Linux-x86_64 b/FPLO22.00-62/install/conf/gcc-ifort-Linux-x86_64
62+
--- a/FPLO22.00-62/install/conf/gcc-ifort-Linux-x86_64 2022-05-15 01:53:01.000000000 -0500
63+
+++ b/FPLO22.00-62/install/conf/gcc-ifort-Linux-x86_64 2022-08-28 14:03:11.580348155 -0500
64+
@@ -49,7 +49,7 @@
65+
#TODO: set here the curses system library
66+
# on Linux systems it must be -lncurses
67+
#
68+
-LIBS_CURSES=" -lncurses"
69+
+LIBS_CURSES=" -lncurses -ltinfo"
70+
71+
72+
73+
diff -ur a/FPLO22.00-62/install/conf/icc-ifort-Darwin-i386 b/FPLO22.00-62/install/conf/icc-ifort-Darwin-i386
74+
--- a/FPLO22.00-62/install/conf/icc-ifort-Darwin-i386 2021-01-19 04:10:07.000000000 -0600
75+
+++ b/FPLO22.00-62/install/conf/icc-ifort-Darwin-i386 2022-08-28 14:03:21.741355617 -0500
76+
@@ -47,7 +47,7 @@
77+
#TODO: set here the curses system library
78+
# on Linux systems it must be -lncurses
79+
#
80+
-LIBS_CURSES=" -lncurses"
81+
+LIBS_CURSES=" -lncurses -ltinfo"
82+
83+
84+
85+
diff -ur a/FPLO22.00-62/install/conf/icc-ifort-Darwin-x86_64 b/FPLO22.00-62/install/conf/icc-ifort-Darwin-x86_64
86+
--- a/FPLO22.00-62/install/conf/icc-ifort-Darwin-x86_64 2021-01-19 04:10:11.000000000 -0600
87+
+++ b/FPLO22.00-62/install/conf/icc-ifort-Darwin-x86_64 2022-08-28 14:03:31.829363021 -0500
88+
@@ -49,7 +49,7 @@
89+
#TODO: set here the curses system library
90+
# on Linux systems it must be -lncurses
91+
#
92+
-LIBS_CURSES=" -lncurses"
93+
+LIBS_CURSES=" -lncurses -ltinfo"
94+
95+
96+
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
2+
# Spack Project Developers. See the top-level COPYRIGHT file for details.
3+
#
4+
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
5+
6+
import glob
7+
import os
8+
import platform
9+
10+
from spack.package import *
11+
12+
13+
class Fplo(MakefilePackage):
14+
"""The FPLO(R) package is a full-potential local-orbital code to solve the
15+
Kohn-Sham equations on a regular lattice or with free boundary conditions
16+
(finite systems). Relativistic effects are treated either in a
17+
scalar-relativistic or a full 4-component formalism. Available
18+
functionals are LSDA, GGA (PBE 96) and LSDA/GGA+U. Orbital polarization
19+
correction can be applied."""
20+
21+
homepage = "https://www.fplo.de/"
22+
url = "file://{0}/FPLO22.00-62.tar.gz".format(os.getcwd())
23+
manual_download = True
24+
25+
maintainers = ["glennpj"]
26+
27+
version("22.00-62", sha256="0d1d4e9c1e8e41900901e26c3cd08ee39dcfdeb3f2c4c8862055eaf704b6d69e")
28+
29+
# TODO: Try to get LAPACK to work with something other than MKL. The build
30+
# fails even with the fallback/builtin lapack.
31+
32+
# This patch replaces the default builtin lapack with MKL, as MKL is the
33+
# only functioning LAPACK implementation.
34+
patch("lapackconfig.patch")
35+
36+
# This patch does 3 things: (1) Change the order of the src directories so
37+
# the object dependencies are correct; (2) removes interactivity; and (3)
38+
# explicitly sets the configuration.
39+
patch("MMakefile.patch")
40+
41+
# Add '-ltinfo' for linking.
42+
patch("ncurses.patch")
43+
44+
# Set the names for QT and PYTHON.
45+
patch("qt-make.patch")
46+
47+
# Sets the correct python module import order.
48+
patch("fedit_py.patch")
49+
50+
depends_on("mkl")
51+
depends_on("ncurses")
52+
depends_on("perl", type="run")
53+
depends_on("qt@5+opengl")
54+
55+
extends("python")
56+
depends_on("py-numpy")
57+
58+
conflicts("%gcc@12:")
59+
60+
@property
61+
def build_directory(self):
62+
return join_path(self.stage.source_path, "FPLO{0}".format(self.version))
63+
64+
def edit(self, spec, prefix):
65+
# Need to set this to 'gcc' even if using the intel compiler as all of
66+
# the configuration files are named with 'gcc'.
67+
if platform.system() == "Linux":
68+
fplo_cc = "gcc"
69+
else:
70+
fplo_cc = os.path.basename(self.compiler.cc)
71+
72+
fplo_fc = os.path.basename(self.compiler.fc)
73+
74+
conffile = "{0}-{1}-{2}-{3}".format(
75+
fplo_cc, fplo_fc, platform.system(), platform.machine()
76+
)
77+
mmakefile = FileFilter(join_path(self.build_directory, "install", "MMakefile"))
78+
mmakefile.filter(r"(^conffile=\$configdir/)$", r"\1{0}".format(conffile))
79+
mmakefile.filter(r"(^mkl=).*", r"\11")
80+
81+
# use spack compiler
82+
files = glob.glob(join_path(self.build_directory, "install", "conf", "*"))
83+
filter_file(r"^\s*CC\s*=.*", "CC=" + spack_cc, *files)
84+
filter_file(r"^\s*CXX\s*=.*", "CXX=" + spack_cxx, *files)
85+
filter_file(r"^\s*F90\s*=.*", "F90=" + spack_fc, *files)
86+
87+
# patch for 64 bit integers
88+
if "^mkl+ilp64" in spec:
89+
setuphelper = FileFilter(join_path(self.build_directory, "PYTHON", "setuphelper.py"))
90+
setuphelper.filter("mkl 64bit integer 32bit", "mkl 64bit integer 64bit")
91+
92+
# setup python build
93+
python_makefile = FileFilter(join_path(self.build_directory, "PYTHON", "Makefile"))
94+
python_makefile.filter(r"(build_ext\s* --inplace)\s*--interactive(\s*.*)", r"\1\2")
95+
96+
def build(self, spec, prefix):
97+
mmakefile = Executable(join_path(self.build_directory, "install", "MMakefile"))
98+
mmakefile_args = [
99+
"-f90",
100+
spack_fc,
101+
"-cc",
102+
spack_cc,
103+
"-c+",
104+
spack_cxx,
105+
]
106+
107+
with working_dir(self.build_directory):
108+
# copy contents of bin
109+
copy_tree("bin", join_path(self.stage.source_path, "bin"))
110+
111+
# configure the build
112+
with working_dir("install"):
113+
mmakefile(*mmakefile_args)
114+
115+
# build main
116+
make()
117+
make("install")
118+
119+
# build XFBP
120+
with working_dir(join_path("XFBP_rel", "XFBP")):
121+
make()
122+
make("install")
123+
124+
# build XFPLO
125+
with working_dir(join_path("XFPLO_rel", "XFPLO")):
126+
make()
127+
make("install")
128+
129+
# build python
130+
with working_dir("PYTHON"):
131+
if "^python@:2" in self.spec:
132+
make()
133+
else:
134+
make("python3")
135+
136+
def install(self, spec, prefix):
137+
with working_dir(self.stage.source_path):
138+
install_tree("bin", prefix.bin)
139+
140+
with working_dir(self.build_directory):
141+
install_tree("DOC", join_path(prefix.share, "DOC"))
142+
with working_dir("PYTHON"):
143+
install_tree("pyfplo", join_path(python_platlib, "pyfplo"))
144+
145+
@run_after("install")
146+
def perl_interpreter(self):
147+
with working_dir(self.prefix.bin):
148+
pattern = "^#!.*/usr/bin/perl"
149+
repl = "#!{0}".format(self.spec["perl"].command.path)
150+
files = [
151+
"fconv2",
152+
"fconvdens2",
153+
"fdowngrad.pl",
154+
"fout2in",
155+
"grBhfat",
156+
"grpop",
157+
]
158+
for file in files:
159+
filter_file(pattern, repl, *files, backup=False)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
diff -ru a/FPLO22.00-62/XFBP_rel/XFBP/makefile b/FPLO22.00-62/XFBP_rel/XFBP/makefile
2+
--- a/FPLO22.00-62/XFBP_rel/XFBP/makefile 2022-08-29 18:10:09.672721299 -0500
3+
+++ b/FPLO22.00-62/XFBP_rel/XFBP/makefile 2022-08-29 18:10:39.779667413 -0500
4+
@@ -1,7 +1,7 @@
5+
MAKE=make
6+
QMAKE4=qmake
7+
QMAKE4=qmake-qt4
8+
-QMAKE5=qmake -qt=5
9+
+QMAKE5=qmake
10+
QTVERSION=5
11+
#QMAKE=/usr/local/qt4.5/bin/qmake
12+
#QMAKE=/opt/trolltech/QT-4.6.2/bin/qmake
13+
@@ -15,8 +15,8 @@
14+
# The config program could be named python-config
15+
# or python2.7-config or python3-config or similar.
16+
# You might need to install python-dev or python3-dev or somthing like this.
17+
-PYTHON=python3
18+
-PYCONFIG=python3-config
19+
+PYTHON=python
20+
+PYCONFIG=python-config
21+
22+
PROJECT1=XFBP
23+
PROJECT1PYTHON=XFBPWITHPYTHON
24+
diff -ru a/FPLO22.00-62/XFPLO_rel/XFPLO/makefile b/FPLO22.00-62/XFPLO_rel/XFPLO/makefile
25+
--- a/FPLO22.00-62/XFPLO_rel/XFPLO/makefile 2022-08-29 18:10:09.654721332 -0500
26+
+++ b/FPLO22.00-62/XFPLO_rel/XFPLO/makefile 2022-08-29 18:10:58.263635879 -0500
27+
@@ -1,6 +1,6 @@
28+
MAKE=make
29+
QMAKE4=qmake-qt4
30+
-QMAKE5=qmake -qt=5
31+
+QMAKE5=qmake
32+
#QMAKE4=/usr/local/qt4.5/bin/qmake
33+
#QMAKE4=/opt/trolltech/QT-4.6.2/bin/qmake
34+
PROJECT1=XFPLO

0 commit comments

Comments
 (0)