Repository navigation
Conversation
Transfers 62 commits of work from the benrich37 fork that were built on top of the pre-reorganization pymatgen jdftx module. History of individual changes is preserved in benrich37/pymatgen master branch. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Import all JDFTx changes from benrich37/pymatgen fork master branch
Sync from main
…he first place instead of initializing as a list of None (causes a lot of annoying UserWarning's down the line)
… almost-good-enough version of "add-U" parameter to the jdftxinfile master format file
…ss treatment for now
… to allow functionality, tests to ensure tag works as expected, deleting old "deleteme" file
…n order-sensitive values, enforced ordered equality in AbstractTag.is_equal_to. Added AbstractTag.read_from_tokens which by default behaves the same as `read` but also returns the number of tokens read. For TagContainer, read_from_tokens now performs a read on provided tokens until an unreadable token is encountered. Changed `TagContainer.read` behavior within subtag loop for positional subtags (subtags without written tagnames) to now call `_read_positional_subtag` (which relies on `read_from_tokens` instead of regular `read` to allow for possibly reading and discarding more than one token for a subtag. Moved initial magnetic moments validations to the JDFTXInfile class. Added a `get_species_values_tag_container` convenience function for initializing "initial-magnetic-moments" and "initial-oxidation-state" as a regular TagContainer instead of the old two-purpose InitMagMomTag. Removed `InitMagMomTag` as it is no longer needed. Added docustrings to helper functions in io/jdftx/inputs.py missing docustrings.
…lues are caught. Structure of "add-U" tag changed to contain a single "U-channels" subtag, which contains the expected structure of the "add-U" tag - this is done to allow JDFTx's behavior of not allowing multiple add-U lines, but obviously accepting multiple species to have add-U values described in that one line Changes made to `TagContainer.read_from_tokens` to prevent possible subtag keys from being read as values.
…e removal_path with _get_removal_path, and call _remove_at_path for each removal_path to remove that bad tag/subtag - prevents attempting to remove duplicate paths, and prioritizes deeper subtags and later pop indices to protect from removing tag paths with parents already removed and to protect from index shifting.
…att-scale subtags being specified as IntTag's instead of FloatTag's, added tests for converting named lattices to pymatgen Lattice objects.
…uations Lines ending in "\" are now joined with the following line by a single re.sub in JDFTXInfile.from_str. The previous _gather_tags implementation is kept commented out in case the regex approach is not accepted. Added test_line_continuation to check whitespace/comment handling around continuations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… function, adding testing for selective_dynamics_site_prop_to_jdftx_interpretable
…behavior can be reproduced in a single line and is only called once. Added test to test_jdftxinfile/test_jdftxstructure_infile_site_properties_conversion to ensure behavior is kept the same
…anmaps` which cleaned the values well enough itself such that the function could be replaced by np.nan. Removed `io.jdftx.inputs.get_popmaps`, since JDFTXInfile's dict inheritance allows `get_nanmaps` to operate directly on a JDFTXInfile.
…r `next` iteration. Added test to `io.jdftx.test_jdftxinfile` to ensure label fallback system performs as expected. Removed _multi_has/getattr functions and testing as they are no longer being used.
…ure.get_str` in `io.jdftx.inputs`, adding test to `test_jdftxinfile` to ensure changes to unit-converting code still works as intended.
…ded testing to ensure specie names of pmg Structure objects are left intact in JDFTXStructure.structure
…ding test to ensure hyperplane data can be safely passed back and forth between JDFTXStructure and JDFTXInfile tag reading/writing
…ystems for constraint vectors, fixed constraints being lost when a JDFTXInfile was initialized from a structure with constraints encoded into site properties, protect. Added error raising for some constraints which JDFTx would reject. General fixes to old misconception that ion prints will always be homogeneous shaping (this assumption breaks for some special case constraint types).
…MD output + testing
…n in eV / A + testing
… from standard JDFTx units to A / fs + testing
…m on top of regular parsing to allow `JDFTXOutfile.to_jdftxinfile` to exactly reproduce the ion coordinates without risk of rounding. On top of this, structural tags are now stored to 15 decimal precision (previously 12) to match JDFTx's output. `to_jdftxinfile` now also retains the coords-type of the originating output file. Fixed bug where JDFTXInfile.strip_structure_tags stripped a non-existent "lattice-scale" instead of "latt-scale". Fixed `_infile_special_format_to_pmg_lattice` which previously used pymatgen's built in Lattice construction - there is unfortunately a mismatch between pymatgen and JDFTx, where pymatgen begins by orienting the third lattice vector along the z axis, while JDFTx begins by orienting the first lattice vector along the x axis. Fixed bug in `condense_jdftxinputs` where any vestigial structure tags in the jdftxinput argument would remain in the condensed JDFTXInfile object.
…pdating linting to match upstream
…_parse_emin_lines` into a ValueError to allow the higher up error catchers to catch it instead of aborting the whole parse
…r slices that failed to parse and raise a ValueError if ALL slices failed to parse
…t options to avoid issues with exact-case matching checks down the line
… to set up ASE in testing environment I moved this all to pymatgen-core, so when the homogeneity protections got removed the tests that should have failed were not being ran). Adding a `_sync_movescale_and_selective_dynamics` to be called in the `JDFTXStructure` post-init to ensure movescales and selective dynamics agree with each other (if a movescale > 0, sd should be [1,1,1], else [0,0,0]). Remove unnecessary conversions of movescales to selective dynamics. Make "movescale" just as easy to set as a "selective_dynamics" (since they both encode overlapping but also unique information)
…t very complicated, so to err on the side simplicity fixing an atom in place with either movescale or selective dynamics os absolute
…moving the now-unused JDFTXOutfileSlice._get_initial_structure, deleting commented out code
…. To block bad in files with errors, run JDFTXInfile.validate_boundaries() directly without the warn_only=True kwarg
…aising a warning and freezing the atom
…of misc_fixes) First branch of the misc_fixes split (misc_fixes <- A1 <- A <- B0 <- B <- C), built on the head of misc_fixes (73f2d02). This commit removes every JDFTx change of misc_fixes except the fixes listed below, so the branch's diff against upstream/main is A1 alone. The branches above re-add the rest, one division each, and misc_fixes_C ends at the tree of misc_fixes again. What the branch keeps: tag-table and generic-tag fixes that work on upstream/main alone, with their input-level tests. Every line is in its final misc_fixes form. - electric-field / perturb-electric-field Ex/Ey/Ez are FloatTags (were IntTags) - latt-scale s0/s1/s2 are FloatTags (were IntTags) - perturb-incommensurate-wavefunctions EcutOld is a FloatTag - rhoExternal includeSelfEnergy is a yes/no BoolTag (was a FloatTag) - Vexternal filename subtags use write_tagname=False, so both forms parse - van-der-waals: D3BJ option; a bare van-der-waals reads as 0.0 (new FloatTag.value_if_bare) - charged-defect-correction is a MultiformatTag of its three JDFTx forms - perturb-minimize algorithm options are CG|MINRES (was MINRES|CGIMINRES) - fluid-solvent: CHCl3 option - dump: HC variable - IntTags for electron-scattering computeRange iqStart/iqStop (lb=1), density-of-states Slice/AtomSlice Miller indices, and the fluid quad_nAlpha/quad_nBeta/quad_nGamma (with JDFTx's bounds) - MultiformatTag.validate_value_bounds checks the bounds of the format the value matches (each entry of a repeated tag on its own); a nan passes any bounds check - StrTag options match ignoring case, and read as the option's own spelling Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Second PR of the misc_fixes split (misc_fixes <- A1 <- A <- B0 <- B <- C). This commit re-adds the inputs side that A1's commit stripped. It changes only the inputs side of pymatgen.io.jdftx; the outputs modules are still upstream's and keep working with it. Tag table and machinery (jdftxinfile_master_format.py, jdftxinfile_ref_options.py, generic_tags.py), on top of A1: - new commands and options (add-U, initial-oxidation-state, chargeball, setVDW, set-atomic-radius, metadynamics-bond, vibrations iConfiguration / nConfigurations, hyb-HSE06 with a JDFTXOptionWarning, ...) - elec-n-bands as a TagContainer with an optional multiplier - JDFTx's bounds on fluid, pcm-params, electron-scattering and quad subtags - repeatable tau-core, fluid-cation/anion, dump-Eresolved-density, elec-ex-corr-compare, dump-fermi-density - ion moveScale as a float; thermostat/barostat-velocity of any chain length - fluid-site-params, debug, pcm-params, ClassicalDFT fluid echoes readable; density-of-states keeps its subcommand order - SubcommandTagContainer, StrListTag, positional multi-token subtags, new tag fields; InitMagMomTag removed (initial-magnetic-moments is a TagContainer, validated by JDFTXInfile) JDFTXInfile (inputs.py, jdftxinfile_default_inputs.py, sets.py): - default value filling for comparisons with JDFTx's echo - JDFTx species names (jdftx_species site property) - read_line, from_str(skip_invalid_tags=...), nan handling - include spliced in place; deep copy(); `+` appends repeatable tags - out-of-bounds values warn when read; validate_boundaries() raises - fixes to strip_structure_tags, condense_jdftxinputs, get_filtered_differing_tags, from_structure(ignore_site_properties=True) JDFTXStructure (inputs.py): - velocities in Cartesian A/fs and constraint vectors carried between Structure, JDFTXStructure and JDFTXInfile - named lattices built as JDFTx does, with latt-scale, C-ordered - movescale and selective dynamics kept in sync (partial selective dynamics raises NotImplementedError); ions grouped like JDFTx - structural tags written with 15 decimals Tests: input-level tests for all of the above, new fixture test_jdftx_in_files/aimd.in. The out-file regression tests for these fixes and test_get_differing_tags_fills_defaults need the outputs PR (B) and ship there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The fix needs an atomate2 update (two atomate2 tests index ["fluid-cation"] as a dict), so it goes to the end of the split, after the branches that do not: misc_fixes <- A1 <- A <- B0 <- B <- C <- D. Taken out here, and put back unchanged by misc_fixes_D: - can_repeat=True on tau-core, fluid-cation, fluid-anion, dump-Eresolved-density, elec-ex-corr-compare and dump-fermi-density (jdftxinfile_master_format.py) - the fluid ions in _fill_default_values (inputs.py), which returns their value as a list; here it handles fluid-solvent only - tests: test_repeatable_commands, test_repeated_commands_in_jdftx_echo_are_all_read, test_repeatable_tags_match_jdftx, test_adding_infiles_appends_repeatable_commands, test_fluid_ion_echo_is_read_and_written_back, the elec-ex-corr-compare case of test_hse06_is_accepted_with_a_warning, and the list form of two expected values in inputs_test_utils.py Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Member
|
Automated PR review generated by Claude (posted from @shyuep's account). Based on code and CI status only, nothing was run. Please sanity-check before acting. CI: all 5 checks green. Scope: the diff includes #319. This PR's own increment (b53e226 plus the move of the repeatable-tags fix to #324, ~325 kB) is mostly the inputs half of #317, which was reviewed there twice. This review covers the description, Good:
Substantive:
Nits:
|
This was referenced Nov 20, 2026
…th a warning A dict stored before velocities and constraints were kept in Cartesian angstrom (and fs) holds them as its ion lines had them, in coordinates it doesn't record. Such a dict has no movescale key, so from_dict now reads only what it read then (the structure and selective_dynamics) and warns about what it leaves out, instead of reading the old values as Cartesian angstrom/fs. Also adds a TODO for decoding arrays stored with dumpfn/MontyEncoder. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
Author
|
This branch has not been deployed
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.
[breaking] JDFTx IO Module Overhaul pt 2 - input tags,
JDFTXInfileandJDFTXStructureSummary
Merge order: this is the second of the six PRs that #317 is split into (
misc_fixes_A).misc_fixes_A1needs to be merged first, andmisc_fixes_B0,misc_fixes_B,misc_fixes_Candmisc_fixes_Dshould be merged after it, in that order.This PR holds the inputs side of #317: the rest of the tag definition fixes, the reworked tag classes, and the changes to
JDFTXInfileandJDFTXStructure. The outputs modules aren't touched and keep working with it. Untilmisc_fixes_A1is merged, the diff of this PR also shows its changes.Note for reviewers:
- This PR may contain something to be considered arbitrary code execution The body of
JDFTXInfile._get_linesin this PR has been shrunk to a single line usingre.sub. Please let me know if this is acceptable or not. The old body of this function and its helper are no longer kept commented out in the code, but I can restore them if the current version is not okay.- The out-file tests of these fixes are in
misc_fixes_B, since they need its parsing fixes. This PR tests them on input files.Major changes:
Inputs - tag definitions (
jdftxinfile_master_format.py,jdftxinfile_ref_options.py)--
add-U(stored under a single repeatableU-channelssubtag, since JDFTx takes only oneadd-Uline holding every species)--
initial-oxidation-state,chargeball,setVDW,set-atomic-radius,metadynamics-bond--
vibrationssubtagsdumpK,iConfiguration,nConfigurations(JDFTx builds since 2026-08-27 echo the last two even when unset, so their vibrations out files failed to parse)--
phiCavityforpcm-params,centerforionic-gaussian-potential--
fluid-site-paramscomponents now supports all 21 options (was 11)--
hyb-HSE06forelec-ex-corr/elec-ex-corr-compare--- Previously left out on purpose, but now gives a
JDFTXOptionWarningwhen readelec-n-bandsis now aTagContainerwith an optionalmultiplier-- JDFTx since 6ffe5cf0 (Oct 2025) the elec-n-bands format was switched from
elec-n-bands <n>toelec-n-bands <n> <multiplier>pcm-params,fluid-solvent/fluid-cation/fluid-anionandfluid-site-params, taken from the JDFTx source (ieepsBulk> 1, was > 0)--
ion'smoveScalecorrected fromIntTagtoFloatTag--
pcm-params'slMaxandionic-dynamics'schainLengthT/chainLengthPcorrected fromFloatTagtoIntTag--
fluid-site-params(now JDFTx's syntax,fluid-site-params <component> <siteName> <key> <value> ...)--
debugwith several options on one line--
pcm-paramsas JDFTx echoes it (emptycavityFile)-- ClassicalDFT
fluid-solvent/fluid-cation/fluid-anion(JDFTx echoestranslationastranslationMode)-- The fluid
representationsubtag is now a string option (MuEps/Pomega/PsiAlpha) instead of a container of float subtagsdensity-of-stateskeeps the order of its subcommands, since JDFTx'sOccupied/Complete/SpinProjected/SpinTotalflags apply to the weights after them-- ie JDFTx's own echo
Complete Total Occupied Orbital H 1 sused to be written back with the Orbital column before both flags, andTotal Occupied Totalraisedinitial-magnetic-momentsis read into per-species values (previously was a single purposeInitMagMomTag, which just kept the line as a string and compared equal to any other value)-- New
JDFTXInfile.validate_initial_magnetic_momentschecks it againstspintypeand theiontags (not run automatically) to ensure the initial-magnetic-moments command is compatible. It rejects moments for no-spin and spin-orbit runs (following JDFTx's behavior) and compares species (case insensitive, also a JDFTx behavior)-- Old-format serialized values can still be parsed
thermostat-velocityandbarostat-velocitytake any number of values, as JDFTx does (they were fixed at 3 and 9 values, which only fits the defaultchainLengthT/chainLengthP)-- Their values are now
{"v": [...]}instead of{"v1": ..., "v2": ..., ...}(the old form is still accepted)Inputs - tag machinery (
generic_tags.py)SubcommandTagContainerfor commands whose subcommands are ordered (fordensity-of-states)StrListTagfor several string options on one line (fordebug)--
StrTag.option_warnings(to raise the newJDFTXOptionWarning),StrTag.empty_means_unset(for compatibility with input echos),StrTag.species_name(boolean to trigger some functionality to allow setting non-standard specie names like "Fe1" instead of "Fe" without breaking anything)--
TagContainer.subtag_aliases(ie JDFTx echoestranslationof a ClassicalDFT fluid component astranslationMode),TagContainer.bare_is_noop--
AbstractTag.orderedfor repeatable tags whose order matters when comparingAbstractTag._read_from_tokens, so positional subtags can read more than one tokenwarn_userargument forvalidate_value_typeto preventMultiformatTagfrom raising warnings to the user when deciding on a format typeTagContainer.writewrites subtags in definition order, not the dict's key order-- ie setting
{"EcutRho": 100, "Ecut": 20}would writeelec-cutoff 100.0 20.0which JDFTx would parse as a 100 Ha planewave cutoff and a 20 Ha density cutoffFloatTagaccepts ints (not bools) and converts them to floatsMultiformatTagare each validated, compared and written with their own format (helpful forionlines where only some ions have a special-format constraint)InitMagMomTag(see tag definitions fix 4)Inputs -
JDFTXInfile--
get_differing_tags_from(and soget_differing_tags,get_filtered_differing_tagsandis_comparable_to) now fills missing tags and subtags with JDFTx's defaults, so an input compares equal to JDFTx's echo of it-- Covers the defaults that depend on other tags (
fluid-minimizeper fluid type,ion-widthfor PCMs,lcao-paramswith smearing, andfluid-solventparameters per solvent and temperature), checked against 70 JDFTx dry runs-- This was the default value filling left as a todo in Inputs - JDFTx IO Module pymatgen#4189 and
JDFTXInfileComparison Methods pymatgen#4416ionaccepts JDFTx species names (species named after pseudopotential files, ieFe1/Fe2for an antiferromagnet), ignoring case as JDFTx does (ieion fe ...raised)-- The element is the element symbol the name starts with (limitation: a C pseudopotential named
Cs1.upfreads as Cs)-- Structures carry the names in a new
jdftx_speciessite property (only when some name isn't its element symbol, so existing structures are unchanged), andfrom_structurewrites them back-- New helpers
get_species_elements,get_species_names(ininputs) andelement_from_species_name(ingeneric_tags)read_lineconvenience method for adding one line to aJDFTXInfilefrom_str(skip_invalid_tags=...), so one unreadable command gives a warning instead of an error (misc_fixes_Buses it for the input echoed in an out file)clean_infile_of_nansandwrite_file(strip_nan=...)-- The deepest subtags and latest indices are removed first, so removing one nan can't shift or orphan another
includenow splices the included file's lines in place, like JDFTx, instead ofdict.update-ing the included file over the main one-- Repeatable tags from both files are kept in order (the included file's
ionlines replaced the main file's); a non-repeatable tag in both files raises (JDFTx refuses those inputs too; the included file's value used to win); cyclic includes raiseValueError(was unbounded recursion); nested includes are also looked up next to the main file-- A missing include file gives a warning and keeps the
includeline (it raised)copy()is a deep copy (and skips the value-boundary checks)jif1 + jif2validates the resultstrip_structure_tagsstripslatt-scale(it stripped a non-existent "lattice-scale", solatt-scalegot applied twice on restarts)condense_jdftxinputsreplaces the structure tags already in the input instead of adding to them (it left the old ions next to the new ones when they differed)get_filtered_differing_tagsre-includes a tag fromensure_include_tagseven if it was excluded twice (named inexclude_tagsand in an excluded category)from_file,from_str,from_dict,read_line) instead of raising, so stored inputs and the inputs echoed in out files stay loadable-- The values are kept, but left out when the input is written
--
validate_boundaries()still raises when called directly; its newwarn_onlyargument gives the warning insteadInputs -
JDFTXStructureStructuresite properties,JDFTXStructureandJDFTXInfile--
JDFTXInfile.from_structuretakesmovescale,velocities,constraint_types,constraint_vectors,hyperplane_group_namesandignore_site_properties--
fill_site_propertiesargument added toto_pmg_structure,to_jdftxstructureandfrom_jdftxinfile--
JDFTXStructure's initializer takes any of these it isn't given from the structure's site properties (selective_dynamics,movescale,velocities,constraint_types,constraint_vectors,group_names) and keeps the structure's other site properties (it kept onlyselective_dynamics)--
JDFTXStructure.from_dictcan read them back-- Velocities and constraints become site properties only when they form regular arrays (ie not for constraints on only some ions), so the structure still converts to ASE
Atoms. Otherwise they are kept as attributes of theJDFTXStructuremoveScaleis kept as its own per-site value, so fractional values are no longer lost: newJDFTXStructure.movescaleattribute,movescalesite property andmovescaleargument ofJDFTXInfile.from_structure--
selective_dynamicsis kept in sync with it ([True, True, True]for a non-zeromoveScale,[False, False, False]for 0)-- A site is fixed if either
movescaleorselective_dynamicsmarks it fixed, with a warning where they disagree. Amovescaleargument replaces theselective_dynamicssite property-- A negative
moveScale, or amovescale/selective_dynamicslist of the wrong length, raisesValueError-- Selective dynamics that fix only some directions of a site raise
NotImplementedError, since JDFTx'smoveScaleapplies to every direction (such sites were frozen without a warning)lattice Cubic 10,lattice Monoclinic ...)-- Interpret units as Bohr (JDFTx's length unit) instead of A and apply
latt-scale-- Fix the explicit lattice construction to match JDFTx's
GridInfo::setLatticeVectorsconvention (fix lattice "a" along the x axis) instead of pymatgen's (fix "c" along z axis) (would cause Monoclinic/Rhombohedral/Triclinic lattices to come out rotated)-- Constraints in
ionlines are no longer dropped into_jdftxstructure(it looked for a "constraint-type" key, the tag's is "constraint type") and never written back, andHyperPlaneconstraints raised-- They are now read, converted between lattice and Cartesian coordinates (a
Lineardirection is covariant, aPlanar/HyperPlanenormal contravariant, as in JDFTx), kept as site properties (see feature 1) and written back-- Constraints JDFTx would reject now raise (unknown type, missing or zero vector, a constraint on a fixed ion, several hyperplanes without group names)
sort_structure=Truesorts the sites into the order JDFTx prints them in, and the per-site data (selective_dynamics,movescale, velocities, constraints) with them-- The per-site data wasn't sorted with the sites, so ie the
moveScaleflags ended up on the wrong ions-- JDFTx groups the ions by species, in the order the species first appear (ie
O,H,Ois printed asO,O,H). The sort was by electronegativity (H,O,O), so the sorted structure didn't line up with the out file-- Species are told apart by their names, ignoring case, so interleaved
Fe1/Fe2sites are grouped too-- The order can still differ from JDFTx's if the input names pseudopotential files with
ion-speciescommands (instead of a$IDwildcard), since JDFTx then orders the species as those commands do (noted in the docstrings, see Todos)__post_init__Removals
InitMagMomTag(see tag definitions fix 4)Tests and test files
test_jdftx_in_files/aimd.in_multi_hasattr/_multi_getattr, which are goneChecklist
uv run pytest tests/core -k latticefor a lattice change — the full suite runs in CI)
pytest tests/io/jdftx: 458 passeduv run ruff check . && uv run ruff format --check .src/pymatgen/io/jdftxalso passes, and mypy reports no error in a JDFTx fileBreaking changes?
behavior changes, changed defaults/output, dropped Python versions, ...).
If so, prefix the title with
[breaking]and describe the change andmigration steps under
## Breaking Changesbelow.Breaking Changes
All of these are in
pymatgen.io.jdftx.Removed:
generic_tags.InitMagMomTag.initial-magnetic-momentsis now aTagContainer, so its value is a dict ({"species-values": [{"species-id": "Fe", "values": [...]}, ...]}) instead of a string.Changed
JDFTXInfilevalues (old forms that still work are noted):density-of-statesis a list of single-key dicts in order ([{"Etol": 1e-6}, {"Complete": True}, {"Total": True}, {"Orbital": {...}}]) instead of a dict. The old dict form (including old serializedJDFTXInfiles) is still accepted and read in dict order.elec-n-bandsis a dict ({"n": 14}, optionally with"multiplier") instead of an int. Setting an int still works.representationsubtag is a string ("MuEps","Pomega"or"PsiAlpha").ionmoveScaleis now a float, and ion lines are written with it (1.0instead of1).pcm-paramslMaxandionic-dynamicschainLengthT/chainLengthPare now ints. Files with the old forms still read.fluid-site-paramsis written and read in JDFTx's syntax (fluid-site-params <component> <siteName> <key> <value> ...). The old pymatgen form (component H2O siteName O ...), which JDFTx doesn't accept, now raises. The dict keys are unchanged.thermostat-velocityandbarostat-velocityare{"v": [...]}with any number of values, instead of{"v1": ..., "v2": ..., ...}. Setting the old form still works.Changed
JDFTXInfilebehavior:from_file,from_str,from_dict,read_line) gives a warning instead of raisingValueError. The value is kept, and left out when the input is written. The check now also covers the new bounds (ieepsBulk 1,rhoMin 0). For the error, callvalidate_boundaries()on the result. Passvalidate_value_boundaries=Falseto skip the check.includesplices the included file in place instead of updating the main file with it. A non-repeatable tag set in both files raisesValueError, and so does a cyclic include. A missing include file gives a warning instead of raising.hyb-HSE06is accepted with aJDFTXOptionWarninginstead of being rejected.TagContainer.writewrites subtags in definition order, so written lines can differ in subtag order from before.jif1 + jif2validates its result, andcopy()is now a deep copy instead of shallow.Changed
JDFTXStructureand structures built from inputs:ionline). SerializedJDFTXStructuredicts made before this change hold velocities as given in theionline, sofrom_dictleaves them out of such a dict (as it did before) and now warns about it. Re-create them from the original files to keep the velocities.lattice Cubic|Tetragonal|Orthorhombic|Hexagonal|Rhombohedral|Monoclinic|Triclinic ...) are converted from bohr to Å (the lengths were used as Å),latt-scaleis applied to them, and they are oriented like JDFTx (first vector along x). Lattice matrices and Cartesian coordinates from such inputs change.ionlines are read (they were dropped) and kept, with velocities, as site properties of the structure when they form regular arrays (ie constraints on only some ions stay attributes of theJDFTXStructure). Constraint vectors are Cartesian. Passfill_site_properties=Falseto leave these site properties out.movescalesite property next toselective_dynamics(also withfill_site_properties=False), andJDFTXStructure.selective_dynamicsis a list of per-direction booleans ([[True, True, True], ...]) instead of one 0/1 value per site.[True, True, False]from a POSCAR slab) raiseNotImplementedErrorinJDFTXStructureandJDFTXInfile.from_structure(such sites were frozen without a warning). Passselective_dynamicsormovescalethat fix or free each site entirely; aLinearorPlanarconstraint (constraint_types/constraint_vectors) can limit the directions a free site moves in.moveScaleraisesValueError(JDFTx rejects it too).JDFTXStructurekeeps the site properties of the structure it is given (it kept onlyselective_dynamics).sort_structure=Truesorts the sites into JDFTx's order (grouped by species name, in the order the species first appear) instead of by electronegativity, so the site order it gives changes (ieO,H,OgivesO,O,H, wasH,O,O). Each site'smoveScale, velocity and constraint now move with it (they stayed in the unsorted order). For the old order, sort the structure withget_sorted_structure()yourself instead of passingsort_structure=True.ionspecies names that aren't element symbols (ieFe1, orfe) now parse, and structures get ajdftx_speciessite property when a name isn't its element symbol.Changed stored data:
calc_inputs.jdftxinfileelec-n-bandsas{"n": 14}andinitial-magnetic-momentsas{"species-values": [...]}, andselective_dynamicsandmovescaleon input structures.Todos
sort_structuredoesn't follow the species order set by explicition-species <file>commands (seeJDFTXStructurefix 5)JDFTXStructurevelocities don't survivedumpfn/loadfn: they load as monty array dicts, whichget_strfails on (before this PR they were dropped); decode them infrom_dict(see the TODO there). Storing withjsanitize, as jobflow does, worksNotImplementedErrorfor now; they could be written with aLinearorPlanarconstraint instead (seeJDFTXStructurefeature 2)