Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fleur inp.xml converter #88

Merged
merged 24 commits into from Oct 22, 2021
Merged

Fleur inp.xml converter #88

merged 24 commits into from Oct 22, 2021

Conversation

janssenhenning
Copy link
Contributor

@janssenhenning janssenhenning commented Oct 21, 2021

This PR adds a commandline tool based on the Schema dictionaries for converting inp.xml files between different file versions. Avalable in the click cli via masci-tools inpxml

For this a conversion is needed, which describes what to do, which is either available as a json file or if not can be created via a series of interactive command line inputs. Conversions are at the moment assumed to be unique for each versionn pair and direction

TODO:

  • Some cleanup
  • Tests
  • Prepare some conversions for common conversions one might want to do
  • For some inputs and conversions this tool cannot produce a file, which will work out of the box. For example for Max4 inputs converted to Max5 or later without kpointlist inputs or explcit definitions of the bravais matrix. There should be some way of specifying tags, which should trigger warnings with instructions on what to do
  • Handling xincludes

@codecov
Copy link

codecov bot commented Oct 21, 2021

Codecov Report

Merging #88 (6a9c252) into develop (1d427ca) will increase coverage by 0.41%.
The diff coverage is 93.81%.

@@             Coverage Diff             @@
##           develop      #88      +/-   ##
===========================================
+ Coverage    80.44%   80.86%   +0.41%     
===========================================
  Files          121      125       +4     
  Lines        21656    22386     +730     
===========================================
+ Hits         17421    18102     +681     
- Misses        4235     4284      +49     

janssenhenning and others added 17 commits October 22, 2021 15:45
conversion not yet working
Only the generation of what to do is kind of done but also rough
- Added creation of tags (with specification of attributes)
- fix several inconsistencies in resolve_ambiguouities

Still missing:
- Creating/moving attributes (are detected but nothing is done in the actual conversion)
- Between schemas the enforced order can also change this needs to be detected
  (And corrected at the very end of the conversion since the intermediate steps could lead to a lot of inconsistencies)
Next up clean up conversion

 - Create private function to create tags from a simple xpath with parent creation, since this should only be used in this specific circumstance, where we cannot rely on any one schema dictionasry fro complete order information
 - Moving attributes
 - Detect changing order (could also just recursively go over the whole file and look for the places where order does not match ()since this should require no user input)
 - Incompatible types (int -> bool and similar)
…he end of the conversion and not caring in the intermediate steps
… by reconverting everything into the namedtuples
THis way a conversion from Max4 to Max5 is possible under the right circumstances (There is a kpointlist and the bravais matrix explicitely)
@janssenhenning janssenhenning marked this pull request as ready for review October 22, 2021 14:37
@janssenhenning janssenhenning added the cmdline Things related to the CLI label Oct 22, 2021
janssenhenning and others added 3 commits October 22, 2021 20:27
Removing tags/attributes first can lead to tags attributes to be moved to disappear
Now the elements are gathered beforehand and then reinserted
@janssenhenning janssenhenning merged commit cec30b0 into develop Oct 22, 2021
@janssenhenning janssenhenning deleted the inpxml-converter branch October 22, 2021 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmdline Things related to the CLI enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant