PLUMED Collective Variables in OPS#910
Conversation
dwhswenson
left a comment
There was a problem hiding this comment.
Thanks for the contribution! I'm excited for this one, and very much looking forward to getting it merged in!
Overall, it looks very good. A number of minor changes recommended, mostly to tests. Things aren't in specific line-by-line comments:
-
Please add
py-plumedtodevtools/conda-recipe/meta.yaml, underrequirements: run:. This is where we currently have all the extra requirements. I'm planning to change that soon (it's an ugly and outdated place to keep these things), but wanted you to get this in first. -
We have a 10-frame "PDB trajectory" of AD in
tests/test_data/ala_small_traj.pdb. Load this (using tools from the OpenMM engine) instead of adding the extraAD_trajectory.ncfile. This might also work instead of adding theAD_initial_frame.pdb(Does MOLINFO will just take the first model in a multiple model PDB?) For the example, you could require that users copy over the results from https://github.com/openpathsampling/openpathsampling/blob/master/examples/alanine_dipeptide_tps/AD_tps_1_trajectory.ipynb (start from the last step of the resulting filealanine_dipeptide_tps_equil.ncinstead of theAD_trajectory.nc-- that's how I made the tutorialAD_trajectory.ncfile anyway). We do this for a number of other examples (although we should be more explicit about where the file needs to come from). One heads-up: sometimes you'll get the "increasing" transition instead of the "decreasing" transition (because psi is periodic). See Figs 7 and 8 and related discussion in the OPS 2 paper for details. This could mess with the nice figure you make at the end. (I think giving users a warning about this is all you need.)
|
Thank you for the very clear pointers! All changes are implemented as requested.
|
|
@apdealbao : Right now it seems that the PLUMED RMSD and MDTraj's RMSD are not looking at the same trajectory, probably a result of the last set of changes. That's the only error in unit testing. (Once it passes tests without errors, I can check things like test coverage, etc.) |
|
Hi @dwhswenson. I am unable to track the error. In the last commit, I updated the |
|
I reran tests, and that didn't fix. Looking at the error, it's clear that MDTraj has it right and PLUMED has it wrong: with t=0 as the reference frame, the RMSD should be 0 at t=0. It is for MDTraj; is not for PLUMED. The numbers look like the wrong thing is being used as reference, but I don't see that in the code. Is it possible that PLUMED is reordering equivalent hydrogens or something? It seems like some value entering the RMSD is off by 0.101, but I couldn't find an obvious culprit. Let's take closer looks tomorrow, and if we can't figure it out there, I'll ping Gareth and Giovanni to see if they can help. It's possible that something is going wrong because one has waters and one does not? That's another guess. In any case, I probably won't look into it until tomorrow afternoon. |
|
Alright. I think it should be easy to fix. I also had that 0.101 error before, and I corrected it by updating the |
|
Hi @dwhswenson. Strangely, in my previous commit (70c899c ) I can already see the corrected |
|
It runs fine for me locally, as well. I'm on a Mac; I think that you are, too, @apdealbao. It is possible that this is something specific to the Linux version of PLUMED. I suspect we're going to need to ask the PLUMED team for help here. Could you add a pure-(py-)PLUMED version to the test (i.e., manually include the commands your wrapper classes automate), and compare that your wrapper version? Showing an implementation only based on PLUMED will make it easier for them to debug. Note that you should do |
|
I've been trying this on a Linux box. I can sometimes reproduce the error. The little bash script I'm using: Details#!/bin/bash
COUNT=0
for i in `seq 10`
do
py.test --pyargs openpathsampling.tests.test_plumed_wrapper > /dev/null
result_code=$?
if [ $result_code -eq 1 ]
then
echo -n "X"
COUNT=$((COUNT+1))
elif [ $result_code -eq 0 ]
then
echo -n "."
else
echo -n "?"
fi
done
echo " : $COUNT failures"Output gives Whether it fails seems to be random, with about 30% probability. And on my Mac: Now, what's really weird is that (on Linux) I get a serious mistake on the first frame if I only run the RMSD test. There are two ways of doing this:
Both give me no error on Mac, same error on Linux: The first frame is way off, and everything else is fine. When I only run the RMSD test, I always get an error on Linux. This looks kind of like an uninitialized variable error in C: for example, it could be that the Mac conda-forge compiler automatically initializes things to 0 and the Linux compiler doesn't, and that might be why we see a difference. Is there anywhere you might need to initialize something for PLUMED? |
|
Hi @dwhswenson. I'm currently trying to make a test using the |
|
hi @dwhswenson. I added a new test that uses the |
|
@apdealbao : Thanks for assembling that extra test. I can confirm that it does reproduce the errors I'd seen previously. However, when I used it as the basis of a simple script (with no OPS at all; only MDTraj and PLUMED), I couldn't reproduce the errors. I'll be going through the test bit by bit to make your new test more like my MDTraj-based script, and we'll see if that makes anything clearer. |
|
ok, @dwhswenson. Let me know if I can help with anything else. |
|
Hi @dwhswenson. Just saw the fix :) Any idea why this didn't work in Linux? Just as a take-home message for me. |
|
No idea at all. I'm going to post an issue on PLUMED; maybe they'll have an idea. Since it is only a problem for RMSD, I'm wondering if it is a detail there. My best guess is that first binding it to a name somehow prevents garbage collection? Anyway, I'll CC you on that issue when I post it. I figured it out because I had rewritten something based on your |
dwhswenson
left a comment
There was a problem hiding this comment.
Two more minor comments based on things I noticed.
There is one other thing you'll need to do, which is to rewrite history. I'd like you squash your first 3 commits into 1. That will make it so that the addition/removal of the 40MB trajectory doesn't get into the actual repository history, taking up space.
Here are two good tutorials on squashing commits. Be sure to do git pull to get my most recent updates before you start squashing.
- https://github.com/wprig/wprig/wiki/How-to-squash-commits
- https://thoughtbot.com/blog/git-interactive-rebase-squash-amend-rewriting-history
Don't worry about squashing all commits. Part of the reason I'm asking you to do this is so that we can get rid of the big file while still maintaining as much credit as possible for you.
tests, skips, resources, examples, no large files removed extra .nc file, changed to pytest, fixed sourcing Use same ref frame for MDTraj & PLUMED RMSD added direct plumed test switch direct plumed to RMSD (from dist) you've gotta be kidding... remove test_direct (looks like it did its job!)
81552af to
9e5cace
Compare
|
Hi @dwhswenson. Busy day. I just squashed the commits. I'll take a look at the other comments and try to address them by tomorrow. Thanks for the guidance! |
|
Sorry for the delay on getting this merged. It has been ready to go in for a while. Merging now! |
|
Great news! Thanks a lot @dwhswenson! |
This adds a PLUMED wrapper to the OPS collective variables, along with tests and examples. The wrapper requires a PLUMED and py-PLUMED (available via conda-forge) and OpenMM (available from conda/omnia). Tests are skipped in these requirements are not met.
Unsure about if/how to change OPS conda-recipe/meta.yaml