OpenBioSim/sire

[BUG] Replica exchange fails in NPT ensemble

Closed this issue · 0 comments

Describe the bug
sr.morph.replica_exchange() fails when run on a pair of dynamics objects with NPT ensembles.

To Reproduce
The following script:

import sire as sr

system = sr.load(sr.expand(sr.tutorial_url, "merged_molecule.s3"))
system = sr.morph.link_to_reference(system)

system = system.minimisation().run().commit()

d1 = system.dynamics(lambda_value=0.0, temperature="300 K", pressure="1 atm")
d2 = system.dynamics(lambda_value=0.1, temperature="300 K", pressure="1 atm")

d1.run("1ps")
d2.run("1ps")

sr.morph.replica_exchange(d1, d2)

raises the following error: ValueError: SireError::incompatible_error: Units for values 3.02706 kcal mol-1 and -1.03385e-26 kcal are incompatible

Expected behaviour
The script should successfully propose a swap, as it does then an NVT ensemble is used in both dynamics objects.

(please complete the following information):

  • OS: Ubuntu 22.04.5 LTS
  • Version of Python: Python 3.12.4
  • Version of sire: 2024.3.0.dev
  • I confirm that I have checked this bug still exists in the latest released version of sire: yes

Additional context
This is just a simple unit conversion issue, there is an Avogadro's number missing somewhere in the repex function.