Closed MIraola closed 4 months ago
Hi @MIraola
I would suggest you fix all 'F' problems that flake8 detects. Mostly it is just removing unnecessary imports, but one should be careful, sometimes it can signal a bug, for example if a variable is assigned and never used, there might be a typo in that variable, or you forgot to do something that should have been done.
See here:
stepan@stepan-desktop:~/github/irrep/irrep$ flake8 --select=F
./bandstructure.py:25:1: F401 '.utility.str2bool' imported but unused
./bandstructure.py:25:1: F401 '.utility.BOHR' imported but unused
./bandstructure.py:25:1: F401 '.utility.split' imported but unused
./bandstructure.py:26:1: F401 '.readfiles.Hartree_eV' imported but unused
./bandstructure.py:27:1: F401 '.readfiles.WAVECARFILE' imported but unused
./bandstructure.py:191:21: F841 local variable 'IBstartE' is assigned to but never used
./bandstructure.py:700:9: F841 local variable 'nmax' is assigned to but never used
./cli.py:22:1: F401 'sys' imported but unused
./cli.py:24:1: F401 'datetime' imported but unused
./cli.py:25:1: F401 'math' imported but unused
./cli.py:30:1: F401 '.spacegroup.SpaceGroup' imported but unused
./cli.py:32:1: F401 '.utility.str2bool' imported but unused
./cli.py:336:9: F841 local variable 'preline' is assigned to but never used
./cli.py:408:17: F841 local variable 'plotfile' is assigned to but never used
./gvectors.py:232:5: F841 local variable 'npw1' is assigned to but never used
./gvectors.py:321:21: F523 '...'.format(...) has unused arguments at position(s): 0
./gvectors.py:321:21: F524 '...'.format(...) is missing argument(s) for placeholder(s): other
./gvectors.py:322:29: F821 undefined name 'other'
./kpoint.py:22:1: F401 '.gvectors.calc_gvectors' imported but unused
./kpoint.py:22:1: F401 '.gvectors.sortIG' imported but unused
./kpoint.py:23:1: F401 '.readfiles.Hartree_eV' imported but unused
./kpoint.py:24:1: F401 '.readfiles.record_abinit' imported but unused
./kpoint.py:26:1: F401 'scipy.io.FortranFile as FF' imported but unused
./kpoint.py:161:17: F841 local variable 'err' is assigned to but never used
./kpoint.py:764:75: F821 undefined name 'd'
./kpoint.py:783:29: F821 undefined name 'preline'
./readfiles.py:327:24: F841 local variable 'occ' is assigned to but never used
./readfiles.py:373:9: F841 local variable 'title' is assigned to but never used
./readfiles.py:468:9: F841 local variable 'err' is assigned to but never used
./readfiles.py:487:9: F841 local variable 'nat' is assigned to but never used
./readfiles.py:604:21: F841 local variable 'j' is assigned to but never used
./spacegroup.py:561:9: F841 local variable 'nsym' is assigned to but never used
./spacegroup.py:690:13: F841 local variable 'write_ref' is assigned to but never used
./spacegroup.py:876:9: F841 local variable 'nmax' is assigned to but never used
./spacegroup.py:936:21: F841 local variable 'err' is assigned to but never used
./spacegroup.py:1037:13: F841 local variable 'found' is assigned to but never used
./spacegroup.py:1159:9: F841 local variable 'errtxt' is assigned to but never used
./tests/test_abinit_scalar.py:4:1: F401 'monty.serialization.dumpfn' imported but unused
./tests/test_abinit_spinor.py:4:1: F401 'monty.serialization.dumpfn' imported but unused
./tests/test_espresso_spinor.py:4:1: F401 'monty.serialization.dumpfn' imported but unused
./tests/test_refUC.py:4:1: F401 'monty.serialization.dumpfn' imported but unused
./tests/test_symsep.py:4:1: F401 'monty.serialization.dumpfn' imported but unused
./tests/test_vasp_scalar.py:4:1: F401 'monty.serialization.dumpfn' imported but unused
./tests/test_vasp_spinor.py:4:1: F401 'monty.serialization.dumpfn' imported but unused
./tests/test_wannier_scalar.py:4:1: F401 'monty.serialization.dumpfn' imported but unused
./tests/test_wannier_spinor.py:4:1: F401 'monty.serialization.dumpfn' imported but unused
Hi @stepan-tsirkin ,
thank you for the recommendation. I have fixed the F errors of flake8 as you suggested. There is an error left which is in the WCC routines; I am pretty sure that removing it will do nothing, but I leave it since I try not to do changes to this routines until we fully test them.
The flake8 is really helpful and it works very well! I will use it from now on.
I have...
save_wf
of BandStructure
and Kpoint
. By default: (1) in the CLI, WFs will be saved only if isymsep
, ZAK
or WCC
were specified, removed otherwise. (2) If BandStructure
or Kpoint
are called in a Jupyter-notebook, WFs will be kept in memory.calculate_traces
is True
)Done, thanks!
I agree, we can address the remaining issues in smaller and more dedicated PRs.
This is a PR which implements several modifications to the code. The code has been tested for all DFT codes and the compatibility with
banduppy
has been checked. Of course, we can never discard completely the potential existence of bugs.Summary of changes
pytest
) for QE and for the separation of bands in terms of symmetry eigenvalues.Simplification of the structure
The code is now separated clearly into 3 steps: parsing, processing, outputting.
Parsing: The routines for parsing are in the
readfiles.py
file and each DFT code has its own parsing class. All parsing class have a similar structure: each method parses a different input data file.Processing: The Kpoint class is made general, i.e. independent of the DFT code.
Outputting: methods dedicated exclusively to printing data and to constructing JSON dictionaries with the data have been created. The formatting of some data has been improved.
To do:
BandStructure
should inheritSpaceGroup
isymsep
,wcc
andzak
are False.zak
andwcc
. Currently, we do not consider them stable functions!