Skip to content

Convert ts.integrate param units#587

Open
curtischong wants to merge 2 commits into
TorchSim:mainfrom
curtischong:fix-579-2
Open

Convert ts.integrate param units#587
curtischong wants to merge 2 commits into
TorchSim:mainfrom
curtischong:fix-579-2

Conversation

@curtischong

@curtischong curtischong commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

We currently are not converting the parameters in ts.integrate (they are supposed to accept normal units)
Note: this is in contrast to the internal api (direct integrator functions like ts.npt_nose_hoover_isotropic_step where they expect the units to already be converted).

This PR goes through all the params and adds a type annotation to these args in the integrator functions to properly convert the units.

Note: additional kwargs like a = kwargs.get("momenta") in https://github.com/TorchSim/torch-sim/blob/main/torch_sim/integrators/nvt.py#L344 and https://github.com/TorchSim/torch-sim/blob/main/torch_sim/integrators/npt.py#L1733 do not have annotated conversion param like the rest. I think this is fine since users are not manually initing the momenta for individual atoms in the ts.integrate api. - they're most likely loaded in from another simulation (so I think they'll have the proper units)

This PR is to fix the issue outlined in #579 where a user was changing the settings for a simulation and since we didn't properly convert the units to internal MetalUnits, their simulation was unstable. This change fixes the issue noticed in their md workflow

Checklist

Before a pull request can be merged, the following items must be checked:

  • Doc strings have been added in the Google docstring format.
  • Run ruff on your code.
  • Tests have been added for any new functionality or bug fixes.

add run cmd

simplify repro

new repro

repro fix

use their model

integrator fixes

revert to sevennet

cleanup

get structures in memory

better integrator definitions

cleanup

better test names

more cleanup

cleanup

more cleanup

cleanup

cleanup

cleanup

delete repro file

fix other params

better name

use constants

cleanup
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