Add lobster io and electronic_structure/cohp.py module with history#5
Merged
shyuep merged 207 commits intomaterialsproject:mainfrom Mar 9, 2026
Merged
Conversation
* fix IonEntry doc str + type hints
* move TEST_FILES_DIR attr from PymatgenTest into module scope
* PymatgenTest.TEST_FILES_DIR -> TEST_FILES_DIR
* delete TEST_FILES_DIR conftest fixture
* fix AttributeError: type object 'TestChgcar' has no attribute 'TEST_FILES_DIR'
tests/io/vasp/test_outputs.py:1444
* os.path.join(TEST_FILES_DIR, "...") -> f"{TEST_FILES_DIR}/..."
…` (#3229) * simplify: f-string path construction everywhere, no need for os.path.join(...) * fix _get_oxid_state_guesses doc str * rename to _get_oxi_state_guesses
…` module (#3237)
* return plt.Axes instead of plt from plot methods
* VoltageProfilePlotter.get_plot and get_chgint_plot
* fix > plt.subplot(220 + count)
E AttributeError: 'Axes' object has no attribute 'subplot'
/home/runner/work/pymatgen/pymatgen/pymatgen/electronic_structure/plotter.py:1082
* fix > ylim = plt.ylim()
E AttributeError: 'Axes' object has no attribute 'ylim'
/home/runner/work/pymatgen/pymatgen/pymatgen/electronic_structure/plotter.py:3834
* fix > plt.gca().set_xticks(uniq_d)
E AttributeError: 'Axes' object has no attribute 'gca'
/home/runner/work/pymatgen/pymatgen/pymatgen/electronic_structure/plotter.py:360:
* fix > ylim = plt.ylim()
E AttributeError: 'Axes' object has no attribute 'ylim'
/home/runner/work/pymatgen/pymatgen/pymatgen/electronic_structure/plotter.py:3838: AttributeError
* fix mypy and add type hints to RelaxationAnalyzer
* fix > ax.xlim((min(relevanty), max(relevanty)))
E AttributeError: 'Axes' object has no attribute 'xlim'
pymatgen/electronic_structure/plotter.py:3836: AttributeError
* fix > plt.gca().set_xticks(uniq_d)
E AttributeError: 'Axes' object has no attribute 'gca'
/home/runner/work/pymatgen/pymatgen/pymatgen/phonon/plotter.py:266: AttributeError
* don't use get_plot return value, use imported plt module directly
* improve plot_compare_gs error message on incompatible plotters
* update SpectrumPlotter.get_plot and pretty_polyfit_plot
* fix > ax.setp(legend_text, fontsize=30)
E AttributeError: 'Axes' object has no attribute 'setp'
pymatgen/electronic_structure/plotter.py:3875: AttributeError
* return plt.axes instead of plt in SurfaceEnergyPlotter.surface_chempot_range_map and get_ir_spectra
* fix PhononDosPlotter.get_plot()
* refactor tests
* update test_gruneisen.py and electronic_structure/test_plotter.py to expect plt.axes instead of plt
* fix SpectrumPlotter.get_plot and DosPlotter.get_plot
* remove redundant os.path.join(".", ...) in pymatgen/io/feff/sets.py
* replace all plt = pretty_plot(...) with ax = pretty_plot(...) and fix downstream repercussions
* add missing set_ prefix to Axes methods
* fix AttributeError: 'Axes' object has no attribute 'gca'
def test_plot(self):
# Disabling latex for testing.
from matplotlib import axes, rc
rc("text", usetex=False)
self.plotter.add_dos("Total", self.dos)
self.plotter.get_plot(units="mev")
self.plotter_nostack.add_dos("Total", self.dos)
plt = self.plotter_nostack.get_plot(units="mev")
> ax = plt.gca()
also attempt fix get_elt_projected_plots
* update return type doc strings and type hints
* pre-commit autoupdate && ruff . --fix
* rename all subplot vars to ax
* fix AttributeError: 'Axes' object has no attribute 'ylim'
> assert plt.ylim() == (-4.0, 7.6348), "wrong ylim"
and
> ax.set_title(ax.get_title(), size=width * 4)
E AttributeError: 'numpy.ndarray' object has no attribute 'set_title'
* fix TestBSPlotter.test_get_plot()
* fix return type doc str indentation * don't use pytest.approx() with assert len(...) * use numpy.testing.assert_allclose over assert np.allclose * np.allclose(np.array(...), ...) to np.allclose(..., ...) * fix mypy * replace assert_array_almost_equal with numpy-recommended assert_allclose * replace np.testing.assert_almost_equal with numpy-recommended assert_allclose * breaking snake_case abinit float_decimal kwarg * delete PymatgenTest.assert_all_close, always use numpy.testing.assert_allclose directly * manual increase assert_allclose atol * more manual increase assert_allclose atol * fix last 3 missed missing atols
* delete unused tests/files/chemenv/images/detailed_voronoi_container_coordination_numbers_1.png
* mv tests/files/chemenv/{json_test_files,json}
mv tests/files/chemenv/structure_environments{_files,}
* remove all shutil.rmtree from tests
and refactor tests to not pollute git directory if necessary
* pmg test_entrypoint run in tmp_path
* refactor TestVampireCaller
* delete all def setUp(self): warnings.simplefilter("ignore")
and corresponding
def tearDown(self):
warnings.simplefilter("default")
* delete questionable def tearDown(self): del self.attrs
example:
def tearDown(self):
del self.ethylene
del self.butadiene
del self.cyclohexene
seems pointless, class is garbage-collected anyway
* remove all unused unittest.main()
if __name__ == "__main__":
import unittest
unittest.main()
* refactor
* fix vestiges of old dir names
* remove unused module-level var json_files_dir
* remove _files suffix from several tests/files/*_files dirs
* delete analysis/solar/slme.py matrix_eigvals()
* fix whitespace
* mv tests/io/lobster/test_{lobster,inputs}.py
update test names in .pytest-split-durations
* str concat to f-str
* use isinstance(x, Iterable) over hasattr(x, "__iter__")
* delete needless bool(...) calls
* fix bad f-str conversion
* fix typos, use f-strings, remove docs_rst from .gitattributes linguist-vendored
* Revert "remove _files suffix from several tests/files/*_files dirs"
This reverts commit 3979a07eee890548ebaadbd923dbb98838d32b30.
* delete dead code in pymatgen/electronic_structure/boltztrap2.py
* google-style doc string return types
* to f-string * add WIP PotcarSingle.__repr__ * test_repr() * ruff . --fix * delete repeated words
* refactor SymmOp.are_symmetrically_related * snake_case test method names * remove needless double underscore from private methods * google-style Note: section header in doc strings
* Added two funcs to PMG's PotcarSingle to better check POTCAR meta
* updates to gen new meta for potcar validation
* use only req'd potcar meta, and not full contents of psctr header
* use only req'd potcar meta, and not full contents of psctr header 2/*
* Use PSCTR instead of keywords attr to generate meta
* Use PSCTR instead of keywords attr to generate meta
* First attempt at new POTCAR hashing ready, tests pass
* Cleanup and prep for PR
* rm tmp.diff
* gzip POTCAR_META.json
* auto-format vasp/inputs.py
* pre-commit auto-fixes
* Updating in response to PMG maintainer comments
* deduplicate cwd and rename module_dir
* make is PotcarSingle.is_valid property
* remove newlines from warning
* snake_case
* rename _str_to_py to _fortran_style_str_to_py_var; update test_identify_potcar to test_is_valid to ensure that PotcarSingle.is_valid is not sensitive to small numeric changes
* tweak UnknownPotcarWarning msg
* rm POT_GGA_PAW_PBE_54/POTCAR.Fe_broken.gz and try to invalidate POTCAR on the fly
* test a 2nd POTCAR in TestPotcarSingle
* fix 5 mypy errors in PotcarSingle.__init__
* google doc str
* turn PotcarSingle hash methods into properties
get_sha256_file_hash, get_potcar_file_hash, get_potcar_hash to sha256_file_hash, potcar_file_hash, potcar_hash
* add test_potcar_file_hash and test_sha256_file_hash
* no need to have data_stats as class method
* remove PotcarSingle.keywords, replaced by PotcarSingle.PSCTR
* rename PotcarSingle.PSCTR to PotcarSingle.keywords
* test_is_valid use deep copies for each invalidation
* reintroduce PotcarSingle.hash and file_hash attrs
fixes TestTransformedStructure.test_get_vasp_input > return self.keywords[attr.upper()]
E KeyError: 'HASH'
(was broken in 983598)
* delete alias test_dir_doscar for TEST_FILES_DIR
* fix test_get_all_possible_basis_functions
* fix TestMPScanRelaxSet.test_write_input polluting git repo on failure
* git checkout master tests/files/POT_GGA_PAW_PBE_54/POTCAR.{Fe_pv,O}.gz
trying to fix tests
* mv pymatgen/io/vasp/{POTCAR_META,potcar_summary_stats}.json.gz
* move _fortran_style_str_to_py_var into def is_valid()
* rename PotcarSingle.sha256_file_hash to sha256_computed_file_hash
* missed a hash_sha256_computed->sha256_computed_file_hash rename
* add PotcarSingle property hash_sha256_from_file
rename potcar_file_hash to md5_computed_file_hash
rename potcar_hash to md5_header_hash
* remove old unknown Potcar warning when self.hash_sha256_from_file != self.sha256_computed_file_hash
prone to false positives
* delete test_potcar_file_hash_warning, use that potcar test file as valid example in test_is_valid instead
* remove aliases hash for md5_header_hash and file_hash for md5_computed_file_hash
* load pymatgen and VASP hashes only once in module scope
* git checkout master tests/files/POT_GGA_PAW_PBE_54/POTCAR.Fe_O.gz
* remove vestiges of potcar_hash alias for md5_computed_file_hash
---------
Co-authored-by: Aaron Kaplan <aaronkaplan@Aarons-MBP.dhcp.lbl.gov>
Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com>
* Implemented a pymatgen class to handle NcICOBILIST.lobster files * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * checking lobster version * pre-commit auto-fixes * improved the tests for ncicobi * pre-commit auto-fixes * cleaned up the merge mess * cleaning up merging mess * get the failing tests to work * cleaning up merging mess * cleaning up merging * adopted PascalCase for ncicobilist class * adopted PascalCase for ncicobilist class * adopted PascalCase for ncicobilist class * captitalized the wrong C * snake_case * use ternary for self.is_spin_polarized * fix Attributes indentation * commented why filename (NcICOBILIST.lobster) = None for LOBSTER version check COBI features were only implemented in LOBSTER 4.1.0 * pre-commit auto-fixes * Update pymatgen/io/lobster/outputs.py Co-authored-by: J. George <JaGeo@users.noreply.github.com> Signed-off-by: Christina Ertural <52951132+QuantumChemist@users.noreply.github.com> * improved the code * pre-commit auto-fixes * get the linting check working * pre-commit auto-fixes --------- Signed-off-by: Christina Ertural <52951132+QuantumChemist@users.noreply.github.com> Co-authored-by: certural <christina.ertural@bam.de> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com> Co-authored-by: J. George <JaGeo@users.noreply.github.com>
* fix typo * snake_case names * release.yml add 📦 Dependencies and 🏷️ Type Hints
* add hamiltonMatrices.lobster parser to lobster.io.outputs * pre-commit auto-fixes * fix ruff error * temp mypy fix * update lobster.io __init__.py : include LobsterMatrices class * rename class and make it general to work for all matrices files of lobster * add tests and small test files * pre-commit auto-fixes * fix class description docstring * snake_case * use pytest.approx in TestLobsterMatrices.test_attributes * format to reduce white space --------- Co-authored-by: anaik <anaik@sv2218.zit.bam.de> Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com>
* fix erroneous imaginary part due to typo * update LobstrMatrix parser tests > more robust testing --------- Co-authored-by: anaik <anaik@sv2218.zit.bam.de> Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com>
…#3439) * Fix lobsterin * update lobsterin * use re pattern match * Update tests, implement del * fix typo * clean comments * fix regex pattern to exclude comments, handle tabular spaces, update tests --------- Co-authored-by: Aakash Ashok Naik <91958822+naik-aakash@users.noreply.github.com> Co-authored-by: anaik <anaik@sv2218.zit.bam.de>
…ry for VASP I/O tests (#3491) * Added fake potcar library for tests * fix failing lobster test caused by removal of potcars * fix failing io.vasp.test_sets * fix alchemy.test_materials test * Add pymatgen.util.testing.FAKE_POTCAR_DIR var for fake potcar library, rename directory of fake potcars * refactor POTCAR search path in Vasprun.get_potcars * test_inputs.py move monkey-patching of potcar_summary_stats into new _mock_complete_potcar_summary_stats fixture * remove largely duplicate asserts assert input_set.potcar.functional == "PBE_64" in TestMatPESStaticSet * minimize diff * restore comments * Modify POTCAR scrambling to only modify parts of the POTCAR not printed to OUTCAR. Revise test data and fake POTCAR library * Make potcar_summary_stats a private attr of pymatgen.io.vasp.inputs.PotcarSingle to resolve slow docs loading time * update doc strings, fix typo * add comment explaining FAKE_POTCAR_DIR contents --------- Signed-off-by: Aaron Kaplan <33381112+esoteric-ephemera@users.noreply.github.com> Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com> Co-authored-by: Aaron Kaplan <kaplan@temple.edu>
* add as_dict method to Bandoverlaps, Grosspop, Charge, Madelung, Sitepotential parser * add tests for as_dict method * Charges MSonable * adapt charges test * add deprecation warning to Charge.Loewdin and Charge.Mulliken * fix msonable sitepotential, grosspop, bandoverlap, icohplist, madelung * add robust test for msonable --------- Co-authored-by: Shyue Ping Ong <shyuep@users.noreply.github.com>
* add args to work with pymatgen objs * adapt and add test
* add args to work with pymatgen objs * adapt and add test * Fix charges if else checks * add tests for valences * refactor test_lobsterenv.py changes --------- Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com>
* add as_dict method to Bandoverlaps, Grosspop, Charge, Madelung, Sitepotential parser * add tests for as_dict method * Charges MSonable * adapt charges test * add deprecation warning to Charge.Loewdin and Charge.Mulliken * fix msonable sitepotential, grosspop, bandoverlap, icohplist, madelung * add robust test for msonable * make lobsterout msonable * add safety check for kwargs * Lobsterout._ATTRIBUTES list->tuple include value in ValueError msg * cover ValueError in test_msonable --------- Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com>
…aming architecture (#4592) * moving to the future * simpler serialization, spin keys taken care of * final commit? * no `Self` for python 3.10 * changes allowing safe jsanazite * for now * final? * pre-commit auto-fixes * LOBSTER_OBJECTS constant * pre-commit auto-fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Shyue Ping Ong <shyuep@users.noreply.github.com>
…aming architecture (#4592) * moving to the future * simpler serialization, spin keys taken care of * final commit? * no `Self` for python 3.10 * changes allowing safe jsanazite * for now * final? * pre-commit auto-fixes * LOBSTER_OBJECTS constant * pre-commit auto-fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Shyue Ping Ong <shyuep@users.noreply.github.com>
* Try initial deletion. * More source removal and tests removal. * More cleanup. * More cleanup. * Remove commandline tests. * Update pymatgen-test-files. * Fix ruff. * Fix missing package files. * Cleanup pyproject.toml. * There is no need for splits anymore. * Make sure moyopy tests are skipped if not installed. * Cleanup test workflow.
* Try initial deletion. * More source removal and tests removal. * More cleanup. * More cleanup. * Remove commandline tests. * Update pymatgen-test-files. * Fix ruff. * Fix missing package files. * Cleanup pyproject.toml. * There is no need for splits anymore. * Make sure moyopy tests are skipped if not installed. * Cleanup test workflow.
Signed-off-by: Aakash Ashok Naik <91958822+naik-aakash@users.noreply.github.com>
Signed-off-by: Aakash Ashok Naik <91958822+naik-aakash@users.noreply.github.com>
fcc4b06 to
664fa30
Compare
Contributor
Author
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Base PR used for retrieving history is as per the last modifications from https://github.com/JaGeo/pymatgen/tree/fix_icohp
cohp.pymodule in the electronic structure with full history from pymatgen