This repository was archived by the owner on Jun 30, 2025. It is now read-only.
This repository was archived by the owner on Jun 30, 2025. It is now read-only.
Handyman: Negative number of states #1240
Closed
Description
ValueError Traceback (most recent call last)
Cell In[13], line 1
----> 1 pstruct.run(struct_pr, conf, tries=5, wait=10*60)
File ~/projects/pyiron_potentialfit/pyiron_potentialfit/assyst/structures/workflow.py:214, in run(pr, config, tries, wait)
209 with warnings.catch_warnings():
210 warnings.filterwarnings(
211 "ignore",
212 message="'KSPACING' found in INCAR, no KPOINTS file written",
213 )
--> 214 state = create_structure_set(pr, state, config, fast_forward=True)
215 pr.data.state = state.value
216 pr.data.write()
File ~/projects/pyiron_potentialfit/pyiron_potentialfit/assyst/structures/workflow.py:152, in create_structure_set(pr, state, conf, fast_forward)
150 try:
151 cont = pr["containers"].load(f"{conf.name}VolMin")
--> 152 minimize(
153 pr,
154 cont,
155 "all",
156 conf.trace,
157 conf.min_dist,
158 conf.vasp,
159 conf.server,
160 conf.workflow,
161 )
162 except RunAgain:
163 return state
File ~/projects/pyiron_potentialfit/pyiron_potentialfit/assyst/structures/minimize.py:242, in minimize(pr, cont, degrees_of_freedom, trace, min_dist, vasp, server, workflow)
239 cont.copy_to(pr["containers"], new_job_name=flow.project.name)
240 return cont
--> 242 return minf.check(
243 workflow, if_new, if_finished, number_of_jobs=cont.number_of_structures
244 )
File ~/projects/pyiron_potentialfit/pyiron_potentialfit/assyst/projectflow.py:313, in ProjectFlow.check(self, config, if_new, if_finished, number_of_jobs)
311 logger.info("found aborted jobs; calling the handy man!")
312 hm = HandyMan(suppress_fix_errors=False)
--> 313 cs = hm.fix_project(self.project)
314 logger.info("repair stats:")
315 for tool, l in cs.fixing.items():
File ~/projects/pyiron_contrib/pyiron_contrib/repair/__init__.py:290, in HandyMan.fix_project(self, project, server_override, refresh, graveyard, **kwargs)
288 fixing[type(tool).__name__].append(job.id)
289 if not tool.fix_inplace(job, self):
--> 290 job = self.fix_job(tool, job, graveyard=graveyard)
291 for k, v in server_override.items():
292 setattr(job.server, k, v)
File ~/projects/pyiron_contrib/pyiron_contrib/repair/__init__.py:188, in HandyMan.fix_job(self, tool, job, graveyard)
185 new_job["user/handyman/history"] = history
187 try:
--> 188 tool.fix(job, new_job)
189 except Exception as e:
190 if self._suppress_errors:
File ~/projects/pyiron_contrib/pyiron_contrib/repair/__init__.py:435, in VaspNbandsTool.fix(self, old_job, new_job)
433 n_elect = old_job.get_nelect()
434 # double free states
--> 435 new_job.set_empty_states(
436 math.ceil((old_states - n_elect // 2) * self._state_factor)
437 )
439 try:
440 new_job.restart_file_list.append(str(old_job.files.CHGCAR))
File /cmmc/ptmp/janj/mambaforge/lib/python3.12/site-packages/pyiron_atomistics/vasp/base.py:1346, in VaspBase.set_empty_states(self, n_empty_states)
1344 if n_empty_states is not None:
1345 if n_empty_states < 0:
-> 1346 raise ValueError(
1347 f"Number of empty states must be a positive integer or zero, not {n_empty_states}!"
1348 )
1349 self.input.incar["NBANDS"] = int(round(n_elect / 2)) + int(n_empty_states)
ValueError: Number of empty states must be a positive integer or zero, not -3!
The old number of states was 1
the n_elect
was 6
and the resulting number of states is negative. A short work around is just using the np.abs()
of the states.
Metadata
Metadata
Assignees
Labels
No labels