feat: Add structure adapter to convert ASE.Atom objects to diffpy.structure.Structure objects and additional useful methods#187
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #187 +/- ##
==========================================
+ Coverage 98.93% 98.99% +0.05%
==========================================
Files 13 13
Lines 1884 1987 +103
==========================================
+ Hits 1864 1967 +103
Misses 20 20
🚀 New features to boost your workflow:
|
| # We set the expected error message to None because this expectation is | ||
| # out of our control, but it is good to make sure that we are | ||
| # raising the error from ASE. | ||
| (["get_magnetic_moments"], RuntimeError, None), |
There was a problem hiding this comment.
This basically is a test for ase and not diffpy.structure. do you think its okay to leave this?
|
@sbillinge ready for review. ase to diffpy.structure adapter. |
|
Let's chat about this. It seems that adding ase as a dependency is a big step and we need to understand better the use-cases. Let's start with use-cases, then we can work on design and tests. Then we can code. Especially when we have AI to write the code, this process is the most important because the code-writing is the lowest cost now and the biggest risk is to introduce bloat and entropy because the AI doesn't care too much about that it seems like. |
|
@sbillinge Here's the UCs i thought of and is what guided the code on this PR. Only option 2 is included here. Option 1 would be on a different PR. Both 1a and 1b would be things that would need to be implemented in
Any other use cases you could think of? Also, we might be able to get away with this without adding it as a dependency. The only use for it is an |
See news file for all the methods that are added.
This converts
ase-->diffpy.structure. The method also includes the optionallost_infoinput. Here, the user can provide an attribute or method of thease.Atomsobject as a string or list of strings to get additional information that is available in ase that is not supported in diffpy.structure (magnetic moments, velocities, etc).