pyiron / pyiron_atomistics

pyiron_atomistics - an integrated development environment (IDE) for atomistic simulation in computational materials science.
https://pyiron-atomistics.readthedocs.io
BSD 3-Clause "New" or "Revised" License
43 stars 15 forks source link

Always overwrite eigenvalues #1419

Open samwaseda opened 4 months ago

samwaseda commented 4 months ago

Problem mentioned here

skatnagallu commented 1 month ago

Can we merge this?

samwaseda commented 1 month ago

It looks like the tests had been failing but the log doesn’t get shown, so I run them again with the latest version. If the tests pass, I think we can merge it.

samwaseda commented 1 month ago

It looks like depending on the source the shape of the array is not the same. Do you want to look into it? @skatnagallu

skatnagallu commented 1 month ago

It looks like depending on the source the shape of the array is not the same. Do you want to look into it? @skatnagallu

yep will do

coveralls commented 1 month ago

Pull Request Test Coverage Report for Build 10502979427

Details


Files with Coverage Reduction New Missed Lines %
pyiron_atomistics/sphinx/base.py 2 80.13%
<!-- Total: 2 -->
Totals Coverage Status
Change from base Build 10469606254: 0.005%
Covered Lines: 10680
Relevant Lines: 15056

💛 - Coveralls
skatnagallu commented 1 month ago

I am not sure if the current failing Notebook has anything to do with this PR

jan-janssen commented 1 month ago

@skatnagallu I am rather sure it has:

---------------------------------------------------------------------------
Exception encountered at "In [12]":
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[12], line 6
      4 lmp = pr.create_job(pr.job_type.Sphinx, "static")
      5 lmp.structure = pr.create_structure("Fe", "bcc", 2.55)
----> 6 lmp.run()  # The job static was saved and received the ID: 2

File /usr/share/miniconda3/envs/my-env/lib/python3.12/site-packages/pyiron_snippets/deprecate.py:158, in Deprecator.__deprecate_argument.<locals>.decorated(*args, **kwargs)
    148     if kw in self.arguments:
    149         warnings.warn(
    150             message_format.format(
    151                 "{}.{}({}={})".format(
   (...)
    156             stacklevel=2,
    157         )
--> 158 return function(*args, **kwargs)

File /usr/share/miniconda3/envs/my-env/lib/python3.12/site-packages/pyiron_base/jobs/job/generic.py:880, in GenericJob.run(self, delete_existing_job, repair, debug, run_mode, run_again)
    878     self._run_if_repair()
    879 elif status == "initialized":
--> 880     self._run_if_new(debug=debug)
    881 elif status == "created":
    882     self._run_if_created()

File /usr/share/miniconda3/envs/my-env/lib/python3.12/site-packages/pyiron_base/jobs/job/generic.py:1395, in GenericJob._run_if_new(self, debug)
   1387 def _run_if_new(self, debug=False):
   1388     """
   1389     Internal helper function the run if new function is called when the job status is 'initialized'. It prepares
   1390     the hdf5 file and the corresponding directory structure.
   (...)
   1393         debug (bool): Debug Mode
   1394     """
-> 1395     run_job_with_status_initialized(job=self, debug=debug)

File /usr/share/miniconda3/envs/my-env/lib/python3.12/site-packages/pyiron_base/jobs/job/runfunction.py:204, in run_job_with_status_initialized(job, debug)
    196 # The PythonFunctionContainerJob can generate the job_name during job.save(). In particular, this can lead to
    197 # the job being reloaded from the database resulting in the job status to change from initialized to finished.
    198 # Skipping the job.run() prevents raising a warning by calling job.run() on an already finished job.
    199 if (
    200     not job.status.finished
    201     and not job.status.aborted
    202     and not job.status.not_converged
    203 ):
--> 204     job.run()

File /usr/share/miniconda3/envs/my-env/lib/python3.12/site-packages/pyiron_snippets/deprecate.py:158, in Deprecator.__deprecate_argument.<locals>.decorated(*args, **kwargs)
    148     if kw in self.arguments:
    149         warnings.warn(
    150             message_format.format(
    151                 "{}.{}({}={})".format(
   (...)
    156             stacklevel=2,
    157         )
--> 158 return function(*args, **kwargs)

File /usr/share/miniconda3/envs/my-env/lib/python3.12/site-packages/pyiron_base/jobs/job/generic.py:882, in GenericJob.run(self, delete_existing_job, repair, debug, run_mode, run_again)
    880     self._run_if_new(debug=debug)
    881 elif status == "created":
--> 882     self._run_if_created()
    883 elif status == "submitted":
    884     run_job_with_status_submitted(job=self)

File /usr/share/miniconda3/envs/my-env/lib/python3.12/site-packages/pyiron_base/jobs/job/generic.py:1406, in GenericJob._run_if_created(self)
   1397 def _run_if_created(self):
   1398     """
   1399     Internal helper function the run if created function is called when the job status is 'created'. It executes
   1400     the simulation, either in modal mode, meaning waiting for the simulation to finish, manually, or submits the
   (...)
   1404         int: Queue ID - if the job was send to the queue
   1405     """
-> 1406     return run_job_with_status_created(job=self)

File /usr/share/miniconda3/envs/my-env/lib/python3.12/site-packages/pyiron_base/jobs/job/runfunction.py:227, in run_job_with_status_created(job)
    225     run_job_with_runmode_manually(job=job, _manually_print=True)
    226 elif job.server.run_mode.modal:
--> 227     job.run_static()
    228 elif job.server.run_mode.srun:
    229     run_job_with_runmode_srun(job=job)

File /usr/share/miniconda3/envs/my-env/lib/python3.12/site-packages/pyiron_base/jobs/job/generic.py:920, in GenericJob.run_static(self)
    918     execute_job_with_calculate_function(job=self)
    919 else:
--> 920     return execute_job_with_external_executable(job=self)

File /usr/share/miniconda3/envs/my-env/lib/python3.12/site-packages/pyiron_base/jobs/job/runfunction.py:733, in run_time_decorator.<locals>.wrapper(job)
    731 if not state.database.database_is_disabled and job.job_id is not None:
    732     job.project.db.item_update({"timestart": datetime.now()}, job.job_id)
--> 733     output = func(job)
    734     job.project.db.item_update(job._runtime(), job.job_id)
    735 else:

File /usr/share/miniconda3/envs/my-env/lib/python3.12/site-packages/pyiron_base/jobs/job/runfunction.py:832, in execute_job_with_external_executable(job)
    828 with open(
    829     posixpath.join(job.project_hdf5.working_directory, "error.out"), mode="w"
    830 ) as f_err:
    831     f_err.write(out)
--> 832 handle_finished_job(job=job, job_crashed=job_crashed, collect_output=True)
    833 return out

File /usr/share/miniconda3/envs/my-env/lib/python3.12/site-packages/pyiron_base/jobs/job/runfunction.py:848, in handle_finished_job(job, job_crashed, collect_output)
    846 if collect_output:
    847     job.status.collect = True
--> 848     job.run()
    849 if job_crashed:
    850     job.status.aborted = True

File /usr/share/miniconda3/envs/my-env/lib/python3.12/site-packages/pyiron_snippets/deprecate.py:158, in Deprecator.__deprecate_argument.<locals>.decorated(*args, **kwargs)
    148     if kw in self.arguments:
    149         warnings.warn(
    150             message_format.format(
    151                 "{}.{}({}={})".format(
   (...)
    156             stacklevel=2,
    157         )
--> 158 return function(*args, **kwargs)

File /usr/share/miniconda3/envs/my-env/lib/python3.12/site-packages/pyiron_base/jobs/job/generic.py:888, in GenericJob.run(self, delete_existing_job, repair, debug, run_mode, run_again)
    886     self._run_if_running()
    887 elif status == "collect":
--> 888     self._run_if_collect()
    889 elif status == "suspend":
    890     self._run_if_suspended()

File /usr/share/miniconda3/envs/my-env/lib/python3.12/site-packages/pyiron_base/jobs/job/generic.py:1448, in GenericJob._run_if_collect(self)
   1442 def _run_if_collect(self):
   1443     """
   1444     Internal helper function the run if collect function is called when the job status is 'collect'. It collects
   1445     the simulation output using the standardized functions collect_output() and collect_logfiles(). Afterwards the
   1446     status is set to 'finished'
   1447     """
-> 1448     run_job_with_status_collect(job=self)

File /usr/share/miniconda3/envs/my-env/lib/python3.12/site-packages/pyiron_base/jobs/job/runfunction.py:345, in run_job_with_status_collect(job)
    343 job.run_time_to_db()
    344 if job.status.collect:
--> 345     if not job.convergence_check():
    346         job.status.not_converged = True
    347     else:

File ~/work/pyiron_atomistics/pyiron_atomistics/pyiron_atomistics/sphinx/base.py:1486, in SphinxBase.convergence_check(self)
   1477 """
   1478 Checks for electronic and ionic convergence according to the user specified tolerance
   1479 
   (...)
   1483 
   1484 """
   1485 # Checks if sufficient empty states are present
-> 1486 if not self.nbands_convergence_check():
   1487     return False
   1488 return self.output.generic.dft.scf_convergence[-1]

File ~/work/pyiron_atomistics/pyiron_atomistics/pyiron_atomistics/dft/job/generic.py:370, in GenericDFTJob.nbands_convergence_check(self)
    361 def nbands_convergence_check(self):
    362     """
    363     Function to check if there are a sufficient number of empty bands in the calculation to ensure electronic convergence.
    364 
   (...)
    367         bool : True if the highest band is unoccupied, False if the highest band is occupied
    368     """
    369     return np.all(
--> 370         np.isclose(self["output/electronic_structure/occ_matrix"][:, :, -1], 0)
    371     )

TypeError: 'NoneType' object is not subscriptable
skatnagallu commented 1 month ago

Then I am not sure how to solve this.

jan-janssen commented 1 month ago

@samwaseda As far as I understand this pull request is no longer necessary after we merged https://github.com/pyiron/pyiron_atomistics/pull/1549 , correct? If that is the case please close the pull request.

samwaseda commented 1 month ago

@samwaseda As far as I understand this pull request is no longer necessary after we merged pyiron/pyiron_base#1549 , correct? If that is the case please close the pull request.

It's true that what this was opened for got fulfilled, but the error of this PR showed another problem in the parser, so I would like to fix it before we forget about it -> leave it open for now, at least until next week