Skip to content

Conversation

minhsueh
Copy link
Collaborator

@minhsueh minhsueh commented Aug 7, 2025

Summary

Major changes:
Introduced CrystalToolkitAnimationScene to enable crystal structure animations. For each Object3D, the scene renders keyframes (position, scale, or quaternion ...) and performs linear interpolation between frames for smooth transitions.

  • feature 1: Added the animateType field to interface SceneJsonObject in simple-scene.ts.
    This field can be either "position" or "displacement", specifying the physical interpretation of the animate data in each scene entry.

  • feature 2: Support for generating multiple keyframes added to buildAnimationSupport in animation-helper.ts
    fix: Previously, the code only parsed the first two frames; this has now been corrected

  • testing: The page /components/crystal-toolkit/pages/CrystalStructureAnimationViewer/CrystalStructureAnimationViewer.tsx is used for testing with sample data, along with the scene files /components/crystal-toolkit/scene/phonon-animation-scene.ts and /components/crystal-toolkit/scene/phonon-animation-position-scene.ts.

TODO:

  • Currently supports animation for SPHERES and CYLINDERS (representing atoms and bonds). Animation for LINES (unit cell edges), CONVEX, and BEZIER geometries is not yet implemented.
  • Added BooleanKeyframeTrack support for bond-breaking animations. Bonding is represented using two endpoints, typically derived from pymatgen.analysis.local_env.CrystalNN and pymatgen.analysis.graphs.StructureGraph. In cases where a bond breaks or reforms, the associated Object3D is toggled invisible to reflect the change visually.
  • The function get_scene from StructureGraph and Site in crystal_toolkit.components.renderables is used to generate animation data for atoms and bonds. A separate PR will be submitted to crystal_toolkit(Retain atom index info in _meta crystaltoolkit#470)

Checklist

  • - Performance testing (Browser)

Local Testing

Run npm start and navigate to http://localhost:1234/crystal_animation

@tschaume
Copy link
Member

tschaume commented Sep 4, 2025

Thanks @minhsueh! I just made you admin for this repo. Feel free to merge and publish a release (or release candidate) when this PR and the accompanying CTK PR are ready.

@minhsueh
Copy link
Collaborator Author

minhsueh commented Sep 5, 2025

@tschaume Thank you! will do!

@tschaume tschaume marked this pull request as ready for review September 16, 2025 00:33
Copy link
Member

@tschaume tschaume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just some minor feedback.

});
}
}
console.log('new props');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?

@tschaume
Copy link
Member

@minhsueh feel free to adress my comments as necessary and go ahead with merging this when you're ready. If the tests and build succeed on merge, a new package release should happen. I've already merged the accompanying PR in dash-mp-components. Feel free to release a new version for that, too. I'll go ahead and review the CTK PR afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants