@@ -624,6 +624,8 @@ def converged_electronic(self) -> bool:
624624 while set (final_elec_steps [idx ]) == to_check :
625625 idx += 1
626626 return idx + 1 != self .parameters ["NELM" ]
627+ if self .incar .get ("ALGO" , "" ).upper () == "EXACT" and self .incar .get ("NELM" ) == 1 :
628+ return True
627629 return len (final_elec_steps ) < self .parameters ["NELM" ]
628630
629631 @property
@@ -1699,8 +1701,10 @@ def __init__(
16991701 self .separate_spins = separate_spins
17001702
17011703 with zopen (filename , mode = "rt" ) as file :
1702- self .efermi = self .eigenvalues = self .projected_eigenvalues = None
1703- parsed_header = in_kpoints_opt = False
1704+ self .efermi = None
1705+ parsed_header = False
1706+ in_kpoints_opt = False
1707+ self .eigenvalues = self .projected_eigenvalues = None
17041708 self .kpoints_opt_props = None
17051709 for event , elem in ET .iterparse (file , events = ["start" , "end" ]):
17061710 tag = elem .tag
@@ -1980,7 +1984,10 @@ def __init__(self, filename: PathLike) -> None:
19801984
19811985 # For single atom systems, VASP doesn't print a total line, so
19821986 # reverse parsing is very difficult
1983- read_charge = read_mag_x = read_mag_y = read_mag_z = False # for SOC calculations only
1987+ read_charge = False
1988+ read_mag_x = False
1989+ read_mag_y = False # for SOC calculations only
1990+ read_mag_z = False
19841991 all_lines .reverse ()
19851992 for clean in all_lines :
19861993 if read_charge or read_mag_x or read_mag_y or read_mag_z :
@@ -1999,7 +2006,10 @@ def __init__(self, filename: PathLike) -> None:
19992006 elif read_mag_z :
20002007 mag_z .append (dict (zip (header , tokens , strict = True )))
20012008 elif clean .startswith ("tot" ):
2002- read_charge = read_mag_x = read_mag_y = read_mag_z = False
2009+ read_charge = False
2010+ read_mag_x = False
2011+ read_mag_y = False
2012+ read_mag_z = False
20032013 if clean == "total charge" :
20042014 charge = []
20052015 read_charge = True
@@ -2486,8 +2496,10 @@ def read_cs_core_contribution(self) -> None:
24862496 self .data ["cs_core_contribution" ] = core_contrib
24872497
24882498 def read_cs_raw_symmetrized_tensors (self ) -> None :
2489- """Parse the matrix form of NMR tensor before corrected to table
2490- and set as self.data["unsym_cs_tensor"].
2499+ """Parse the matrix form of NMR tensor before corrected to table.
2500+
2501+ Returns:
2502+ nsymmetrized tensors list in the order of atoms.
24912503 """
24922504 header_pattern = r"\s+-{50,}\s+\s+Absolute Chemical Shift tensors\s+\s+-{50,}$"
24932505 first_part_pattern = r"\s+UNSYMMETRIZED TENSORS\s+$"
@@ -3475,7 +3487,8 @@ def parse_file(filename: PathLike) -> tuple[Poscar, dict, dict]:
34753487 dim : list [int ] = []
34763488 dimline = ""
34773489 read_dataset = False
3478- ngrid_pts = data_count = 0
3490+ ngrid_pts = 0
3491+ data_count = 0
34793492 poscar = None
34803493 with zopen (filename , mode = "rt" ) as file :
34813494 for line in file :
@@ -3941,13 +3954,16 @@ def _read(self, filename: PathLike, parsed_kpoints: set[tuple[Kpoint]] | None =
39413954 ion_expr = re .compile (r"^ion.*" )
39423955 total_expr = re .compile (r"^tot.*" )
39433956 expr = re .compile (r"^([0-9]+)\s+" )
3944- current_kpoint = current_band = 0
3957+ current_kpoint = 0
3958+ current_band = 0
39453959 spin = Spin .down # switched to Spin.up for first block
39463960
39473961 n_kpoints = None
39483962 kpoints : list [tuple [float , float , float ]] = []
3949- n_bands = n_ions = headers = None
3963+ n_bands = None
3964+ n_ions = None
39503965 weights : np .ndarray [float ] | None = None
3966+ headers = None
39513967 data : dict [Spin , np .ndarray ] = {}
39523968 eigenvalues : dict [Spin , np .ndarray ] | None = None
39533969 occupancies : dict [Spin , np .ndarray ] | None = None
@@ -3960,7 +3976,8 @@ def _read(self, filename: PathLike, parsed_kpoints: set[tuple[Kpoint]] | None =
39603976
39613977 # first dynamically determine whether PROCAR is SOC or not; SOC PROCARs have 4 lists of projections (
39623978 # total and x,y,z) for each band, while non-SOC have only 1 list of projections:
3963- tot_count = band_count = 0
3979+ tot_count = 0
3980+ band_count = 0
39643981 for line in file_handle :
39653982 if total_expr .match (line ):
39663983 tot_count += 1
@@ -4516,7 +4533,8 @@ def get_str(
45164533 lines .extend ((" " .join (self .site_symbols ), " " .join (map (str , self .natoms ))))
45174534
45184535 format_str = f"{{:.{ significant_figures } f}}"
4519- ionicstep_cnt = output_cnt = 1
4536+ ionicstep_cnt = 1
4537+ output_cnt = 1
45204538 for cnt , structure in enumerate (self .structures , start = 1 ):
45214539 ionicstep_cnt = cnt
45224540 if (
@@ -5137,7 +5155,7 @@ def get_parchg(
51375155
51385156 # Scaling of ng for the fft grid, need to restore value at the end
51395157 temp_ng = self .ng
5140- self .ng = self .ng * scale # (ruff-preview) noqa: PLR6104
5158+ self .ng = self .ng * scale
51415159 N = np .prod (self .ng )
51425160
51435161 data = {}
0 commit comments