NQCD / NQCDynamics.jl

Fast and flexible nonadiabatic molecular dynamics in Julia!
https://nqcd.github.io/NQCDynamics.jl/stable
MIT License
57 stars 4 forks source link

Enable freezing the position of certain atoms #295

Open Alexsp32 opened 1 year ago

Alexsp32 commented 1 year ago

Similar to #244. Currently, the only way of freezing certain atoms in a simulation in place (at least that I'm aware of) is by using an ase calculator which outputs 0 forces on the respective atoms. However, this alone doesn't work for methods where random noise is applied, such as Langevin dynamics.

In conjunction with #244 , it might be best to allow specifying frozen atoms when defining a Simulation, which makes the necessary modifications to methods. (ignoring initial velocities from DynamicalDistributions, position/velocity updates, random noise, ...)

jamesgardner1421 commented 1 year ago

It's currently possible to define frozen atoms for individual models by implementing NQCModels.mobileatoms that should return the indices of the atoms that are not frozen. Though this is not used everywhere in the code so there are some cases where this won't work yet. I like the idea of attaching the constraints to the model because I think it makes logical sense and the model is available everywhere that the Simulation is so I think the current implementation should be good for most scenarios. It's just a case of checking NQCModels.mobileatoms whenever an atom is about to be moved.