joaomcteixeira / taurenmd

A command-line interface for analysis of Molecular Dynamics simulations.
https://taurenmd.readthedocs.io/en/latest/
GNU General Public License v2.0
9 stars 2 forks source link

[QUESTION] Can't convert Amber's trajectories with `MDAnalysis` #64

Open vsheg opened 2 years ago

vsheg commented 2 years ago

Hello, I've installed taurenmd via pip and I've tried to convert .nc trajectory to the .dcd format. I know, that MDAnalysis is capable of doing it natively, but when I try to do this with taurenmd:

$ taurenmd trajedit top.prmtop traj.nc -d traj.dcd

I see

ModuleNotFoundError: No module named 'mdtraj'

and then, after installation of mdtraj:

ModuleNotFoundError: No module named 'simtk.openmm'

How I can use taurenmd to convert trajectory without mdtraj, simtk.openmm, etc., using only MDAnalysis? Thanks for your attention

joaomcteixeira commented 2 years ago

Hi @vsheg , Thanks for using taurenmd!

If you installed taurenmd from pip both MDAnalysis v2 and mdtraj should be installed. taurenmd tries to load the topology and the trajectory first with mdanalysis and only if it can't, taurenmd attempts reading the topology with openmm and passing it to mdanalysis universe creation. The conversion itself by trajedit will always use mdanalysis. If you say the mdanalysis reads Amber files by default, we may need to investigate the error further. If you can give me some dummy Amber topology and traj that I can test locally would be great.

Otherwise, for now, you can try to install all dependencies using Anaconda and installing on top just the taurenmd python code:

git clone https://github.com/joaomcteixeira/taurenmd
cd taurenmd
conda create -n taurenmd python=3.8
conda env update -n taurenmd --file requirements-dev.yml
python setup.py develop --no-deps

This should work. Otherwise, let me know. Many improvements will be done after #60. Looking forward to merging that pull request in the following days. After that PR, I will also review/update the installation instructions.

If you want to look further into the code to try to solve the problem yourself and make a PRs the function that reads the trajectories is here:

https://github.com/joaomcteixeira/taurenmd/blob/3100ca8f68f9761de4e242f1ea17aa1122c51944/src/taurenmd/libs/libmda.py#L25

vsheg commented 2 years ago

Thanks for your reply. I don't think I'm able to look at the PR or code in a meaningful way. I just write an instruction on how to reproduce this behavior. I hope it will be useful. This archive taurenmd-test.zip contains all needed files.


I tried to create a new Python environment with Poetry (it's just a wrapper for pip)

$ poetry init # init Poetry environment
<...>

$ poetry env use 3.9 # specify Python version to use
$ poetry add taurenmd # MDAnalysis won't be installed
$ poetry add MDAnalysis # add it explicitly
$ poetry update # update environment (not necessary, I guess)
$ poetry shell # activate the environment 

# try to convert 
$ taurenmd trajedit trpzip2.ff10.mbondi.parm7 trpzip2.gb.nc -d traj.dcd
<...>
ModuleNotFoundError: No module named 'mdtraj'

To install this environment, just unpack the attached archive and then

$ cd taurenmd-test
$ poetry install # install environment and dependencies 
$ poetry shell # activate environment

(Poetry can be installed with pip3 install poetry)


In the archive :