Skip to content

Conversation

@minhsueh
Copy link
Collaborator

Summary

This PR builds on the related CTK PR

Major changes:

  • Implemented time-based phonon animation

TODO:

  • Add velocity
  • Consider visualizing motion using arrows

@esoteric-ephemera
Copy link

esoteric-ephemera commented Jan 26, 2026

Looks good! Couple of questions just to make sure I'm following:

  • Where do the phases get set?
  • With this approach, are we only sending the eigendisplacements + eigenvalues to the user and then having the browser set up the animation?

Plus some math notes for later reference:

Eigen-modes (the time-dependent displacements) are:

$$\vec x = \vec u \exp[ i(\vec q \cdot \vec R - \omega t)],$$

where $\vec u$ are the eigendisplacements (the eigenvectors of the dynamical matrix), $\vec q$ are vectors in reciprocal space ($\Gamma$ would be $\vec q$ = (0,0,0)), $\omega$ is the frequency of the mode / eigenvalue, and $\vec R$ are the positions of the atoms in real space (the cartesian coords).

With

$$\alpha = \vec q \cdot \vec r - \omega t,$$

and

$$\vec u = \vec u' + i \vec u '',$$

the real and imaginary parts of the displacement are:

$$\vec x = ( \vec u' \cos \alpha - \vec u'' \sin \alpha ) + i [ \vec u'' \cos \alpha + \vec u' \sin \alpha]$$

We need only plot the real part of $\vec x$, the term in parenthesis, which is what's done here.

@minhsueh
Copy link
Collaborator Author

@esoteric-ephemera
Thanks for the review and the math note!

  • The omega ($ω$), phase ($\vec{q}$ * $\vec{r}$), eigenVectors ($\vec{u}$), and amplitude ($A$) via crystal toolkit
    • The final formula is: $\vec{x} = A \vec{u} exp[i(\vec{q}\cdot\vec{r}+ωt)]$
  • Yes, that is exactly how it works!
    • Advantages:
      • Avoid large memory consumption for frame-based animation
      • No glitch when the bonds rotate
      • Velocity can be adjusted by the elapsed time $t$ with the velocity coefficient

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.

3 participants