Skip to content

Conversation

@harikrishna-au
Copy link
Contributor

Feature: Estimate Velocities from Coordinates

I have implemented a new method estimateVelocities() in the Molecule class to calculate atomic velocities based on the differences in coordinate positions over time.

Changes:

  • avogadro/core/molecule.h:

    • Added m_velocities to store velocity vectors for each time step.
    • Added estimateVelocities() method declaration.
    • Added velocities(int index) and setVelocities(...) accessors.
  • avogadro/core/molecule.cpp:

    • Implemented estimateVelocities() using finite differences:
      • Forward Difference for the first frame ($t=0$): $v_0 = (r_1 - r_0) / \Delta t$
      • Backward Difference for subsequent frames ($t>0$): $v_i = (r_i - r_{i-1}) / \Delta t$
    • The implementation correctly handles the timestep $\Delta t$ derived from m_timesteps.
  • tests/core/moleculetest.cpp:

    • Added a unit test estimateVelocities to verify the correctness of the velocity calculation for a known trajectory.

I have signed off on the commit as required.

@welcome
Copy link

welcome bot commented Dec 4, 2025

Thanks for opening this pull request! Please check out our contributing guidelines and check for the automated tests.

Signed-off-by: Nallana Hari Krishna <[email protected]>
@harikrishna-au harikrishna-au force-pushed the feature/estimate-velocities branch from ba0b665 to c4323ac Compare December 5, 2025 02:09
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.

1 participant