openmm / openmm-plumed

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

Install without cmake_gui #8

Closed liyigerry closed 7 years ago

liyigerry commented 7 years ago

Hi,

How can I install this plugin without cmake_gui in a server? I only have cmake in that machine.

Thanks.

peastman commented 7 years ago

You can use the command line version of cmake (just called "cmake"). It uses command line arguments to set variables. See https://cmake.org/cmake/help/v3.8/manual/cmake.1.html.

liyigerry commented 7 years ago

@peastman Thanks.

I use this cmake command

cmake .. -DOPENMM_DIR=/home/liyi/.conda/envs/env/include/openmm \
-DPLUMED_INCLUDE_DIR=/home/liyi/release/plumed2.3/include \
-DPLUMED_LIBRARY_DIR=/home/liyi/release/plumed2.3/lib \
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0

But it failed to find the Context.h with this error

Scanning dependencies of target OpenMMPlumed
[  5%] Building CXX object CMakeFiles/OpenMMPlumed.dir/openmmapi/src/PlumedForce.cpp.o
In file included from /home/liyi/download/openmm-plumed-master/openmmapi/src/PlumedForce.cpp:32:0:
/home/liyi/download/openmm-plumed-master/openmmapi/include/PlumedForce.h:35:28: fatal error: openmm/Context.h: No such file or directory
 #include "openmm/Context.h"
                            ^
compilation terminated.
make[2]: *** [CMakeFiles/OpenMMPlumed.dir/openmmapi/src/PlumedForce.cpp.o] Error 1
make[1]: *** [CMakeFiles/OpenMMPlumed.dir/all] Error 2
make: *** [all] Error 2

But the Context.h is in the right path

liyi@scs4450-SYS-7048GR-TR:~/.conda/envs/env/include/openmm$ ls Context.h
Context.h
liyi@scs4450-SYS-7048GR-TR:~/.conda/envs/env/include/openmm$ pwd
/home/liyi/.conda/envs/env/include/openmm

Is something wrong?

liyigerry commented 7 years ago

@peastman I find the openmm installed by conda has different folder path. In your

SET(OPENMM_DIR "/usr/local/openmm" CACHE PATH "Where OpenMM is installed")
INCLUDE_DIRECTORIES("${OPENMM_DIR}/include")

But in conda env folder

liyi@scs4450-SYS-7048GR-TR:~/.conda/envs/env/include/openmm$ ls Context.h
Context.h
liyi@scs4450-SYS-7048GR-TR:~/.conda/envs/env/include/openmm$ pwd
/home/liyi/.conda/envs/env/include/openmm

So I change the openmm src folder like this

cmake .. -DOPENMM_DIR=/home/liyi/download/OpenMM-7.1.1-Linux \
-DPLUMED_INCLUDE_DIR=/home/liyi/download/plumed2-2.3.1/include \
-DPLUMED_LIBRARY_DIR=/home/liyi/download/plumed2-2.3.1/lib \
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0 \
-DCMAKE_INSTALL_PREFIX=/home/liyi/.conda/envs/env/include/openmm

It found all head files, but I got other errors.

Scanning dependencies of target OpenMMPlumed
[  5%] Building CXX object CMakeFiles/OpenMMPlumed.dir/openmmapi/src/PlumedForce.cpp.o
[ 11%] Building CXX object CMakeFiles/OpenMMPlumed.dir/openmmapi/src/PlumedForceImpl.cpp.o
[ 16%] Building CXX object CMakeFiles/OpenMMPlumed.dir/serialization/src/PlumedSerializationProxyRegistration.cpp.o
[ 22%] Building CXX object CMakeFiles/OpenMMPlumed.dir/serialization/src/PlumedForceProxy.cpp.o
Linking CXX shared library libOpenMMPlumed.so
/usr/bin/ld: cannot find -lplumed
collect2: error: ld returned 1 exit status
make[2]: *** [libOpenMMPlumed.so] Error 1
make[1]: *** [CMakeFiles/OpenMMPlumed.dir/all] Error 2
make: *** [all] Error 2
peastman commented 7 years ago

What files are in /home/liyi/download/plumed2-2.3.1/lib? It's trying to find libplumed.so in that directory, and not finding it.

liyigerry commented 7 years ago

@peastman Ok, I found the right path and install this plugin succesfully. Thanks.

liyigerry commented 7 years ago

@peastman Sorry to reopen this issue.

After runing make install, I run make PythonInstall to install the Python wrapper

But I got this error:

make: *** No rule to make target `PythonInstall'.  Stop.
liyigerry commented 7 years ago

I find the default value of PLUMED_BUILD_PYTHON_WRAPPERS is OFF. I turn it ON, resulting success python wrapper.

I imported openmmplumed well like from openmmplumed import PlumedForce

But When I add PlumedForce, I got this error:

Traceback (most recent call last):
  File "simulate.py", line 25, in <module>
    simulation = Simulation(modeller.topology, system, integrator, platform, properties)
  File "/home/liyi/.conda/envs/env/lib/python3.6/site-packages/simtk/openmm/app/simulation.py", line 105, in __init__
    self.context = mm.Context(self.system, self.integrator, platform, platformProperties)
  File "/home/liyi/.conda/envs/env/lib/python3.6/site-packages/simtk/openmm/openmm.py", line 4066, in __init__
    this = _openmm.new_Context(*args)
Exception: Specified a Platform for a Context which does not support all required kernels

I check the plugin like this,

>>> import simtk.openmm as mm
>>> mm.Platform.getPluginLoadFailures()
('Error loading library /home/liyi/.conda/envs/env/lib/plugins/libOpenMMPlumedCUDA.so: libplumed.so: cannot open shared object file: No such file or directory', 'Error loading library /home/liyi/.conda/envs/env/lib/plugins/libOpenMMPlumedOpenCL.so: libplumed.so: cannot open shared object file: No such file or directory', 'Error loading library /home/liyi/.conda/envs/env/lib/plugins/libOpenMMPlumedReference.so: libplumed.so: cannot open shared object file: No such file or directory')

How can I fix this errors? Thanks.

peastman commented 7 years ago

Add the directory containing libplumed.so to your LD_LIBRARY_PATH.

liyigerry commented 7 years ago

Ok. it works! Thanks.