Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge the new library interface #466

Merged
merged 188 commits into from
Feb 15, 2024
Merged
Changes from 1 commit
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
43f094e
Add initialisation values to types and remove from the read routines
sstgfbc Feb 28, 2022
1c9cbf0
Add initialisation to old wannier_lib
sstgfbc Feb 28, 2022
5d4d73d
add BGS lib interface (work in progress)
Mar 15, 2022
474808d
Change some seedname len=50 to len=* to avoid some python runtime errors
sstgfbc Mar 16, 2022
7602d5d
Copy global initialisations from wannier_prog into lib interface type
sstgfbc Mar 16, 2022
1421144
w90stat_type is only used in comms module and confuses f90wrap so make
sstgfbc Mar 16, 2022
0c3d439
Put comm back into wrapper function in library interface
sstgfbc Mar 16, 2022
94ee858
Add library interface to kmesh_get
sstgfbc Mar 16, 2022
14dff0b
Overlap interface without disentangle needed u_matrix
sstgfbc Mar 16, 2022
536cd88
Wannierise wrapper call needs the M and U matrices
sstgfbc Mar 16, 2022
a6c07c6
Try and separate transport and plot types in library
sstgfbc Mar 28, 2022
963350f
Add a_matrix to overlap_read in library for use by disentangle
sstgfbc Mar 28, 2022
35bc313
Separate time printing from each subroutine call
sstgfbc Mar 28, 2022
67d1a42
Add subroutine for plotting to library interface
sstgfbc Mar 28, 2022
a45678c
Add u_matrix_opt to wannierise (will be generated by disentangle)
sstgfbc Mar 28, 2022
88d97bb
Add routine to write checkpoint files
sstgfbc Mar 28, 2022
eaecf37
Add library interface to transport
sstgfbc Mar 28, 2022
c76dd30
Fix missing 'use' in checkpoint
sstgfbc Mar 28, 2022
7bd2c89
add make rule for library_inteface
Mar 28, 2022
7c98756
Add f90wrap example building code to repository
sstgfbc Mar 29, 2022
08d999a
Correct name of abort code in serial build
sstgfbc Mar 29, 2022
c2b65fa
Add example python scripts to experimental f90wrap directory
sstgfbc Mar 29, 2022
82eb329
Set iprint to 0 for other MPI ranks in library
sstgfbc Mar 29, 2022
5b13a56
Correct mpi example to match current python moduel name
sstgfbc Mar 29, 2022
562a36c
Fix import in mpi-example
sstgfbc Mar 30, 2022
2addfee
Fix format specifier in utility_diagonalise
sstgfbc Apr 4, 2022
4f6b2e7
f90wrap can't handle array initialisation in types. Move kslice init
sstgfbc Apr 5, 2022
1f76f09
move read in_file to main()
Apr 6, 2022
c2c1cb4
assign a var before it is used
Apr 6, 2022
9dd1714
define disentanglement variable on non-root ranks
Apr 6, 2022
cc783c6
Add output unit to library interface
sstgfbc Apr 11, 2022
7126e72
Split read checkpoint to help with python wrapping
sstgfbc Apr 11, 2022
4999cc5
check_in_file moved to driver routine should call prterr not return
sstgfbc Apr 11, 2022
d7b6794
have_disentangled should be intent(in) in second half of read_chkpt
sstgfbc Apr 12, 2022
e44ba19
Add pw90 library interface with working python DOS example
sstgfbc Apr 12, 2022
1abec31
Add a boltzwann option to the postw90 library
sstgfbc Apr 12, 2022
e08d351
Split off v_matrix build from DOS call in pw90 library
sstgfbc Apr 13, 2022
18ec71e
Add gyrotropic option to pw90 library
sstgfbc Apr 19, 2022
5ffb992
Add pw90 library call to berry
sstgfbc Apr 19, 2022
2703352
Add kpath call to postw90 library
sstgfbc Apr 20, 2022
f951b8d
Add kslice interface to pw90 library
sstgfbc Apr 20, 2022
6d60d61
Add spin moment calculation
sstgfbc Apr 25, 2022
b80becf
Add generic intepolation routines pw90 interface
sstgfbc Apr 25, 2022
bda8717
Add W90DEV flag for compiling in error finalise call
sstgfbc Apr 27, 2022
fe558da
Need a separate wanint_setup call to run postw90 with wannier90 in py…
sstgfbc Apr 27, 2022
3782b61
Read_in_file/clean_in_file were missing from library interface reader
sstgfbc May 9, 2022
3ed31b9
Need to add m_matrix_orig allocation to overlaps in library interface to
sstgfbc May 9, 2022
f59c9a4
Update python wrapper make.inc to Intel oneapi libs
sstgfbc May 12, 2022
91b7157
Need to add separated input file read to old wannier_lib. Also a few
sstgfbc Jun 1, 2022
03e8e81
Add a subroutine to get the output unit so python doesn't have to assume
sstgfbc Jun 8, 2022
c0c02b9
This creates a 'working' disentangle to run the example13 transport calc
sstgfbc May 12, 2022
31faa5d
Restore missing patch for disentangle in previous commit
sstgfbc Jun 8, 2022
9aff60f
Including the arrays as references in the global library type would n…
sstgfbc Jun 8, 2022
f54da04
Remove matrices from checkpoint library interface
sstgfbc Jun 8, 2022
ee59b8d
Attempt to restructure library global types to match the structure of…
sstgfbc Jun 8, 2022
a52fe41
Add status variable to library interface. 0 is ok, positive is an err…
sstgfbc Jun 9, 2022
bef565c
Update python examples for modified library interface with status var…
sstgfbc Jun 16, 2022
a0bd4de
Modify pw90 library to include v_matrix in type in analogy to w90 cha…
sstgfbc Jun 16, 2022
6a1d433
first hack set_option() for scalars, readwrite.F90
Jun 28, 2022
62a82c1
tweak scalar option setting
Jun 28, 2022
ec63b43
move set_option to library_interface.F90
Jun 29, 2022
8b84667
Changes to store k point distribution in library interface and use in
sstgfbc Jul 13, 2022
269ecb1
various changes around m_matrix_loc
Jul 19, 2022
b25526b
fix subtle error handling case
Jul 21, 2022
0a62b01
revert to using counts/displs (it really is better)
Jul 21, 2022
5700a85
revise disentangle lib routine (ongoing)
Jul 21, 2022
555ba51
fixup old library
Aug 10, 2022
02aab88
reshuffle a couple of m-matrices in the library interface
Aug 10, 2022
7c8dad9
Fix library interface to wannierise and restore general k point distr…
sstgfbc Aug 11, 2022
c6d2e62
Update serial python example after retesting with current code
sstgfbc Aug 11, 2022
da8d7a0
various changes associated with allocation of m_matrix* (wip)
Aug 11, 2022
9750862
add toy code using libv2
Aug 12, 2022
d0dd0dc
Update serial python example after changes to overlap
sstgfbc Aug 15, 2022
ad184db
Initial update of MPI python example for current lib interface
sstgfbc Aug 15, 2022
c0a595d
Initial changes to overlap read to read local parts of m_matrix on node
sstgfbc Aug 15, 2022
8ca8ead
pass most tests in serial using tiny-lib2-demo (error handling absent)
Aug 12, 2022
fe54963
current state
Aug 16, 2022
1e9b417
small fixes such that toy main() passes all serial and parallel tests
Aug 16, 2022
dba4e33
hacks for non-root-error-condition test
Aug 16, 2022
e957848
cosmetic changes
Aug 16, 2022
bb4347f
move from counts/displs to more general dist_k
Sep 14, 2022
d34cff8
simplify kpoint decomposition and check error in main()
Sep 15, 2022
9fd66f7
Add fortran error unit for python
sstgfbc Sep 16, 2022
ee9a7f1
make wannier main() work in serial
Sep 20, 2022
43c67d4
make wannier_lib compile
sstgfbc Oct 3, 2022
9c14eab
Add error unit to routines in pw90_lib
sstgfbc Oct 3, 2022
1ed5e6b
Add file opening option for python interface
sstgfbc Oct 3, 2022
880fbeb
Update python examples
sstgfbc Oct 3, 2022
7a87493
Split pwost90 setup from read_checkpoint and initialise some of the v…
sstgfbc Oct 3, 2022
9d7cc54
Update python pw90 dos example
sstgfbc Oct 4, 2022
6e1b570
move some output routines from wann_main to plot_main
Oct 4, 2022
5a3de35
hack printout
Oct 6, 2022
c38e419
wip checkpoint reading
Oct 7, 2022
d279e7b
fixes checkpointing, fixes old library build, removes 'library' flag
Nov 23, 2022
18d9b71
temporary hacks concerning .eig reading
Jan 11, 2023
19dc8cc
restructure settings string, set evals differently
Jan 9, 2023
d576f7b
changes to .eig reading; groundwork for array/matrix option handling
Jan 13, 2023
418d81d
wip lib testing
Jan 17, 2023
a975554
put settings_type in types module
Jan 18, 2023
cb3cf68
move overlap_project call out from overlap_read
Jan 20, 2023
8f50a12
trap some error conditions in main()
Jan 25, 2023
b46db7d
define nnkp before writing it
Jan 25, 2023
f81bb81
correct use of output units
Jan 25, 2023
0e50f25
change handling of projections during read
Jan 31, 2023
ba01fe5
adopt more sensible dummy var names in lib; use errors consistently
Feb 1, 2023
10ba7ce
fixes various and diverse details and coding issues
Feb 1, 2023
7adc322
reorganise alloc of eigval(:,:)
Feb 6, 2023
e612f03
move setting object into library data struct
Feb 6, 2023
77b74f1
Move 'set_option' routines from readwrite to library_interface
sstgfbc Feb 7, 2023
ae4bb0e
Tidy up a few unused vars in readwrite and make wannier_lib compile
sstgfbc Feb 7, 2023
8490b74
Update postw90 to use settings_type in reader
sstgfbc Feb 7, 2023
d6947d3
Initial changes to get the draft pw90_library to compile
sstgfbc Feb 7, 2023
19023b1
fixes failure to initialise LocalSigmaS var in boltzwann
Feb 8, 2023
9a2d93c
init u_opt necessary when not disentangling
Feb 13, 2023
3786903
correctly write proj_input (not proj) to nnkp
Feb 15, 2023
7c67a0c
correct use of calc_only_a variable
Feb 15, 2023
16abdea
adds subroutine get_proj
Feb 15, 2023
9040ef6
Minor updates so the python works with disentangle
sstgfbc Feb 15, 2023
c9bb89b
replace old wannier_prog with tiny-lib2-demo
Feb 15, 2023
953c1be
let wannier_lib.F90 compile
Feb 15, 2023
957e9a6
Propagate library pointer eigval usage into postw90 and draft library
sstgfbc Feb 20, 2023
b4176e7
Modify read_eigval to use pointer in helper type
sstgfbc Feb 20, 2023
324bcce
remove a module dependency from kmesh
Feb 20, 2023
0bfa6f1
Restructure eigval reading and dis_manifold initialisation. Eigenvalues
sstgfbc Feb 28, 2023
fd3b8cb
Fix automatic deallocation of eigvals in pw90 library
sstgfbc Feb 28, 2023
5cb7621
Add subroutine for setting bohr_to_angstrom conversion from SCF code
sstgfbc Mar 23, 2023
ec1364a
Create set_parallel_comms subroutine so users do not need to 'use' our
sstgfbc Mar 30, 2023
85b65ab
fixup
Mar 31, 2023
5464a72
MPI complications for gamma_only and nk>nproc cases
Apr 24, 2023
3c05ccd
rationalise some variable names
May 9, 2023
a877713
Updates to draft pw90 library and python examples to reflect recent c…
sstgfbc May 12, 2023
2fb3c01
Updated PyMPI example after testing
sstgfbc May 12, 2023
d3d81e8
Update pw90 library to remove comms and match recent changes to w90 lib
sstgfbc May 12, 2023
f35c77a
fix argument in legacy library
May 18, 2023
0698c6e
add declarations
May 30, 2023
a4eefcc
cmdline parsing
May 30, 2023
9fb79c2
differentiate between mandatory lib args and opts
Jun 15, 2023
5c14bbe
cleaning up some comments in codebase
Jun 15, 2023
5c141af
Rework handling of .win file (in_data) and set_options (entries) data
Jun 15, 2023
6a0761c
more sane way to set options
Jun 16, 2023
e292d99
plaster together basic functionality for c interface
Jul 5, 2023
3a37828
b-vec search method must allow arbitrary k order
Jan 8, 2024
0e27671
guard some prints in write_chkpt()
Jan 10, 2024
5d2228b
add c++ header file
Jan 10, 2024
b012d44
add DL team to author list for v4
Jan 10, 2024
17684fc
remove obsolete test
Jan 10, 2024
634c75e
remove obsolete forall
Jan 10, 2024
e1dbb48
cleanup
Jan 10, 2024
a0858c7
restore guiding centres assignment
Jan 10, 2024
767a8cd
cut away some unnecessary matrices
Jan 12, 2024
3daddd6
change how to set distk
Jan 14, 2024
e127542
move setting of communicator into setopt call
Jan 14, 2024
26b4935
set seedname in one place only
Jan 14, 2024
ebd34ae
merge two library data types
Jan 14, 2024
bc2eb78
use MPI_VERSION pp macro to detect parallel use of header
Jan 16, 2024
df04d34
start patching up pw90
Jan 16, 2024
7ec7995
removes legacy library
Jan 16, 2024
3b87a26
reinstate unlucky test
Jan 16, 2024
dd77bfc
small corrections to fix some tests
Jan 16, 2024
d404b97
fix nnkp generation (standalone)
Jan 17, 2024
63fc650
comment out c_interface to avoid need for std=f2018
Jan 17, 2024
a86803d
Initial tests of serial python wrappers with changes to library
sstgfbc Jan 25, 2024
c896e16
fix k distribution
Feb 6, 2024
9746e54
correct a parallel logic error
Feb 6, 2024
49415ec
small changes/cleanup
Feb 6, 2024
e0a4a7c
remove some confusion around m_matrix names
Feb 6, 2024
865bddf
avoid polluting namespace with dp
Feb 6, 2024
6d66178
no need to make kmesh before writing nnkp_file (standalone function)
Feb 8, 2024
f35e8b3
read spinors must preceed read projections
Feb 9, 2024
e9b5f1a
fix svd_omega pllel hang
Feb 9, 2024
ca31306
Revert "comment out c_interface to avoid need for std=f2018"
Feb 11, 2024
39e462c
small changes for handling special vars
Feb 11, 2024
5e0bf8f
add some simple library uses
Feb 11, 2024
b130cc6
regress keyword check change
Feb 12, 2024
a2d6dc3
move some functions out of the library and rename lib functions
Feb 12, 2024
7105370
deactivate c_interface (f90 std)
Feb 13, 2024
8fbd3f9
small bugfix in lib
Feb 13, 2024
e913e23
remove clutter
Feb 14, 2024
7ff6d48
Revert "b-vec search method must allow arbitrary k order"
Feb 14, 2024
1bc809e
fixup
Feb 14, 2024
3ab5b5c
return gkpb
Feb 15, 2024
7737ee2
restore printout parallel/serial
Feb 15, 2024
394b23a
correct nnkp logic
Feb 15, 2024
002704b
update github workflow (remove test of obsolete lib)
Feb 15, 2024
f779f98
remove no-realloc-lhs compiler flag (alloc on assign) in github workflow
Feb 15, 2024
bf36df4
correct logic for nnkp generation
Feb 15, 2024
8e61b0e
close file with delete fails in parallel (problem: .werr left behind)
Feb 15, 2024
57d5621
correctly close stderr
Feb 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add f90wrap example building code to repository
  • Loading branch information
sstgfbc committed Jun 1, 2022
commit 7c987562e581c56eb16837ccd4da5e73ac3caef0
145 changes: 145 additions & 0 deletions wrap/Makefile.mpi
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@

BUILD = ./pobj

include make_mpi.inc

ifeq ($(COMMS),mpi08)
TEMP1 = -DMPI -DMPI08
TEMP2 = $(MPIF90)
else ifeq ($(COMMS),mpih)
TEMP1 = -DMPI -DMPIH
TEMP2 = $(MPIF90)
else ifeq ($(COMMS),mpi90)
TEMP1 = -DMPI -DMPI90
TEMP2 = $(MPIF90)
else ifeq ($(COMMS),mpi)
# default to f90 style "use mpi"
TEMP1 = -DMPI -DMPI90
TEMP2 = $(MPIF90)
else
TEMP1 =
TEMP2 = $(F90)
endif

POSTOPTS = $(TEMP1) -J$(BUILD) -I$(BUILD)
COMPILER = $(TEMP2)

FWRAP = ~/.local/bin/f90wrap
PYMOD = wan90mpi

FPY = f2py

OBJS = $(BUILD)/constants.o $(BUILD)/io.o $(BUILD)/utility.o \
$(BUILD)/types.o $(BUILD)/hamiltonian.o $(BUILD)/overlap.o \
$(BUILD)/kmesh.o $(BUILD)/disentangle.o $(BUILD)/ws_distance.o \
$(BUILD)/wannierise.o $(BUILD)/plot.o $(BUILD)/transport.o \
$(BUILD)/sitesym.o $(BUILD)/comms.o $(BUILD)/wannier90_types.o \
$(BUILD)/wannier90_readwrite.o $(BUILD)/readwrite.o $(BUILD)/error.o \
$(BUILD)/error_base.o $(BUILD)/library_interface.o

WRAPSRC = ../src/constants.F90 ../src/types.F90 ../src/wannier90_readwrite.F90 \
../src/wannier90_types.F90 ../src/comms.F90 ../src/library_interface.F90

DYNLIBRARYEXTENSION ?= so
SHAREDLIBFLAGS ?= -shared

## Define the filename
DYNLIBRARY = libwannier_$(COMMS).$(DYNLIBRARYEXTENSION)

all: $(DYNLIBRARY) wrap python

clean:
rm f90wrap_* $(BUILD)/* cabort.o $(PYMOD).py

wrap: $(WRAPSRC)
$(FWRAP) -m $(PYMOD) -k kind_map $(WRAPSRC)

python: $(DYNLIBRARY) cabort.o
f2py -c -m _$(PYMOD) --f90exec=mpif90 -I$(BUILD) f90wrap_*.f90 cabort.o $(DYNLIBRARY)

$(DYNLIBRARY): $(OBJS) $(LIBOBJS)
$(COMPILER) $(SHAREDLIBFLAGS) $(POSTOPTS) $(LDOPTS) $(LIBOBJS) $(OBJS) -o $@ $(LIBS)

# I expected this to only be needed for f2py-f90wrap, but seems to be wrong
cabort.o: cabort.c
gcc -c -fPIC cabort.c

$(OBJS):
$(COMPILER) $(POSTOPTS) $(FCOPTS) -c -o $@ ../src/$(@F:.o=.F90)

$(BUILD)/constants.o: ../src/constants.F90

$(BUILD)/io.o: ../src/io.F90 $(BUILD)/types.o $(BUILD)/constants.o \
$(BUILD)/types.o

$(BUILD)/utility.o: ../src/utility.F90 $(BUILD)/constants.o $(BUILD)/io.o \
$(BUILD)/comms.o $(BUILD)/error.o

$(BUILD)/wannier90_types.o: ../src/wannier90_types.F90 $(BUILD)/constants.o \
$(BUILD)/io.o

$(BUILD)/wannier90_readwrite.o: ../src/wannier90_readwrite.F90 \
$(BUILD)/constants.o $(BUILD)/io.o $(BUILD)/types.o \
$(BUILD)/wannier90_types.o $(BUILD)/readwrite.o

$(BUILD)/readwrite.o: ../src/readwrite.F90 $(BUILD)/types.o \
$(BUILD)/constants.o $(BUILD)/io.o $(BUILD)/utility.o $(BUILD)/comms.o

$(BUILD)/types.o: ../src/types.F90 $(BUILD)/constants.o

$(BUILD)/hamiltonian.o: ../src/hamiltonian.F90 $(BUILD)/ws_distance.o \
$(BUILD)/constants.o $(BUILD)/io.o $(BUILD)/utility.o $(BUILD)/types.o \
$(BUILD)/wannier90_types.o

$(BUILD)/overlap.o: ../src/overlap.F90 $(BUILD)/constants.o $(BUILD)/io.o \
$(BUILD)/utility.o $(BUILD)/types.o $(BUILD)/sitesym.o \
$(BUILD)/wannier90_types.o $(BUILD)/comms.o $(BUILD)/error.o

$(BUILD)/kmesh.o: ../src/kmesh.F90 $(BUILD)/constants.o $(BUILD)/io.o \
$(BUILD)/utility.o $(BUILD)/types.o

$(BUILD)/error_base.o: ../src/error_base.F90

$(BUILD)/error.o: ../src/error.F90 $(BUILD)/error_base.o $(BUILD)/comms.o

$(BUILD)/disentangle.o: ../src/disentangle.F90 $(BUILD)/constants.o \
$(BUILD)/io.o $(BUILD)/types.o $(BUILD)/sitesym.o $(BUILD)/comms.o \
$(BUILD)/wannier90_types.o

$(BUILD)/wannierise.o: ../src/wannierise.F90 $(BUILD)/hamiltonian.o \
$(BUILD)/constants.o $(BUILD)/io.o $(BUILD)/utility.o $(BUILD)/types.o \
$(BUILD)/sitesym.o $(BUILD)/comms.o $(BUILD)/wannier90_types.o \
$(BUILD)/wannier90_readwrite.o $(BUILD)/error.o

$(BUILD)/plot.o: ../src/plot.F90 $(BUILD)/constants.o $(BUILD)/io.o \
$(BUILD)/utility.o $(BUILD)/types.o $(BUILD)/hamiltonian.o \
$(BUILD)/ws_distance.o $(BUILD)/wannier90_types.o $(BUILD)/comms.o

$(BUILD)/ws_distance.o: ../src/ws_distance.F90 $(BUILD)/constants.o \
$(BUILD)/io.o $(BUILD)/types.o

$(BUILD)/transport.o: ../src/transport.F90 $(BUILD)/constants.o $(BUILD)/io.o \
$(BUILD)/types.o $(BUILD)/hamiltonian.o $(BUILD)/wannier90_types.o

$(BUILD)/sitesym.o : ../src/sitesym.F90 $(BUILD)/utility.o $(BUILD)/types.o \
$(BUILD)/constants.o $(BUILD)/wannier90_types.o

$(BUILD)/comms.o: ../src/comms.F90 $(BUILD)/constants.o $(BUILD)/error_base.o

$(BUILD)/library_interface.o: ../src/library_interface.F90 $(BUILD)/constants.o $(BUILD)/error_base.o \
$(BUILD)/types.o $(BUILD)/wannier90_types.o $(BUILD)/wannier90_readwrite.o $(BUILD)/comms.o


$(BUILD)/f90wrap_constants.o: f90wrap_constants.f90

$(BUILD)/f90wrap_types.o: f90wrap_types.f90

$(BUILD)/f90wrap_comms.o: f90wrap_comms.f90

$(BUILD)/f90wrap_disentangle.o: f90wrap_disentangle.f90

$(BUILD)/f90wrap_wannierise.o: f90wrap_wannierise.f90

$(BUILD)/f90wrap_wannier90_readwrite.o: f90wrap_wannier90_readwrite.f90

$(BUILD)/f90wrap_wannier90_types.o: f90wrap_wannier90_types.f90
149 changes: 149 additions & 0 deletions wrap/Makefile.serial
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@

BUILD = ./sobj

include make_serial.inc

ifdef COMMS
COMMS := $(strip $(COMMS))
else
COMMS = serial
endif

ifeq ($(COMMS),mpi08)
TEMP1 = -DMPI -DMPI08
TEMP2 = $(MPIF90)
else ifeq ($(COMMS),mpih)
TEMP1 = -DMPI -DMPIH
TEMP2 = $(MPIF90)
else ifeq ($(COMMS),mpi90)
TEMP1 = -DMPI -DMPI90
TEMP2 = $(MPIF90)
else ifeq ($(COMMS),mpi)
# default to f90 style "use mpi"
TEMP1 = -DMPI -DMPI90
TEMP2 = $(MPIF90)
else
TEMP1 =
TEMP2 = $(F90)
endif

POSTOPTS = $(TEMP1) -J$(BUILD) -I$(BUILD)
COMPILER = $(TEMP2)

FWRAP = ~/.local/bin/f90wrap
PYMOD = wan90

FPY = f2py

OBJS = $(BUILD)/constants.o $(BUILD)/io.o $(BUILD)/utility.o \
$(BUILD)/types.o $(BUILD)/hamiltonian.o $(BUILD)/overlap.o \
$(BUILD)/kmesh.o $(BUILD)/disentangle.o $(BUILD)/ws_distance.o \
$(BUILD)/wannierise.o $(BUILD)/plot.o $(BUILD)/transport.o \
$(BUILD)/sitesym.o $(BUILD)/comms.o $(BUILD)/wannier90_types.o \
$(BUILD)/wannier90_readwrite.o $(BUILD)/readwrite.o $(BUILD)/error.o \
$(BUILD)/error_base.o $(BUILD)/library_interface.o

WRAPSRC = ../src/constants.F90 ../src/types.F90 ../src/wannier90_readwrite.F90 \
../src/wannier90_types.F90 ../src/comms.F90 ../src/library_interface.F90

DYNLIBRARYEXTENSION ?= so
SHAREDLIBFLAGS ?= -shared

## Define the filename
DYNLIBRARY = libwannier_$(COMMS).$(DYNLIBRARYEXTENSION)

all: $(DYNLIBRARY) wrap python

clean:
rm f90wrap_* $(BUILD)/* cabort.o $(PYMOD).py

wrap: $(WRAPSRC)
$(FWRAP) -m $(PYMOD) -k kind_map $(WRAPSRC)

python: $(DYNLIBRARY) cabort.o
f2py -c -m _$(PYMOD) -I$(BUILD) f90wrap_*.f90 cabort.o $(DYNLIBRARY)

$(DYNLIBRARY): $(OBJS) $(LIBOBJS)
$(COMPILER) $(SHAREDLIBFLAGS) $(POSTOPTS) $(LDOPTS) $(LIBOBJS) $(OBJS) -o $@ $(LIBS)

# I expected this to only be needed for f2py-f90wrap, but seems to be wrong
cabort.o: cabort.c
gcc -c -fPIC abort.c

$(OBJS):
$(COMPILER) $(POSTOPTS) $(FCOPTS) -c -o $@ ../src/$(@F:.o=.F90)

$(BUILD)/constants.o: ../src/constants.F90

$(BUILD)/io.o: ../src/io.F90 $(BUILD)/types.o $(BUILD)/constants.o \
$(BUILD)/types.o

$(BUILD)/utility.o: ../src/utility.F90 $(BUILD)/constants.o $(BUILD)/io.o \
$(BUILD)/comms.o $(BUILD)/error.o

$(BUILD)/wannier90_types.o: ../src/wannier90_types.F90 $(BUILD)/constants.o \
$(BUILD)/io.o

$(BUILD)/wannier90_readwrite.o: ../src/wannier90_readwrite.F90 \
$(BUILD)/constants.o $(BUILD)/io.o $(BUILD)/types.o \
$(BUILD)/wannier90_types.o $(BUILD)/readwrite.o

$(BUILD)/readwrite.o: ../src/readwrite.F90 $(BUILD)/types.o \
$(BUILD)/constants.o $(BUILD)/io.o $(BUILD)/utility.o $(BUILD)/comms.o

$(BUILD)/types.o: ../src/types.F90 $(BUILD)/constants.o

$(BUILD)/hamiltonian.o: ../src/hamiltonian.F90 $(BUILD)/ws_distance.o \
$(BUILD)/constants.o $(BUILD)/io.o $(BUILD)/utility.o $(BUILD)/types.o \
$(BUILD)/wannier90_types.o

$(BUILD)/overlap.o: ../src/overlap.F90 $(BUILD)/constants.o $(BUILD)/io.o \
$(BUILD)/utility.o $(BUILD)/types.o $(BUILD)/sitesym.o \
$(BUILD)/wannier90_types.o $(BUILD)/comms.o $(BUILD)/error.o

$(BUILD)/kmesh.o: ../src/kmesh.F90 $(BUILD)/constants.o $(BUILD)/io.o \
$(BUILD)/utility.o $(BUILD)/types.o

$(BUILD)/error_base.o: ../src/error_base.F90

$(BUILD)/error.o: ../src/error.F90 $(BUILD)/error_base.o $(BUILD)/comms.o

$(BUILD)/disentangle.o: ../src/disentangle.F90 $(BUILD)/constants.o \
$(BUILD)/io.o $(BUILD)/types.o $(BUILD)/sitesym.o $(BUILD)/comms.o \
$(BUILD)/wannier90_types.o

$(BUILD)/wannierise.o: ../src/wannierise.F90 $(BUILD)/hamiltonian.o \
$(BUILD)/constants.o $(BUILD)/io.o $(BUILD)/utility.o $(BUILD)/types.o \
$(BUILD)/sitesym.o $(BUILD)/comms.o $(BUILD)/wannier90_types.o \
$(BUILD)/wannier90_readwrite.o $(BUILD)/error.o

$(BUILD)/plot.o: ../src/plot.F90 $(BUILD)/constants.o $(BUILD)/io.o \
$(BUILD)/utility.o $(BUILD)/types.o $(BUILD)/hamiltonian.o \
$(BUILD)/ws_distance.o $(BUILD)/wannier90_types.o $(BUILD)/comms.o

$(BUILD)/ws_distance.o: ../src/ws_distance.F90 $(BUILD)/constants.o \
$(BUILD)/io.o $(BUILD)/types.o

$(BUILD)/transport.o: ../src/transport.F90 $(BUILD)/constants.o $(BUILD)/io.o \
$(BUILD)/types.o $(BUILD)/hamiltonian.o $(BUILD)/wannier90_types.o

$(BUILD)/sitesym.o : ../src/sitesym.F90 $(BUILD)/utility.o $(BUILD)/types.o \
$(BUILD)/constants.o $(BUILD)/wannier90_types.o

$(BUILD)/comms.o: ../src/comms.F90 $(BUILD)/constants.o $(BUILD)/error_base.o

$(BUILD)/library_interface.o: ../src/library_interface.F90 $(BUILD)/constants.o $(BUILD)/error_base.o \
$(BUILD)/types.o $(BUILD)/wannier90_types.o $(BUILD)/wannier90_readwrite.o $(BUILD)/comms.o


$(BUILD)/f90wrap_constants.o: f90wrap_constants.f90

$(BUILD)/f90wrap_types.o: f90wrap_types.f90

$(BUILD)/f90wrap_disentangle.o: f90wrap_disentangle.f90

$(BUILD)/f90wrap_wannierise.o: f90wrap_wannierise.f90

$(BUILD)/f90wrap_wannier90_readwrite.o: f90wrap_wannier90_readwrite.f90

$(BUILD)/f90wrap_wannier90_types.o: f90wrap_wannier90_types.f90
9 changes: 9 additions & 0 deletions wrap/cabort.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

#include <stdlib.h>
#include <stdio.h>

void f90wrap_abort_()
{
fprintf(stderr, "The program wants to abort\n");
exit(0);
}
11 changes: 11 additions & 0 deletions wrap/kind_map
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
'real': { '': 'float',
'8': 'double',
'dp': 'double'},
'complex' : { '': 'complex_float',
'8': 'complex_double',
'dp': 'complex_double'},
'integer' : { '': 'int',
'8': 'long_long',
'dp': 'long_long' }
}
16 changes: 16 additions & 0 deletions wrap/make_mpi.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#===================
# gfortran
#===================
F90 = gfortran

#Add next two lines for parallel postw90. Choose the correct name of the mpi f90 wrapper
COMMS = mpi90
MPIF90 = mpif90

FCOPTS = -g -O0 -fPIC -Wall -Wextra -fcheck=all -fbacktrace -finit-real=nan -finit-integer=0x7fffffff
LDOPTS = $(FCOPTS)

MODFLAG = -J
#LIBS = -llapack -lblas

LIBS = -Wl,--start-group /opt/intel/compilers_and_libraries/linux/mkl/lib/intel64/libmkl_gf_lp64.a /opt/intel/compilers_and_libraries/linux/mkl/lib/intel64/libmkl_core.a /opt/intel/compilers_and_libraries/linux/mkl/lib/intel64/libmkl_sequential.a -Wl,--end-group -lpthread -ldl
16 changes: 16 additions & 0 deletions wrap/make_serial.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#===================
# gfortran
#===================
F90 = gfortran

#Add next two lines for parallel postw90. Choose the correct name of the mpi f90 wrapper
#COMMS = mpi
#MPIF90 = mpgfortran #mpif90

FCOPTS = -g -O0 -fPIC -Wall -Wextra -fcheck=all -fbacktrace -finit-real=nan -finit-integer=0x7fffffff
LDOPTS = $(FCOPTS)

MODFLAG = -J
#LIBS = -llapack -lblas

LIBS = -Wl,--start-group /opt/intel/compilers_and_libraries/linux/mkl/lib/intel64/libmkl_gf_lp64.a /opt/intel/compilers_and_libraries/linux/mkl/lib/intel64/libmkl_core.a /opt/intel/compilers_and_libraries/linux/mkl/lib/intel64/libmkl_sequential.a -Wl,--end-group -lpthread -ldl