choderalab / openmmtools

A batteries-included toolkit for the GPU-accelerated OpenMM molecular simulation engine.
http://openmmtools.readthedocs.io
MIT License
244 stars 76 forks source link

Demultiplexing RepEx trajectories #487

Open dlukauskis opened 3 years ago

dlukauskis commented 3 years ago

Hi, I'd like to use openmmtools's replica exchange code, but I can't see a way of actually demultiplexing the trajectories and having a look at them. Am I missing something? The docs don't address this point.

Thanks, Dom

andrrizzi commented 3 years ago

Hi @dlukauskis . The Repex facilities were ported from YANK, but unfortunately we forgot to carry over the utilities to handle the trajectories in the netcdf file. You can take a look at this function https://github.com/choderalab/yank/blob/master/Yank/analyze.py#L1036-L1202 .

dlukauskis commented 3 years ago

I gave the YANK code a try but I'm getting a metadata-related error:

  File "sim_extract_trj.py", line 32, in <module>
    replica_index=0)
  File "/home/dom/Projects/Playground/SAMS/demux_test/extract_trajectory.py", line 54, in extract_trajectory
    reference_system = mmtools.utils.deserialize(metadata['reference_state']).system
KeyError: 'reference_state'

Attaching a directory with the exact code I used - demux_test.zip

andrrizzi commented 3 years ago

Yes, that's because YANK stores some metadata with the reference system and the topology. You will have to modify those bits and provide your own OpenMM Topology object.

simomarsili commented 3 years ago

This should solve the problem (until extract_trajectory will be ported to opemmtools):

https://github.com/simomarsili/mmdemux

andrrizzi commented 3 years ago

Thanks for sharing @simomarsili !

tanmoy7989 commented 2 years ago

@andrrizzi, Is demultiplexing now included in MultistateAnalyzer? I'm still fairly new to the openmm environment (and openmmtools as well), so didn't go through the MultiStateAnalyzer methods in detail before asking.