[Wannier] Problems with SPN formatted and gw2wannier.py
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: marten.rich...@tu-berlin.de 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.0 +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 Wannier@lists.quantum-espresso.org https://lists.quantum-espresso.org/mailman/listinfo/wannier
Re: [Wannier] Wannier90 and quantum espresso and spin orbit coupling
Dear Hyungjun Lee, thank you for spotting this. It works now much better... a spread of 38 in the first iteration, which is very close to final value around 37. Thank you, Marten Am 27.08.19 um 15:25 schrieb H. Lee: Dear Marten: If I remember correctly, I obtained very small spreads for all Wannier functions (WFs) even at the first iteration for monolayer MoS2. The only differences from your inputs are: (1) diagon='davidson' (2) use of NC or USPP for pseudo potentials, but I thought that they are not important. I thought that very large spreads for some WFs at the first iteration in your case signals some problem. So I checked your inputs and outputs again and found that you made a mistake in specifying the atomic coordinates in mos2.win; replace "atom_frac" with "atom_cart" in mos2.win That is, you started from very bad initial projections. The fact that the minimisation was slower in case of precond=T tells us that in your case preconditioning can't improve convergence; maybe you have to change some parameter (alpha?) in wannierise.F90 (see the source code.) Sincerely, Hyungjun Lee On Tue, Aug 27, 2019 at 5:29 PM Marten Richter mailto:marten.rich...@tu-berlin.de>> wrote: Dear Hyungjun Lee, I have uploaded the files https://gigamove.rz.rwth-aachen.de/d/id/vn482q3t4NHEeU please not that they use a different quantum espresso run than the files provided before (higher cut off energy). But it does not change the overall behaviour. Thanks, Marten Am 27.08.19 um 07:55 schrieb H. Lee: Dear Marten Richter: Preconditioning in Wannier90 just filters the components in the gradient due to the large lattice vectors and it does not always improve convergence; in some cases, it worsens the convergence. I want to know the final spreads of all Wannier functions (WFs) for the cases of (1) precond=T and (2) precond=F. (in your case, the 14th WF still has the large spread of 7.8) Additionally, could you upload amn and mmn files? Sincerely, Hyungjun Lee On Mon, Aug 26, 2019 at 9:38 PM Marten Richter mailto:marten.rich...@tu-berlin.de>> wrote: Dear Marco, I have found a solution. Besides the missing guiding_centres = .true., I have now set precond = false . This seems to have caused the problems, I am wondering why it affected only one spin or was this a coincidence? Thanks, Marten Am 22.08.19 um 15:27 schrieb Marten Richter: Dear Marco, I have now rerun the calculation with guiding_centres = .true. . Here is the wout https://gigamove.rz.rwth-aachen.de/d/id/VU8FWXMMrYgyS9 for download. The spread is much smaller, however it seems as if the algorithm is restarting since the spread went up several times. The band along the kpath does look ok, even though the conduction band SO splitting seems to be too small. Using an interpolation from my code I still get distortions (see surface plot) at singular points. Is it possible, that single points from the underlying DFT are broken? I have compared my input files cutoff energy and it is smaller than yours, can this be the problem? Thank you very much, Marten Am 21.08.19 um 10:39 schrieb Gibertini Marco: Dear Marten, I did almost identical calculations few years back (see PRB 90, 245411 (2014) <https://journals.aps.org/prb/abstract/10.1103/PhysRevB.90.245411>) without any issue. Since I still have all data from Quantum ESPRESSO (.mmn, .amn, .eig, .spn), I tried to perform again the wannierization and interpolation using the most recent version of Wannier90 to check that no bug was introduced in the meantime. I got exactly the same results as in 2014, so I would rule out problems with Wannier90. The issue might then arise from pw2wannier90 (that I haven't checked yet) or from your inputs. In this respect, a crucial difference I see with respect to my input (which is otherwise almost identical to yours, apart that I use a 12x12x1 k-grid) is that you don't use guiding_centres = .true. For 2D materials centred in the middle of the unit cell along the vertical direction (as in your case) the wannierization can go nuts with guiding_centres = .false. (which is the default value). Have you checked that the spreads look reasonable? Can you send me the .wout? Please, try to see if guiding_centres = .true. solves your problems. If not, we'll investigate further. Hope this helps! Marco -- Marco Gibertini Post-doct
Re: [Wannier] Wannier90 and quantum espresso and spin orbit coupling
Dear Hyungjun Lee, I have uploaded the files https://gigamove.rz.rwth-aachen.de/d/id/vn482q3t4NHEeU please not that they use a different quantum espresso run than the files provided before (higher cut off energy). But it does not change the overall behaviour. Thanks, Marten Am 27.08.19 um 07:55 schrieb H. Lee: Dear Marten Richter: Preconditioning in Wannier90 just filters the components in the gradient due to the large lattice vectors and it does not always improve convergence; in some cases, it worsens the convergence. I want to know the final spreads of all Wannier functions (WFs) for the cases of (1) precond=T and (2) precond=F. (in your case, the 14th WF still has the large spread of 7.8) Additionally, could you upload amn and mmn files? Sincerely, Hyungjun Lee On Mon, Aug 26, 2019 at 9:38 PM Marten Richter mailto:marten.rich...@tu-berlin.de>> wrote: Dear Marco, I have found a solution. Besides the missing guiding_centres = .true., I have now set precond = false . This seems to have caused the problems, I am wondering why it affected only one spin or was this a coincidence? Thanks, Marten Am 22.08.19 um 15:27 schrieb Marten Richter: Dear Marco, I have now rerun the calculation with guiding_centres = .true. . Here is the wout https://gigamove.rz.rwth-aachen.de/d/id/VU8FWXMMrYgyS9 for download. The spread is much smaller, however it seems as if the algorithm is restarting since the spread went up several times. The band along the kpath does look ok, even though the conduction band SO splitting seems to be too small. Using an interpolation from my code I still get distortions (see surface plot) at singular points. Is it possible, that single points from the underlying DFT are broken? I have compared my input files cutoff energy and it is smaller than yours, can this be the problem? Thank you very much, Marten Am 21.08.19 um 10:39 schrieb Gibertini Marco: Dear Marten, I did almost identical calculations few years back (see PRB 90, 245411 (2014) <https://journals.aps.org/prb/abstract/10.1103/PhysRevB.90.245411>) without any issue. Since I still have all data from Quantum ESPRESSO (.mmn, .amn, .eig, .spn), I tried to perform again the wannierization and interpolation using the most recent version of Wannier90 to check that no bug was introduced in the meantime. I got exactly the same results as in 2014, so I would rule out problems with Wannier90. The issue might then arise from pw2wannier90 (that I haven't checked yet) or from your inputs. In this respect, a crucial difference I see with respect to my input (which is otherwise almost identical to yours, apart that I use a 12x12x1 k-grid) is that you don't use guiding_centres = .true. For 2D materials centred in the middle of the unit cell along the vertical direction (as in your case) the wannierization can go nuts with guiding_centres = .false. (which is the default value). Have you checked that the spreads look reasonable? Can you send me the .wout? Please, try to see if guiding_centres = .true. solves your problems. If not, we'll investigate further. Hope this helps! Marco -- Marco Gibertini Post-doctoral Research Scientist Theory and Simulation of Materials École Polytechnique Fédérale de Lausanne On 8/20/19 11:47 AM, Marten Richter wrote: Dear Wannier90 experts, I am relatively new to Wannier90 and also Quantum Espresso, but I need for development some example file for monolayer MoS2 including Spin Orbit coupling. I will use the files generated by Wannier90 to interpolate the bandstructure and TB coefficients to a 1024x1024 grid using a custom code (needs to be 2^n points). I used files from www.materialscloud.org <http://www.materialscloud.org> as basis for the calculation I only replaced the pseudo potentials with relativistic potentials and I increased the cutoff energy, since I get otherwise non positive S in quantum espresso. My problem is, that one Spin component behaves fine and the other one shows strong oscillations around the gamma point. (visible the bandstructure plotted by my code, but also in the wannier post processing plot, both attached). It gets better for more iterations, but what is the reason for the poor convergence. I hope, this is the right list, since it might be also a problem with quantum espresso, but I did not want to cross post. Thank you very much in advance! Best regards, Marten Richter -------- Dr. Marten Richter Institut für Theoretische Physik Technische Universität Berlin Hardenbergstr. 36 Sekr. EW 7-1
Re: [Wannier] Wannier90 and quantum espresso and spin orbit coupling
Dear Marco, I have found a solution. Besides the missing guiding_centres = .true., I have now set precond = false . This seems to have caused the problems, I am wondering why it affected only one spin or was this a coincidence? Thanks, Marten Am 22.08.19 um 15:27 schrieb Marten Richter: Dear Marco, I have now rerun the calculation with guiding_centres = .true. . Here is the wout https://gigamove.rz.rwth-aachen.de/d/id/VU8FWXMMrYgyS9 for download. The spread is much smaller, however it seems as if the algorithm is restarting since the spread went up several times. The band along the kpath does look ok, even though the conduction band SO splitting seems to be too small. Using an interpolation from my code I still get distortions (see surface plot) at singular points. Is it possible, that single points from the underlying DFT are broken? I have compared my input files cutoff energy and it is smaller than yours, can this be the problem? Thank you very much, Marten Am 21.08.19 um 10:39 schrieb Gibertini Marco: Dear Marten, I did almost identical calculations few years back (see PRB 90, 245411 (2014) <https://journals.aps.org/prb/abstract/10.1103/PhysRevB.90.245411>) without any issue. Since I still have all data from Quantum ESPRESSO (.mmn, .amn, .eig, .spn), I tried to perform again the wannierization and interpolation using the most recent version of Wannier90 to check that no bug was introduced in the meantime. I got exactly the same results as in 2014, so I would rule out problems with Wannier90. The issue might then arise from pw2wannier90 (that I haven't checked yet) or from your inputs. In this respect, a crucial difference I see with respect to my input (which is otherwise almost identical to yours, apart that I use a 12x12x1 k-grid) is that you don't use guiding_centres = .true. For 2D materials centred in the middle of the unit cell along the vertical direction (as in your case) the wannierization can go nuts with guiding_centres = .false. (which is the default value). Have you checked that the spreads look reasonable? Can you send me the .wout? Please, try to see if guiding_centres = .true. solves your problems. If not, we'll investigate further. Hope this helps! Marco -- Marco Gibertini Post-doctoral Research Scientist Theory and Simulation of Materials École Polytechnique Fédérale de Lausanne On 8/20/19 11:47 AM, Marten Richter wrote: Dear Wannier90 experts, I am relatively new to Wannier90 and also Quantum Espresso, but I need for development some example file for monolayer MoS2 including Spin Orbit coupling. I will use the files generated by Wannier90 to interpolate the bandstructure and TB coefficients to a 1024x1024 grid using a custom code (needs to be 2^n points). I used files from www.materialscloud.org as basis for the calculation I only replaced the pseudo potentials with relativistic potentials and I increased the cutoff energy, since I get otherwise non positive S in quantum espresso. My problem is, that one Spin component behaves fine and the other one shows strong oscillations around the gamma point. (visible the bandstructure plotted by my code, but also in the wannier post processing plot, both attached). It gets better for more iterations, but what is the reason for the poor convergence. I hope, this is the right list, since it might be also a problem with quantum espresso, but I did not want to cross post. Thank you very much in advance! Best 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:marten.rich...@tu-berlin.de Tel: +49-30-314-24858 (office) Fax: +49-30-314-21130 http://www.itp.TU-Berlin.DE/knorr/ File for scf calculation calculation = 'scf' outdir = './' prefix = 'mos2' pseudo_dir = './' restart_mode = 'from_scratch' verbosity = 'high' / degauss = 2.00d-02 ecutrho = 3.00d+02 ecutwfc = 4.3750d+01 ! ecutrho = 2.40d+02 ! ecutwfc = 3.50d+01 !! ecutrho = 4.80d+02 !! ecutwfc = 7.00d+01 assume_isolated = '2D' ibrav = 0 nat = 3 ntyp = 2 occupations = 'smearing' smearing = 'cold' noncolin = .true. lspinorb = .true. / conv_thr = 3.00d-09 diago_full_acc = .true. diagonalization = 'cg' electron_maxstep = 100 / ATOMIC_SPECIES Mo 95.94 Mo.rel-pbe-spn-kjpaw_psl.1.0.0.UPF S 32.066 S.rel-pbe-nl-kjpaw_psl.1.0.0.UPF ATOMIC_POSITIONS angstrom Mo 0.00 1.8406963043 11.5773510440 S1.5940897602 0.9203481522 10.0188259936 S1.5940897602 0.9203