- 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 aJOutStructures
with a try/except block - fix 4: Detect if positions were only partially dumped and revert to data from
init_structure
inJOutStructure
- 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
- feature 1: Improved durability of
- 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 argumentsexclude_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 inJDFTXInfile.is_comparable_to
to get filtered differing tags betweenJDFTXInfile
objects
--- Convenient as a "verbose" alternative toJDFTXInfile.is_comparable_to
--AbstractTag.is_equal_to
andAbstractTag._is_equal_to
--- Used in tag comparison for finding differing tags
---AbstractTag._is_equal_to
is an abstract method that must be implemented for eachAbstractTag
inheritor - feature 2: Default
JDFTXInfile
objectpymatgen.io.jdftx.inputs.ref_infile
-- Initialized from reading default JDFTx settings frompymatgen.io.jdftx.jdftxinfile_default_inputs.default_inputs: dict
-- Used inJDFTXInfile.get_differing_tags_from
for tags inself
missing fromother
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'
insite_properties
for aStructure
passed inJDFTXInfile.from_structure
(used ifselective_dynamics
argument left asNone
)
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 filledTagContainer
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
- feature 1: Convenience methods for comparing
- 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 pymatgenBandStrucure
object
-- Request-able as astore_var
, but functions slightly differently
--- Ensures 'eigenvals' and 'kpts' are instore_vars
and then is deleted
-- Initialized if JDFTXOutputs has successfully stored at least 'kpts' and 'eigenvals'
-- Fillsprojections
field if also has stored 'bandProjections' - feature 3: Added
wk_list
toJDFTXOutputs
-- List of weights for each k-point
-- Currently doesn't have a use, but will be helpful forElecData
initializing incrawfish
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 ofkpoint-folding
is most likely an indicator of a band-structure calculation
- feature 1: Added 'kpts' storable variable to JDFTXOutputs
- PR #4415 speed-up Structure instantiation by @danielzuegner
This PR speeds up the instantiation ofStructure
objects by preventing hash collisions in thelru_cache
ofget_el_sp
and increasing itsmaxsize
. The issue is that currentlyElement
objects are hashed to the same value as the integer atomic numbers (e.g.,Element[H]
maps to the same hash asint(1)
). This forces thelru_hash
to perform an expensive__eq__
comparison between the two, which reduces the performance of instantiating manyStructure
objects. Also here we increase themaxsize
ofget_el_sp
'slru_cache
to 1024 for further performance improvements.
This reduces time taken to instantiate 100,000Structure
objects from 31 seconds to 8.7s (avoid hash collisions) to 6.1s (also increasemaxsize
to 1024). - PR #4410 JDFTx Inputs - boundary value checking by @benrich37
Major changes:- feature 1: Revised boundary checking for input tags
-- Added avalidate_value_bounds
method toAbstractTag
, that by default always returnsTrue, ""
-- Added an alternateAbstractNumericTag
that inheritsAbstractTag
to implementvalidate_value_bounds
properly
--- Changed boundary storing to the following fields
----ub
andlb
----- Can either beNone
, or some value to indicate an upper or lower bound
----ub_incl
andlb_incl
----- If True, applies>=
instead of>
in comparative checks on upper and lower bounds
-- Switched inheritance ofFloatTag
andIntTag
fromAbstractTag
toAbstractNumericTag
-- Implementedvalidate_value_bounds
forTagContainer
to dispatch checking for contained subtags
-- Added a methodvalidate_boundaries
toJDFTXInfile
to runvalidate_value_bounds
on all contained tags and values
-- Addedvalidate_value_boundaries
argument for initialization methods ofJDFTXInfile
, which will runvalidate_boundaries
after initializingJDFTXInfile
but before returning when True
--- Note that this is explicitly disabled when initializing aJDFTXInfile
from the input summary in aJDFTXOutfileSlice
- 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 aJDFTXInfile
, 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-existingJDFTXInfile
object
--- boundary checking is currently only run when initializing from a pre-existing collection of input tags
--- writing this intoJDFTXInfile.__setitem__
is too extreme as it would require adding an attribute toJDFTXInfile
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
- feature 1: Revised boundary checking for input tags
- PR #4408
to_jdftxinfile
method for JDFTXOutfile by @benrich37
Major changes:- feature 1: Method
to_jdftxinfile
for JDFTXOutfile(Slice)
-- Uses internalJDFTXInfile
andStructure
to create a newJDFTXInfile
object that can be ran to restart a calculation - feature 2: Method
strip_structure_tags
forJDFTXInfile
-- Strips all structural tags from aJDFTXInfile
for creating equivalentJDFTXInfile
objects with updated associated structures - fix 1: Changing 'nAlphaAdjustMax' shared tag from a
FloatTag
to anIntTag
- fix 2: Adding an optional
minval
field for certainFloatTag
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) 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 toJDFTXOutfile.structure.lattice.matrix
-- Generalize how optimization logs are stored in outputs module objects
--- Fields likegrad_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.
- feature 1: Method
- 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 minimumif subval in params[key]
check is done to avoid adding duplicate values. This seems like something theset
built-in could help with, but since the sub-values are dictionaries, usingset
is a little more difficult
Major changes:- fix 1: Addition of two JDFTXInfiles (
jif1 = jif2 + jif3
) no longer requires eachjif2
andjif3
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 insrc/pymatgen/io/jdftx/inputs.py
-- tested intests/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
- fix 1: Addition of two JDFTXInfiles (
- PR #4404 Monoclinic Symmetry Handling Fix by @kavanase
This issue is related to #1929 (for which a patch solution was added that fixed one case of this occurrence, but not in general).
When handling monoclinic symmetry withinSpacegroupAnalyzer
, 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 bySpacegroupAnalyzer
was different toStructure.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 #1929 - PR #4406
UFloat
update by @kavanase
This is a minor addition to #4400.
I found that there were some cases where an energy adjustment ofUFloat(0, 0)
were already present inComputedEntry.energy_adjustments
, avoiding the updated handling of settingstd_dev
tonp.nan
when it is 0 (and avoiding theUFloat
warning aboutstd_dev
being 0). - PR #4403 Ensure structure symmetrization in OrderDisorderedStructureTransformation by @esoteric-ephemera
Close #4402 by ensuring that structures are always symmetrized whensymmetrized_structures = True
inOrderDisorderedStructureTransformation
. 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 intests/io/jdftx/test_jdftxinfile.py
forStructure <-> JDFTXStructure <-> JDFTXInfile
conversion forJDFTXInfile
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
- fix 1:
- PR #4400 Use
np.nan
instead of 0 for no uncertainty withufloat
, 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 aJDFTXOutfile
to fail if none_on_error is turned on and the finalJDFTXOutfileSlice
inslices
is None (ie a very common issue when parsing an interrupted job that hasn't restarted yet).
- Fixing an error in
- PR #4397 JDFTx IO Module Overhaul by @benrich37
- Revised typing for updated
mypy
criteria - Support for parsing JDFTx AIMD files
- Expanded input tag support
- Revised typing for updated
- 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 injdftxinfile_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
- Phasing out use of redundant
- PR #4392 Brute force order matcher speedup by @kavanase
This is a small PR to add abreak_on_tol
option toBruteForceOrderMatcher
, 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 #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 toget_colon_val
, but keeping an alias until renaming is updated outside this module
-- Returningnp.nan
instead ofNone
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
- function
- 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