Dear Wannier90 list,
for some reasons, I tried to use gw stuff from yambo with wannier and I
also needed spins.
I need to use the spn formatted option, since I am too stupid (or lazy)
to install the python package for FortranFile on the cluster.
So I tried to run gw2wannier90.py from the utility folder using spn
output with spn_formatted.
I ran into several issues and I am really wondering, if the spn
formatted output was tested.
Anyway I made a patch and I would be glad, if someone can look over it
(who has reference data for the unformatted option for testing)
and could integrate it.
(Special care necessary, since I can write in several programming
languages but not in python and I do not have really much data to check
the correct behaviour).
I hope, that this is the right mailing list.
Regards,
Marten Richter
--
------------------------------------------------------------
Dr. Marten Richter
Institut für Theoretische Physik
Technische Universität Berlin
Hardenbergstr. 36 Sekr. EW 7-1
D-10623 Berlin
Germany
------------------------------------------------------------
email: [email protected]
Tel: +49-30-314-24858 (office)
Fax: +49-30-314-21130
http://www.itp.TU-Berlin.DE/knorr/
------------------------------------------------------------
--- wannier/wannier90-3.0.0/utility/gw2wannier90.py 2019-02-27 15:28:29.000000000 +0100
+++ gw2wannier90.py 2019-09-26 12:12:19.336909411 +0200
@@ -297,6 +297,7 @@ if calcSPN:
f_spn_out.write(header)
nbnd,NK=np.array(f_spn_in.readline().split(),dtype=np.int32)
f_spn_out.write(" ".join(str(x) for x in (NBND,NKPT) ) )
+ f_spn_out.write("\n")
else:
f_spn_in = FortranFile(seedname+".spn", 'r')
f_spn_out = FortranFile(seednameGW+".spn", 'w')
@@ -313,24 +314,25 @@ if calcSPN:
indmQP,indnQP=np.tril_indices(NBND)
if SPNformatted:
- SPN=np.loadtxt(f_spn_in).reshape(-1)
+ SPN=np.loadtxt(f_spn_in).view(complex).reshape(-1)
+ print(SPN)
start=0
length=(3*nbnd*(nbnd+1))/2
for ik in xrange(NK):
+ A=np.zeros((3,nbnd,nbnd),dtype=np.complex)
if SPNformatted:
- A=SPN[start:start+length]
+ A[:,indn,indm]=SPN[start:start+length].reshape(3,nbnd*(nbnd+1)/2,order='F')
start+=length
else:
- A=np.zeros((3,nbnd,nbnd),dtype=np.complex)
- A[:,indn,indm]=f_spn_in.read_record(dtype=np.complex).reshape(3,nbnd*(nbnd+1)/2,order='F')
+ A[:,indn,indm]=f_spn_in.read_record(dtype=np.complex).reshape(3,nbnd*(nbnd+1)/2,order='F')
A[:,indm,indn]=A[:,indn,indm].conj()
check=np.einsum('ijj->',np.abs(A.imag))
if check> 1e-10:
raise RuntimeError ( "REAL DIAG CHECK FAILED for spn: {0}".format(check) )
A=A[:,:,BANDSORT[ik]][:,BANDSORT[ik],:][:,indnQP,indmQP].reshape((3*NBND*(NBND+1)/2),order='F')
- if formatted:
- f_spn_out.write("".join("{0:26:16e} {1:26:16e}\n".format(x.real,x.imag) for x in A))
+ if SPNformatted:
+ f_spn_out.write("".join("{0:26.16e} {1:26.16e}\n".format(x.real,x.imag) for x in A))
else:
f_spn_out.write_record(A)
_______________________________________________
Wannier mailing list
[email protected]
https://lists.quantum-espresso.org/mailman/listinfo/wannier