-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
76 lines (65 loc) · 2.37 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import os
from setuptools import setup, Extension, find_packages
from setuptools.command.build_ext import build_ext
# Parameters that need to be modified
CXX = "icpc"
LAPACK_DIR = "/opt/intel/compilers_and_libraries_2018.1.163/linux/mkl"
# Generally do not need to modify
os.environ["CXX"] = CXX
os.environ["CC"] = CXX
os.environ['CFLAGS'] = "-O2 -std=c++11 -fPIC -Wall -shared"
LAPACK_INCLUDE_DIR = LAPACK_DIR + "/include"
LAPACK_LIB_DIR = LAPACK_DIR + "/lib/intel64"
LAPACK_LIB = "-L" + LAPACK_LIB_DIR + " -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -Wl,-rpath=" + LAPACK_LIB_DIR
MY_INCLUDE = "cpp/include"
sources_dir = "cpp/src/core"
sources = [
"band_structure_solver.cpp",
"bandunfolding_solver.cpp",
"base_data.cpp",
"berry_connection_solver.cpp",
"berry_curvature_solver.cpp",
"berry_phase_solver.cpp",
"cell_atom.cpp",
"linear_response.cpp",
"math_integral.cpp",
"math_sphbes.cpp",
"optical_conductivity_solver.cpp",
"shift_current_solver.cpp",
"tools.cpp",
"velocity_solver.cpp",
"xr_operation.cpp"
]
for i, s in enumerate(sources):
sources[i] = os.path.join(sources_dir, s)
include_dirs = [sources_dir, MY_INCLUDE]
extra_compile_args = []
if CXX == "g++":
extra_compile_args += ["-fopenmp"]
else:
extra_compile_args += ["-qopenmp"]
extra_link_args = extra_compile_args + [LAPACK_LIB]
define_macros = []
undef_macros = []
extension = Extension('pyatb.interface_python',
include_dirs=include_dirs,
sources=["cpp/src/interface_python/interface_python.cpp"] + sources,
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
define_macros=define_macros,
undef_macros=undef_macros)
setup(name='pyatb',
version="1.0.0",
cmdclass={'build_ext': build_ext},
setup_requires=['numpy', 'setuptools>=18.0'],
license='GPL v3.0',
description='This is the pyatb module.',
long_description='None',
author='Gan Jin & Hongsheng Pang',
author_email='[email protected]',
url='None',
packages=find_packages(),
py_modules=[],
install_requires=['numpy', 'scipy', 'mpi4py', 'matplotlib'],
ext_modules=[extension],
entry_points={'console_scripts': ['pyatb = pyatb.main:main']})