[Wien] wien2wannier and gfortran for complex cases

Elias Assmann elias.assmann at gmail.com
Mon Nov 3 18:19:46 CET 2014


Dear wien2wannier users,

The problem with w2wc and gfortran reported previously appeared because 
the makefile did not keep the real and complex module files separate.

I include a detailed explanation below, but the easy fix is to compile 
the complex version before the real one, i.e.

=======

cd $WIENROOT/SRC_w2w
make clean
make complex
make real
cp -v w2w{,c} ..

cd ../SRC_wplot
make clean
make complex
make real
cp -v wplot{,c} ..

=======

If this fix does not work for you, please report.

‘wplot’ should also be affected because it uses the same real/complex 
system.  The problem was (probably) introduced with the first 1.0-beta 
version.

Detailed explanation: The source files that do not differentiate between 
real and complex are compiled with

    gfortran -Ilib -c $OBJ.f -olib/$OBJ.o -J lib

the “complex” ones with

    gfortran -Ilib -c $OBJ.F -olibc/$OBJ.o -J libc -D_COMPLEX_

but the “real” ones are compiled with

    gfortran -c $OBJ.F -olibr/latgen.o -J lib

instead of -Jlibr.

This means that the ‘.mod’ files for the “real” modules end up in lib/ 
instead of libr/.  If they are already there, they are then used in 
compiling the complex executable, which is inconsistent.  Unfortunately, 
the compiler does not catch this problem.  As for ifort, it is the same 
in principle (just replace -J by -module), but it seems that ifort does 
not mind the inconsistent ‘.mod’s, or maybe it uses the correct ones by 
chance or design.

I tested all of this with gcc 4.8.2.


	Elias


PS: Should this be considered a bug in gfortran?  I am wondering if I 
should submit a bug report.

-- 
Elias Assmann (TU Wien)

Wien2Wannier: maximally localized Wannier functions
               from linearized augmented plane waves

<http://www.ifp.tuwien.ac.at/forschung/arbeitsgruppen/cms/software-download/wien2wannier/> 



More information about the Wien mailing list