The default triclinic c-rescale NPT integrator has a tendency to blow up (in particular) small cells. I think this may be because the default tau_p is several orders of magnitude too small, being set to 3*dt (torch_sim/integrators/npt.py:2940). The literature (and comment on the same line) seems to suggest it should be of the order of picoseconds. I think 3*dt may have been introduced accidentally? In addition, unlike the other barostats in the same file, it uses the or idiom instead of if tau_p is None, which raises RuntimeError: Boolean value of Tensor with more than one value is ambiguous if a per-system tensor is passed for tau_p.
Suggested solution: reintroduce 5000*dt for tau_p (or another sensible value, like 1000), and use if tau_p is None.
I thought I'd raise this as an issue because the right solution is a little bit a matter of taste, and there may be reasons beyond my understanding for the change in default, but would be happy to PR a fix if agreed. Repro script attached in case it is useful.
torchsim_crescale_tau_p_repro.py
The default triclinic c-rescale NPT integrator has a tendency to blow up (in particular) small cells. I think this may be because the default
tau_pis several orders of magnitude too small, being set to3*dt(torch_sim/integrators/npt.py:2940). The literature (and comment on the same line) seems to suggest it should be of the order of picoseconds. I think3*dtmay have been introduced accidentally? In addition, unlike the other barostats in the same file, it uses theoridiom instead ofif tau_p is None, which raisesRuntimeError: Boolean value of Tensor with more than one value is ambiguousif a per-system tensor is passed fortau_p.Suggested solution: reintroduce 5000*dt for
tau_p(or another sensible value, like 1000), and useif tau_p is None.I thought I'd raise this as an issue because the right solution is a little bit a matter of taste, and there may be reasons beyond my understanding for the change in default, but would be happy to PR a fix if agreed. Repro script attached in case it is useful.
torchsim_crescale_tau_p_repro.py