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

Add trajectory smoothing when importing via MDAnalysis #440

Open
BradyAJohnston opened this issue Feb 26, 2024 · 4 comments
Open

Add trajectory smoothing when importing via MDAnalysis #440

BradyAJohnston opened this issue Feb 26, 2024 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@BradyAJohnston
Copy link
Owner

Support potentially trajectory smoothing when importing an MD trajectory via MDAnalysis. (https://docs.mdanalysis.org/stable/documentation_pages/transformations/positionaveraging.html)

Potential for in theory to add enable / disable support for a variety of transformations. Some of these will be best implemented through Geometry Nodes node groups, but when streaming the trajectory from disk, transformations like averaging will be best done via MDAnalysis as Geometry Nodes won't have access to any frames other than the one that is currently loaded.

@BradyAJohnston BradyAJohnston added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Feb 26, 2024
@BradyAJohnston
Copy link
Owner Author

BradyAJohnston commented Mar 5, 2024

Seems that it might be a bit more complex, as we can't directly alter a transformation after it has been applied (MDAnalysis/mdanalysis#4477 (comment)). Potential for us to have a panel for the trajectory to add or alter a transformation, but that it would require a bit of load time as the universe is re-loaded.

EDIT:

using Universe.copy() keeps transformations, but you can access filenames of the universe.

u1 = Universe(TOPOL, TRAJ)
u2 = Universe(u1.filename, u1.trajectory.filename)

It may even be better to keep the original universe with no transformations, then create copies of that universe when wanting to add a transformation.

u = Universe(TOPOL, TRAJ)

u_smoothed = u.copy()
u_smoothed.trajectory.add_transformation()

Then the transformed universe can be discarded and a new copy worked with, when wanting to change the transformation.

@Dan-Burns
Copy link

Smoothing frames would be great. I don't know the blender python API well enough but it's easy to take the coordinates from two frames you want to interpolate between and make the intermediate coordinate arrays.

@BradyAJohnston
Copy link
Owner Author

Subframes that interpolate between frames of a trajectory are already implemented and can be accessed via the 'Object' tab of the 'Molecular Nodes' panel after importing a trajectory. As you increase the number of subframes, the number of interpolated frames in between are increase.

image

This enhancement is more about utilising the trasnformations inside of MDAnalysis, which can load several frame (say 5 at a time) and then average their coordinates to create a smoother overall trajectory, rather than just interpolating between existing frames of a trajectory

@Dan-Burns
Copy link

That's great - glad I know that now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants