openmm / openmm-plumed

OpenMM plugin to interface with PLUMED
55 stars 23 forks source link

Can conda openmm-plumed use a custom plumed installation outside conda? #66

Closed gitkol closed 1 year ago

gitkol commented 1 year ago

Hi, I have been using OpenMM-PLUMED for a long time and always built the openmm-plumed plugin from source. The cmake builder has always been a bit difficult to use, but this time I couldn't get it to work at all on a new machine. So, I was very glad to see that the conda version of openmm-plumed exists. I installed it with no issues, but now I realize that it will always use the built-in PLUMED. My question is whether I can set environmental variables to make conda openmm-plumed use my PLUMED instead of the built-in one. I tried setting

export PATH=/home/istvan/opt/plumed-2.8.1_install/bin/:$PATH
export LD_LIBRARY_PATH=PATH=/home/istvan/opt/plumed-2.8.1_install/lib:$LD_LIBRARY_PATH

but that didn't help. Is there a solution to this?

Thank you very much for your kind assistance.

Best regards,

Istvan

gitkol commented 1 year ago

I also tried adding this command at the top of my OpenMM-PLUMED Python script and set PYTHONPATH, but that didn't work either.

sys.path.insert(0, '/home/istvan/opt/plumed-2.8.1_install')

$ export PYTHONPATH=/home/istvan/opt/plumed-2.8.1_install
peastman commented 1 year ago

It ought to work. It just needs to link to libplumed.so. But it's possible python sets up the path so that the library installed by conda is always found before the one you specify in LD_LIBRARY_PATH. In that case, you might have to uninstall that version with

conda remove --force plumed

The --force option tells it to remove it without removing any of the packages that depend on it. That can be a dangerous thing to do, so I'd experiment on an environment you don't care about in case it gets messed up.

gitkol commented 1 year ago

Thank you very much, Peter! Thanks for the quick reply and, indeed, 'conda remove --force plumed' did the trick. 'ldd /home/istvan/opt/plumed-2.8.1_install/bin/plumed' showed no missing libraries and 'Platform.getPluginLoadFailures()' also came up empty, everything is in order.

Thanks again,

Istvan

peastman commented 1 year ago

Great, glad that worked.