-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
aniSileSiesta #544
aniSileSiesta #544
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great addition!
It is however a generic file format and should perhaps be contained in the xyzSile
then the aniSileSiesta
could simply be a subclass of the xyz sile.
Codecov Report
@@ Coverage Diff @@
## main #544 +/- ##
==========================================
+ Coverage 86.23% 86.25% +0.01%
==========================================
Files 365 366 +1
Lines 46425 46500 +75
==========================================
+ Hits 40036 40107 +71
- Misses 6389 6393 +4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
OK, do you then see the |
Yes, that (I think) is the actual |
Well, perhaps we should do: aniSileSiesta(xyzSile): pass
add_sile("ani", aniSileSiesta, ...) |
What about handling the sile as something that can be iterated: s = sisl.get_sile(anifile)
g0 = s.read_geometry()
g1 = s.read_geometry() Right now the |
This should work already in the s = sisl.get_sile(anifile)
with s:
g0 = s.read_geometry()
g1 = s.read_geometry() |
Yes, sorry, this works! |
Am I on the right track with wrapping the single-time |
Yes, I think something like this. My idea would be to unify MD output files with a decorator, so essentially something like this: @sile_fh_open
@read_multiple(start=0, step=None)
def read_geometry(self, atoms=None, sc=None)
... where the decorator ensures correct calls and adds documentation etc. def read_multiple(start=0, step=None):
"decorate a function for doing multiple reads "
def decorator(func):
@wraps
def f(*args, *, start=start, stop=stop, **kwargs):
if stop is None:
return func(*args, **kwargs)
... something like the above could work and make interfaces the same, what do you think? |
What do you think of the current layout? I tried to follow your suggestions. Maybe for the ANI files it would be natural to have |
How should |
Any thoughts on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also like to remove the unnecessary commits, could you rebase and squash the commits that shouldn't be used? Then I can have a final go and get this in?
As I have said already on several other issues, I think sisl should have a well defined way of working with trajectories :) Otherwise, just reading trajectories from files as lists of |
618fe05
to
d7fd5af
Compare
I've cleaned up the commits. Let me know if you want me to do more changes, otherwise feel free to modify further. |
It should now be able to handle more cases and more easily transfer data to a required data-structure. Added an xyz skip function which is much faster than the read_geometry call. Changed default all=True for the ANI file. Changed the suffix for ANI files to be capitalized. Added a postprocess function for post-processing the data returned by the read_multiple function. This would enable one to merge stuff etc. Signed-off-by: Nick Papior <[email protected]>
Hi! I'm checking the Why not go with the conventions of slicing in python? I.e. behaving exactly as Additionally, I know it looks a bit ugly at first sight but gc = xyzSile(f).read_geometry[4::10] Just something to think about, not that I personally think it's a good idea :) |
See discussion here #544 (comment) |
mnt: fixed and simplified some logic in the read_multiple function
|
||
# start by reading past start | ||
for _ in range(start): | ||
r = skip_call(*args, **kwargs) |
Check notice
Code scanning / CodeQL
Unused local variable
g = xyzSile(f).read_geometry(stop=2, step=1) | ||
assert g[0].na == 1 and g[-1].na == 2 | ||
|
||
g = xyzSile(f).read_geometry(sc=None, atoms=None) |
Check notice
Code scanning / CodeQL
Unused local variable
This PR enables reading of siesta ANI files.