ITADN

版本发布 8

v2026.5.4
? · 2026-05-04

- PR #4614 Prevent same-composition entries from reappearing in inner hull reduction (by @irishmango) - PR #4615 Clear `energy_adjustments` correctly in clean mode to avoid skipped removals (by @irishmango) - PR #4649 Deprecate LobsterEnv constructors that mixed file paths and objects; prefer object-only initialization (by @naik-aakash) - PR #4625 Add partial update method to projected phase diagrams (by @CompRhys) - PR #4648 Speed up `pmg` CLI startup with lazy imports (by @hheei) - PR #4619 Add Elasticipy to addons documentation (by @DorianDepriester) - PR #4612 Fix incorrect method reference in `get_phase_separation_energy` docstring (by @irishmango)

v2025.10.7
? · 2025-10-07

- PR #4502 Fix: indexing error in Procar._read() by @finnrk Major changes: - Fixes a bug related to indices when skipping repeated k-points while reading `PROCAR` (for example, the double-counting of symmetry points when using a k-path for plotting bandstructure). Previously, projections, eigenvalues, occupations and weights would be attributed to the wrong k-points. Also, the k-point following the skipped k-point would have complex projections of NaN, as well as an occupation, weight, eigenvalue and squared projections of 0. - PR #4503 Replace `print` with logging by @DanielYang59 - replace `print` with logging, I assume pymatgen as a lib code shouldn't use print... - remove some print from tests - PR #4510 suppress runtime warning from boltztrap2 by @DanielYang59 close #2317 - PR #4512 Fix missing sdist from PyPI by @DanielYang59 fix #4509 tested in my fork: https://github.com/DanielYang59/pymatgen/actions/runs/18279908313/job/52040659228 - PR #4491 Deprecate `projected_magnetisation` with `projected_magnetization` (US spelling) by @DanielYang59 fix #4382 - PR #4493 `Composition.get_wt_fraction` return float instead of `FloatWithUnit` by @DanielYang59 fix #4492 - PR #4496 Overwrite `__rtruediv__` for `FloatWithUnit`, fix `ArrayWithUnit` loses `unit_type` when unpickled by @DanielYang59 - fix #4495 - [x] Check `ArrayWithUnit` behaviour - Fix unpickle `ArrayWithUnit` loses `unit_type` - Add some tests for `core.units`, https://app.codecov.io/gh/materialsproject/pymatgen/blob/master/pymatgen%2Fcore%2Funits.py - PR #4490 Replace `linear_assignment` with `scipy` `linear_sum_assignment ` by @DanielYang59 - Replace `linear_assignment` with [`scipy` `linear_sum_assignment `](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.linear_sum_assignment.html#linear-sum-assignment) - [x] Speed benchmark ### Benchmark WSL2 Ubuntu 24.04 (AMD64) Master branch: ``` n | avg_time (s) | std_dev (s) ------------------------------------ 100 | 0.000104 | 0.000018 500 | 0.004302 | 0.002333 1000 | 0.018374 | 0.006702 5000 | 1.049615 | 0.327349 ```` Current branch: ``` n | avg_time (s) | std_dev (s) ------------------------------------ 100 | 0.000121 | 0.000030 500 | 0.005082 | 0.002957 1000 | 0.018487 | 0.006484 5000 | 1.062805 | 0.332552 ```` - PR #4440 `JDFTXOutfileSlice.vibrational_modes` and `JDFTXOutfileSlice.vibrational_energy_components` by @benrich37 Major changes: - feature 1: Parsing and storage of vibrational modes within a `JDFTXOutfileSlice` -- Stored as a `list[dict]`, where each `dict` contains --- "Type": `str` ---- either `"Imaginary"`, `"Zero"`, or `"Real"` --- "Type index": `int` ---- (Base 1) index of the mode among other modes of the same frequency type --- "Degeneracy": `int` ---- Degeneracy of the mode (ie if `mode["Degeneracy"] == 2`, than there is one other mode in the list with the same frequency) --- "Frequency": `float` | `complex` ---- Frequency of the vibration in eV --- "IR intensity": `float` ---- IR intensity of the vibrational mode in e^2/amu as derived from dipole of the vibration --- "Displacements": `NDArray[float]` ---- Displacement vector representing the vibrational mode (converted from Bohr to Angstrom as magnitude of vector is a input variable for vibrational analysis in JDFTx) -- Testing for vibrational mode parsing - feature 2: Parsing and storage of vibration energy components within a `JDFTXOutfileSlice` -- Stored as a `dict[str, float]`, containing --- "T" : Temperature at which free energy was evaluated (in K) --- Dumped free energy components in eV -- Testing for vibrational energy components parsing - PR #4487 Fix TranslateSitesTransformation by @Rastow There was a bug in the `TranslateSitesTransformation` class. Both index variables in `apply_transformation` are named identically. The test case did not capture this error. I changed the existing test case to fail when run with the old code and renamed the variables. - PR #4447 Fix `has_cobicar` when NcICOBILIST is present by @tomdemeyere When `icobiBetween` is activated lobster prints out the `NcICOBILIST.lobster` file. In the lobster output we find "Writing COBICAR.lobster, ICOBILIST.lobster and NcICOBILIST.lobster..." instead of the regular line. The current parser then returns `False` even if the COBICAR.lobster is present. Also, it seems that `has_cohpcar` and `has_coopcar` are flipped? Switching to a regex approach on the whole files (not `\n` split) would allow much greater flexbility, performance and robustness. @JaGeo @naik-aakash - [ ] Google format doc strings added. Check with `ruff`. - [ ] Type annotations included. Check with `mypy`. - [ ] Tests added for new features/fixes. - [ ] If applicable, new classes/functions/modules have [`duecredit`](https://github.com/duecredit/duecredit) `@due.dcite` decorators to reference relevant papers by DOI ([example](https://github.com/materialsproject/pymatgen/blob/91dbe6ee9ed01d781a9388bf147648e20c6d58e0/pymatgen/core/lattice.py#L1168-L1172)) Tip: Install `pre-commit` hooks to auto-check types and linting before every commit: ```sh pip install -U pre-commit pre-commit install ``` - PR #4469 Loosen `requests` lower pin, fix `pre-commit` errors by @DanielYang59 ### Summary - Loosen [`requests`](https://pypi.org/project/requests/#history) upper pin, current pin seems too strict and might cause unresolvable dependency - Fix a few deprecation warnings - Fix some new `ruff` errors from `pre-commit` - PR #4479 Move JDFTx sets from atomate2 to pymatgen by @cote3804 Following a request by @utf in an atomate2 [PR](https://github.com/materialsproject/atomate2/pull/955), I am moving our input set from atomate2 to pymatgen. This PR adds a `sets.py` file with one new class, `JdftxInputSet`, which does little more than wrap the other JDFTx I/o classes. The only minor change to the original atomate2 code is that the `__init__` method now accepts a pymatgen `Structure` instead of a `JDFTXStructure`. A yaml defining the base input set, `BaseJdftxSet.yaml` was also moved from atomate2. I added two basic tests to check that both loading from an input file and from a `JdftxInfile` are working and that the file written by the input set yields the expected `JdftxInfile`. - PR #4484 Fix jdftx.outputs usage of 3.11+ only syntax by @DanielYang59 [Fix the following 3.11+ only syntax](https://docs.python.org/3/reference/expressions.html?utm_source=chatgpt.com#subscriptions): - PR #4473 Fix label in `NEBAnalysis` by @DanielYang59 ### To close #4465 - [x] Incorrect label (and value) - [x] `glob` now would use exact match first (`['path_1_Li_sv2004_test/00/POSCAR.xyz', 'path_1_Li_sv2004_test/00/POSCAR', 'path_1_Li_sv2004_test/00/POSCAR.vasp']`)https://github.com/materialsproject/pymatgen/blob/f01009c390a3df02d4d45b8f0225cf59305ee7bf/src/pymatgen/analysis/transition_state.py#L261 - Deprecate `spline_options` dict with boolean flag `zero_slope_saddle` as there's only one boolean config available: https://github.com/materialsproject/pymatgen/blob/f01009c390a3df02d4d45b8f0225cf59305ee7bf/src/pymatgen/analysis/transition_state.py#L70 - PR #4260 Use external Package for FHI-aims IO interface by @tpurcell90 Major changes: - moved FHI-aims specific content into a separate package (pyfhiaims) for ease of maintenance (stop multiple libraries from implementing the same basic interface) ## Todos If this is work in progress, what else needs to be done? - Workout how to best test the aims io interface/dependency tracker - check with community this does not break their setups - PR #4476 patch ReDOS vulnerability in GaussianInput.from_string by @lbluque Major changes: - Patches ReDOS vulnerability mentioned in #2755 - PR #4448 Remove LOBSTER output file trailing line sensitivity by @DanielYang59 - Remove LOBSTER output file trailing line sensitivity, fix #4215 [`str.splitlines(keepends=False)`](https://docs.python.org/3/library/stdtypes.html#str.splitlines): > Unlike [split()](https://docs.python.org/3/library/stdtypes.html#str.split) when a delimiter string sep is given, this method returns an empty list for the empty string, and a terminal line break does not result in an extra line: cc @JaGeo @naik-aakash - PR #4454 Fix unit for `Element` properties: `density_of_solid` and `Molar volume` by @DanielYang59 ### Summary - Remove unit in docstring for `Element` properties, to close #4453 - [x] Check other units in docstring - PR #4461 Handle numpy array for selective dynamics in `Structure` by @DanielYang59 ### Summary - Handle numpy array for selective dynamics in `Structure`, to fix #4460 - [x] Double check consistent behaviour from `json` and `orjson`, also check round trip? - [x] Unit test - PR #4464 Update analyzer.py by @boyoungzheng Missing a letter "s" for `site.species` in pymatgen.symmetry.analyser.SpacegroupAnalyzer.get_primitive_standard_structure() Major changes: - feature 0: - fix 1: Missing a letter "s" for `site.species` in pymatgen.symmetry.analyser.SpacegroupAnalyzer.get_primitive_standard_structure() - PR #4446 Efficiency updates for `__str__()` methods by @kavanase Small change to improve the efficiency of `Species.__str__`, which can become a bottleneck in some workflows which e.g. subselect sites in a structure based on the species, before doing further processing (e.g. defect site matching in `doped`). Improves efficiency by reducing redundant `getattr` calls. - PR #4438 Add basic S3 object retrieval to the pymatgen user agent by @esoteric-ephemera The MP API has changed to accommodate increasingly large datasets. This PR allows for retrieving certain data objects from S3 that are no longer accessible via MongoDB In the future, communicating which features unexpectedly no longer work, e.g., through matsci.org, is a great way to handle feature changes. [Calling out the team](https://github.com/materialsproject/pymatgen/commit/c1db75380fbf8e94bbb58ce85c10d9dffade0c5e) is not going to help fyi @mkhorton, @computron - PR #4443 Better comment handling for CP2K input file by @DanielYang59 - Better comment handling for CP2K input file, to fix #4442

v2025.6.14
? · 2025-06-14

- Treat LATTICE_CONSTRAINTS as is for INCARs. - PR #4425 `JDFTXOutfileSlice.trajectory` revision by @benrich37 Major changes: - feature 1: `JDFTXOutfileSlice.trajectory` is now initialized with `frame_properties` set -- `JOutStructure.properties` filled with relevant data for `frame_properties` -- More properties added to `JOutStructure.site_properties` ## Todos - Remove class attributes in `JOutStructure` now redundant to data stored in `JOutStructure.properties` and `JOutStructure.site_properties` - PR #4431 Single source of truth for POTCAR directory structure by @esoteric-ephemera Modifies the pymatgen CLI to use the same POTCAR library directory structure as in `pymatgen.io.vasp.inputs` to close #4430. Possibly breaking from the CLI side (the directory structure will change) Pinging @mkhorton since #4424 was probably motivated by similar concerns? - PR #4433 Speed up symmetry functions with faster `is_periodic_image` algorithm by @kavanase I noticed that in some of our `doped` testing workflows, `SpacegroupAnalyzer.get_primitive_standard_structure()` is one of the main bottlenecks (as to be expected). One of the dominant cost factors here is the usage of `is_periodic_image`, which can be expensive for large structures due to many `np.allclose()` calls. This PR implements a small change to instead use an equivalent (but faster) pure Python loop, which also breaks early if the tolerance is exceeded. In my test case, this reduced the time spent on `is_periodic_image` (and thus `SpacegroupAnalyzer.get_primitive_standard_structure()`) from 35s to 10s. - PR #4432 Fingerprint sources by @JaGeo Add correct papers to tanimoto fingerprints - PR #4061 Fix branch directory check in `io.vasp.outputs.get_band_structure_from_vasp_multiple_branches` by @DanielYang59 ### Summary - Fix branch directory check in `io.vasp.outputs.get_band_structure_from_vasp_multiple_branches`, to fix #4060 - [ ] Improve unit test (waiting for data, I don't have experience with "VASP multi-branch bandstructure calculation") - PR #4409 Packmol constraints by @davidwaroquiers Added possibility to set individual constraints in packmol. Added some sanity checks. Added unit tests. - PR #4428 Fixes a bug in `NanoscaleStability.plot_one_stability_map` and `plot_all_stability_map`. by @kmu Major changes: - Replaced incorrect `ax.xlabel()` and `ax.ylabel()` calls with correct `ax.set_xlabel()` and `ax.set_ylabel()`. - Added `ax.legend()` to `plot_all_stability_map` so that labels passed via `ax.plot(..., label=...)` are displayed. - Added `test_plot()` to `test_surface_analysis.py`. - PR #4424 Add additional name mappings for new LDA v64 potcars by @mkhorton As title. - PR #4426 Fix uncertainty as int for `EnergyAdjustment` by @DanielYang59 - Avoid `==` or `!=` for possible float comparison - Fix uncertainty as int for `EnergyAdjustment` cannot generate repr: ```python from pymatgen.entries.computed_entries import EnergyAdjustment print(EnergyAdjustment(10, uncertainty=0)) ``` Gives: ``` Traceback (most recent call last): File "/Users/yang/developer/pymatgen/test_json.py", line 25, in <module> print(EnergyAdjustment(10, uncertainty=0)) File "/Users/yang/developer/pymatgen/src/pymatgen/entries/computed_entries.py", line 108, in __repr__ return f"{type(self).__name__}({name=}, {value=:.3}, {uncertainty=:.3}, {description=}, {generated_by=})" ^^^^^^^^^^^^^^^^^ ValueError: Precision not allowed in integer format specifier ``` - PR #4421 Cache `Lattice` property (`lengths/angles/volume`) for much faster `Structure.as_dict` by @DanielYang59 ### Summary - `lengths/angles/volume` of `Lattice` would now be cached, related to #4385 - `verbosity` in `as_dict` of `PeriodicSite/Lattice` now explicitly requires literal 0 or 1 to be consistent with docstring, instead of checking `if verbosity > 0` (currently in grace period, only warning issued) https://github.com/materialsproject/pymatgen/blob/34608d0b92166e5fc4a9dd52ed465ae7dccfa525/src/pymatgen/core/lattice.py#L904-L905 --- ### Cache frequently used `Lattice` properties Currently `length/angles/volume` is not cached and is frequently used, for example accessing all lattice parameter related property would lead to `length/angles` being repeatedly calculated: https://github.com/materialsproject/pymatgen/blob/34608d0b92166e5fc4a9dd52ed465ae7dccfa525/src/pymatgen/core/lattice.py#L475-L524 `structure.as_dict` now around 8x faster Before (1000 structure, each has 10-100 atoms): ``` Total time: 3.29617 s File: create_dummp_json_structure.py Function: generate_and_save_structures at line 34 Line # Hits Time Per Hit % Time Line Contents ============================================================== 34 @profile 35 def generate_and_save_structures(n, output_dir): 36 1 20.0 20.0 0.0 os.makedirs(output_dir, exist_ok=True) 37 38 1001 222.0 0.2 0.0 for i in range(n): 39 1000 291789.0 291.8 8.9 structure = generate_dummy_structure() 40 1000 583.0 0.6 0.0 filename = f"structure_{i:04d}.json.gz" 41 1000 1942.0 1.9 0.1 filepath = os.path.join(output_dir, filename) 42 43 2000 224549.0 112.3 6.8 with gzip.open(filepath, "wb") as f: 44 1000 2761900.0 2761.9 83.8 dct = structure.as_dict() 45 1000 15163.0 15.2 0.5 f.write(orjson.dumps(dct)) ``` Now: ``` Total time: 0.949622 s File: create_dummp_json_structure.py Function: generate_and_save_structures at line 34 Line # Hits Time Per Hit % Time Line Contents ============================================================== 34 @profile 35 def generate_and_save_structures(n, output_dir): 36 1 37.0 37.0 0.0 os.makedirs(output_dir, exist_ok=True) 37 38 1001 195.0 0.2 0.0 for i in range(n): 39 1000 286696.0 286.7 30.2 structure = generate_dummy_structure() 40 1000 511.0 0.5 0.1 filename = f"structure_{i:04d}.json.gz" 41 1000 1843.0 1.8 0.2 filepath = os.path.join(output_dir, filename) 42 43 2000 214130.0 107.1 22.5 with gzip.open(filepath, "wb") as f: 44 1000 431677.0 431.7 45.5 dct = structure.as_dict() 45 1000 14533.0 14.5 1.5 f.write(orjson.dumps(dct)) ``` --- Also note `lattice` (the performance bottleneck) is not used in the dict for site: https://github.com/materialsproject/pymatgen/blob/34608d0b92166e5fc4a9dd52ed465ae7dccfa525/src/pymatgen/core/structure.py#L2856-L2857 So we could modify `as_dict` to control whether lattice would be generated at all This could reduce the runtime slightly so I guess it's not worth the effort: ``` Total time: 0.867376 s ``` - PR #4391 Add custom as_dict/from_dict method for proper initialization of attributes of IcohpCollection by @naik-aakash Currently `IcohpCollection` instance is not serialized correctly, thus I added custom from_dict and as_dict methods here.

v2025.5.28
? · 2025-05-28

- PR #4411 Add `orjson` as required dependency as default JSON handler when custom encoder/decoder is not needed by @DanielYang59 - PR #4417 adding radd dunder method to Volumetric data + test_outputs by @wladerer - PR #4418 `JDFTXOutfileSlice` Durability Improvement by @benrich37 Major changes: - feature 1: Improved durability of `JDFTXOutfileSlice._from_out_slice` method (less likely to error out on unexpected termination) -- So long as one step of electronic minimization has started on an out file slice, parsing shouldn't error out - fix 1: Allow partially dumped eigstats - fix 2: Added missing optical band gap dumped by eigstats - fix 3: Protect the final `JOutStructure` in initializing a `JOutStructures` with a try/except block - fix 4: Detect if positions were only partially dumped and revert to data from `init_structure` in `JOutStructure` - fix 5: Prevent partially dumped matrices from being used in initializing a `JOutStructure` ## Todos - feature 1: Ensure parse-ability as long as a `JDFTXOutfileSlice.infile` can be initialized - PR #4419 Fix Molecule.get_boxed_structure when reorder=False by @gpetretto - PR #4416 `JDFTXInfile` Comparison Methods by @benrich37 Major changes: - feature 1: Convenience methods for comparing `JDFTXInfile` objects -- `JDFTXInfile.is_comparable_to` --- Returns True if at least one tag is found different --- Optional arguments `exclude_tags`, `exclude_tag_categories`, `ensure_include_tags` to ignore certain tags in the comparison ---- `exclude_tag_categories` defaults to `["export", "restart", "structure"]` as `"export"` and `"restart"` are very rarely pertinent to comparability, `"structure"` as subtags of this category are generally the one thing being intentionally changed in comparisons (ie different local minima or a slab with/without an adsorbate) -- `JDFTXInfile.get_filtered_differing_tags` --- What is used in `JDFTXInfile.is_comparable_to` to get filtered differing tags between `JDFTXInfile` objects --- Convenient as a "verbose" alternative to `JDFTXInfile.is_comparable_to` -- `AbstractTag.is_equal_to` and `AbstractTag._is_equal_to` --- Used in tag comparison for finding differing tags --- `AbstractTag._is_equal_to` is an abstract method that must be implemented for each `AbstractTag` inheritor - feature 2: Default `JDFTXInfile` object `pymatgen.io.jdftx.inputs.ref_infile` -- Initialized from reading default JDFTx settings from `pymatgen.io.jdftx.jdftxinfile_default_inputs.default_inputs: dict` -- Used in `JDFTXInfile.get_differing_tags_from` for tags in `self` missing from `other` that are identical to the default setting - fix 1: Re-ordered contents of `JDFTXInfile` to follow the order: magic methods -> class methods / transformation methods -> validation methods -> properties -> private methods - fix 2: Checking for `'selective_dynamics'` in `site_properties` for a `Structure` passed in `JDFTXInfile.from_structure` (used if `selective_dynamics` argument left as `None`) ## Todos - feature 1: Add examples to documentation on how to properly use new comparison methods - feature 2: Improve the mapping of `TagContainer`s to their default values -- The current implementation of comparison for tags to default values only works if the tag as written exactly matches the full default value - at the very least the missing subtags of a partially filled `TagContainer` needs to be filled with the default values before comparing to the full default value -- Some subtags also change depending on the other subtags present for a particular tag (ie convergence threshold depending on algorithm specified for `'fluid-minimize'`, so an improved mapping for dynamic default values needs to be implemented - PR #4413 `JDFTXOutputs.bandstructure: BandStructure` by @benrich37 Major changes: - feature 1: Added 'kpts' storable variable to JDFTXOutputs -- Currently only able to obtain from the 'bandProjections' file - feature 2: Added `bandstructure` attribute to JDFTXOutputs -- Standard pymatgen `BandStrucure` object -- Request-able as a `store_var`, but functions slightly differently --- Ensures 'eigenvals' and 'kpts' are in `store_vars` and then is deleted -- Initialized if JDFTXOutputs has successfully stored at least 'kpts' and 'eigenvals' -- Fills `projections` field if also has stored 'bandProjections' - feature 3: Added `wk_list` to `JDFTXOutputs` -- List of weights for each k-point -- Currently doesn't have a use, but will be helpful for `ElecData` initializing in [`crawfish`](https://github.com/benrich37/crawfish) ## Todos - feature 1: Add reading 'kpts' from the standalone 'kPts' file dumped by JDFTx - feature 2: Outline how we might initialize `BandStructureSymmLine`(s) for calculations with explicitly defined 'kpoint' tags, as using 'kpoint's instead of `kpoint-folding` is most likely an indicator of a band-structure calculation - PR #4415 speed-up Structure instantiation by @danielzuegner This PR speeds up the instantiation of `Structure` objects by preventing hash collisions in the `lru_cache` of `get_el_sp` and increasing its `maxsize`. The issue is that currently `Element` objects are hashed to the same value as the integer atomic numbers (e.g., `Element[H]` maps to the same hash as `int(1)`). This forces the `lru_hash` to perform an expensive `__eq__` comparison between the two, which reduces the performance of instantiating many `Structure` objects. Also here we increase the `maxsize` of `get_el_sp`'s `lru_cache` to 1024 for further performance improvements. This reduces time taken to instantiate 100,000 `Structure` objects from 31 seconds to 8.7s (avoid hash collisions) to 6.1s (also increase `maxsize` to 1024). - PR #4410 JDFTx Inputs - boundary value checking by @benrich37 Major changes: - feature 1: Revised boundary checking for input tags -- Added a `validate_value_bounds` method to `AbstractTag`, that by default always returns `True, ""` -- Added an alternate `AbstractNumericTag` that inherits `AbstractTag` to implement `validate_value_bounds` properly --- Changed boundary storing to the following fields ---- `ub` and `lb` ----- Can either be `None`, or some value to indicate an upper or lower bound ---- `ub_incl` and `lb_incl` ----- If True, applies `>=` instead of `>` in comparative checks on upper and lower bounds -- Switched inheritance of `FloatTag` and `IntTag` from `AbstractTag` to `AbstractNumericTag` -- Implemented `validate_value_bounds` for `TagContainer` to dispatch checking for contained subtags -- Added a method `validate_boundaries` to `JDFTXInfile` to run `validate_value_bounds` on all contained tags and values -- Added `validate_value_boundaries` argument for initialization methods of `JDFTXInfile`, which will run `validate_boundaries` after initializing `JDFTXInfile` but before returning when True --- Note that this is explicitly disabled when initializing a `JDFTXInfile` from the input summary in a `JDFTXOutfileSlice` - boundary values may exist internally in JDFTx for non-inclusive bounded tags as the default values, but cannot be passed in the input file. For this reason, errors on boundary checking must be an easily disabled feature for the construction and manipulation of a `JDFTXInfile`, but out-of-bounds values must never be written when writing a file for passing to JDFTx. ## Todos - feature 1 -- Implement some way boundary checking can run when adding tags to a pre-existing `JDFTXInfile` object --- boundary checking is currently only run when initializing from a pre-existing collection of input tags --- writing this into `JDFTXInfile.__setitem__` is too extreme as it would require adding an attribute to `JDFTXInfile` to allow disabling the check --- the better solution would be to implement a more obvious user-friendly method for reading in additional inputs so that the user doesn't need to learn how to properly write out the dictionary representation of complicated tag containers. -- Fill out reference tags for other unimplemented boundaries - PR #4408 `to_jdftxinfile` method for JDFTXOutfile by @benrich37 Major changes: - feature 1: Method `to_jdftxinfile` for JDFTXOutfile(Slice) -- Uses internal `JDFTXInfile` and `Structure` to create a new `JDFTXInfile` object that can be ran to restart a calculation - feature 2: Method `strip_structure_tags` for `JDFTXInfile` -- Strips all structural tags from a `JDFTXInfile` for creating equivalent `JDFTXInfile` objects with updated associated structures - fix 1: Changing 'nAlphaAdjustMax' shared tag from a `FloatTag` to an `IntTag` - fix 2: Adding an optional `minval` field for certain `FloatTag`s which prevent writing error-raising values -- Certain tag options in JDFTx can internally be the minimum value, but trying to pass the minimum value will raise an error ## Todos - feature 1: Testing for the `to_jdftxinfile` -- I know the function works from having used it, but I haven't written in an explicit test for it yet. - fix 2: Look through JDFTx source code and identify all the numeric tag value boundaries and add them to the FloatTag. This will likely require generalizing how boundaries are tested as a quick glance (see [here](https://github.com/shankar1729/jdftx/blob/master/jdftx/commands/fluid.cpp#L378)) shows there are tags that actually do use the `>=` operator - Unrelated: Reduce bloat in outputs module -- Remove references to deprecated fields -- Begin phasing out redundant fields --- i.e. `JDFTXOutfile.lattice` redundant to `JDFTXOutfile.structure.lattice.matrix` -- Generalize how optimization logs are stored in outputs module objects --- Fields like `grad_K` are part of a broad group of values that can be logged for an optimization step, and the fields present in each log varies a lot more than I previously thought when I initially wrote the JDFTx outputs module. Generalizing how these are stored into a dictionary of arbitrary keys should make the outputs module more robust, as well as helping reduce the bloat in the outputs module. - PR #4407 JDFTXInfile addition (`__add__`) method tweak by @benrich37 Changing addition method - now infiles with shared keys will either concatenate their inputs if the key is for a repeatable tag, or change to whatever value is in the second infile if it is not a repeatable tag. A bare minimum `if subval in params[key]` check is done to avoid adding duplicate values. This seems like something the `set` built-in could help with, but since the sub-values are dictionaries, using `set` is a little more difficult Major changes: - fix 1: Addition of two JDFTXInfiles (`jif1 = jif2 + jif3`) no longer requires each `jif2` and `jif3` to have a unique set of tags -- For a non-repeatable tag 'key', `jif1['key'] == jif3['key']` -- For a repeatable-tag 'key', `jif1['key'] = jif2['key'] + [val for val in jif3['key'] if not val in jif2['key']` -- implemented in `src/pymatgen/io/jdftx/inputs.py` -- tested in `tests/io/jdftx/test_jdftxinfile.py` --- error raising test for conflicting tag values removed ## Todos - fix 1: Add more robust checking for if two repeatable tag values represent the same information. -- This is likely fixed by implementing the pre-existing TODO - "Add default value filling like JDFTx does" - fix 2: Incorporate something to collapse repeated dump tags of the same frequency into a single value. -- The 'dump' tag currently can get bloated very quickly, as the newly implemented change for concatenating two repeatable tags will not detect that something like `{"End": {"State": True}}` is technically already in a list that contains something like `{"End": {"State": True, "Berry": True}}` -- A cleanup function that can convert `{'dump': [{"End": {"State": True, "BGW": True}}, {"End": {"State": True, "Berry": True}}]` into `{'dump': [{"End": {"State": True, "BGW": True, "Berry": True}}]` would fix this bloat risk - PR #4404 Monoclinic Symmetry Handling Fix by @kavanase This issue is related to https://github.com/materialsproject/pymatgen/issues/1929 (for which a patch solution was added that fixed one case of this occurrence, but not in general). When handling monoclinic symmetry within `SpacegroupAnalyzer`, the standardisation attempts to reorder the lattice vectors depending on whether the alpha angle is >90 degrees or <90 degrees. If it is exactly 90 degrees, it defaults to the original lattice, however there was an issue with this implementation where it assumed that the beta and gamma angles were also 90 degrees (and so set the lattice matrix as `[[a, 0, 0], [0, b, 0], [0, 0, c]]`), which may not (and in most cases should not) be the case. This was causing weird behaviour for me where the volume of the primitive structures being returned by `SpacegroupAnalyzer` was different to `Structure.find_primitive()` (by a non-integer factor). I've added a test for this case, and also confirmed that the general implementation here works for the failure case noted in https://github.com/materialsproject/pymatgen/issues/1929 - PR #4406 `UFloat` update by @kavanase This is a minor addition to https://github.com/materialsproject/pymatgen/pull/4400. I found that there were some cases where an energy adjustment of `UFloat(0, 0)` were already present in `ComputedEntry.energy_adjustments`, avoiding the updated handling of setting `std_dev` to `np.nan` when it is 0 (and avoiding the `UFloat` warning about `std_dev` being 0). - PR #4403 Ensure structure symmetrization in OrderDisorderedStructureTransformation by @esoteric-ephemera Close #4402 by ensuring that structures are always symmetrized when `symmetrized_structures = True` in `OrderDisorderedStructureTransformation`. Also allow for passing distance/angle precision kwargs to do on-the-fly symmetrization. Add tests - PR #4401 JDFTXStructure - partial fix for special case lattice tags by @benrich37 Major changes: - fix 1: `pymatgen.io.jdftx.inputs.JDFTXStructure` -- `JDFTXStructure.from_jdftxinfile` no longer assumes 'lattice' tag is provided in 3x3 matrix format -- Testing in `tests/io/jdftx/test_jdftxinfile.py` for `Structure <-> JDFTXStructure <-> JDFTXInfile` conversion for `JDFTXInfile` with newly implemented special case values for 'lattice' tag TODO: - Implement `JDFTXStructure.from_jdftxinfile` for JDFTXInfile with special case tag 'lattice' value and non-identity value for 'latt-scale' tag - PR #4400 Use `np.nan` instead of 0 for no uncertainty with `ufloat`, to avoid unnecessary warnings by @kavanase Closes #4386 - PR #4399 JDFTXOutfile `none_on_error` oversight fix by @benrich37 - Fixing an error in `pymatgen/io/jdftx/outputs.py` that causes construction of a `JDFTXOutfile` to fail if none_on_error is turned on and the final `JDFTXOutfileSlice` in `slices` is None (ie a very common issue when parsing an interrupted job that hasn't restarted yet). - PR #4397 JDFTx IO Module Overhaul by @benrich37 - Revised typing for updated `mypy` criteria - Support for parsing JDFTx AIMD files - Expanded input tag support - PR #4394 Updates to JDFTx inputs `generic_tags` helper module by @benrich37 Major changes: - Phasing out use of redundant `TagContainer.multiline_tag` attribute -- (this change may cause problems without the corresponding changes in `jdftxinfile_master_format.py`, but all the tests still pass. Just in case, I will be prioritizing finishing merges for the JDFTx inputs module to avoid any untested consequences) - Fixing indentation on output of `TagContainer.write` - Removing the warning (and the test for this warning) on special constraints for "ion" tag -- Support for special constraints has been implemented on my fork and a PR for this support will soon be created - PR #4392 Brute force order matcher speedup by @kavanase This is a small PR to add a `break_on_tol` option to `BruteForceOrderMatcher`, which allows one to massively speed up the molecule matching in cases where one just cares _if_ the molecules match within a given RMSD (rather than screening over _all_ possible permutations, to get the lowest possible RMSD). The speedup factor can be anywhere from 0% to several orders of magnitude, depending on the number of possible permutations and when a matching permutation is found. Also includes a small typo fix that for an error message that reference the original class name (in https://github.com/materialsproject/pymatgen/pull/1938) which was later renamed. I've also added some tests for this. - PR #4393 Update JDFTx IO output utils private module by @benrich37 Major changes: - function `get_colon_var_t1` -- Renaming to `get_colon_val`, but keeping an alias until renaming is updated outside this module -- Returning `np.nan` instead of `None` when "nan" is the value - updating `correct_geom_opt_type` for working with JDFTx AIMD out files - updating typing on array-construction functions - correcting ordering and syntax of orbital labels to exactly match JDFTx - PR #4389 Adding missing reference options to JDFTx inputs submodule by @benrich37 Beginning process of merging over stress-test updates, starting with missing options for JDFTx input files - Added missing DFT functional names - Added missing subtags for elec-minimize

v2025.5.2
? · 2025-05-02

- Remove lxml since it is slower for many Vasprun parsing situations.

v2025.5.1
? · 2025-05-01

- lxml is now used for faster Vasprun parsing. - Minor bug fix for MPRester.get_entries summary_data for larger queries. - New JSON for ptable with better value/unit handling (also slightly faster) (@DanielYang59) - Handle missing trailing newline in ICOHPLIST.lobster (@alibh95) - Updated MVLSlabSet with MPSurfaceSet parameters from atomate1 (@abhardwaj73)

v2025.4.24
? · 2025-04-24

- Structure now has a calc_property method that enables one to get a wide range of elasticity, EOS, and phonon properties using matcalc. Requires matcalc to be installed. - Bug fix and expansion of pymatgen.ext.matproj.MPRester. Now property_data is always consistent with the returned entry in get_entries. Summary data, which is not always consistent but is more comprehensive, can be obtained via a summary_data kwarg. - PR #4378 Avoid merging if a structure has only one site by @kmu This PR fixes an error that occurs when calling `merge_sites` on a structure with only one site. For example: - PR #4372 Reapply update to ptable vdw radii CSV source and JSON with CRC handbook by @DanielYang59 - Update ptable vdw radii CSV source, to fix #4370 - [x] Revert #4345 and apply changes to CSV vdw radii data source: > John R. Rumble, ed., CRC Handbook of Chemistry and Physics, 105th Edition (Internet Version 2024), CRC Press/Taylor & Francis, Boca Raton, FL. > If a specific table is cited, use the format: "Physical Constants of Organic Compounds," in CRC Handbook of Chemistry and Physics, 105th Edition (Internet Version 2024), John R. Rumble, ed., CRC Press/Taylor & Francis, Boca Raton, FL.

v2025.4.20
? · 2025-04-20

- Updated `perturb` method to be in parity for Structure and Molecule. - PR #4226 Fix file existence check in ChargemolAnalysis to verify directory instead. by @lllangWV - PR #4324 GibbsComputedStructureEntry update to handle float temperature values by @slee-lab - PR #4303 Fix mcl kpoints by @dgaines2 Fixed errors in two of the k-points for the MCL reciprocal lattice (according to Table 16 in Setyawan-Curtarolo 2010) M2 and D1 aren't included in the recommended k-point path, but third-party software that plots k-point paths using pymatgen labelled M2 in the path instead of M1 due to it being the "same" k-point. - PR #4344 Update "electron affinities" in `periodic_table.json` by @DanielYang59 - PR #4365 Python 3.13 support by @DanielYang59