votca / csg-tutorials

VOTCA-CSG coarse-graining tutorials

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

espresso example: replace MDAnalysis

junghans opened this issue · comments

MDAnalysis got dropped from Fedora, so replacing it with something else would be nice.

This is the only line where MDAnalysis is used:
https://github.com/votca/csg-tutorials/blob/master/spce/ibi_espresso/spce.py#L42

Related to votca/csg#400 and #34 .

@fweik @jngrad @RudolfWeeber any ideas? Can espresso read any coordinate file formats natively?

@RudolfWeeber ascii table would work, but as VOTCA doesn't support, so we would need to duplicate the input file.

Looking at https://github.com/espressomd/espresso/blob/python/src/core/io/reader/readpdb.cpp, can espresso read pdb files?

@junghans the pdb code is not exposed to python, I actually thought it was removed. In a perfect world all packages would support h5md which I'm sure we all want to establish as the new standard for MD data :-)

We support (and actually use) h5md for trajectories, but not topologies. Not sure how hard that would be to add. @jkrajniak might know.

Actually xyz (see https://openbabel.org/wiki/XYZ_(format)) is just an ascii table, so maybe we should use that.

Yeah, Espresso can't read h5md. XYZ can probably be read by numpy, but mass support would be needed iirc.

commented

Writing a small parser in python for h5md positions and masses would also not be that difficult

@JensWehner are you volunteering?

commented

if you make the h5md file I write the parser for it

Reading h5md (it's nothing more than hdf5 file) with h5py library is very easy; in the end you will work with numpy arrays for positions and masses

import h5py
import sys

h5 = h5py.File(sys.argv[1], 'r')
particle_group = 'atoms'
pos = h5['/particles/{}/positions/value'.format(particle_group)].value

so the only attribute you need is in fact the particle_group which either is hard coded in espresso or is provided in the script.

@jkrajniak we need a topology reader on the VOTCA side, too.

I mean currently the VOTCA can use h5md files only as trajectories, but not topology files.

commented

do we need that for that script? I thought we need just the coordinates. I am confused

You right, we don't really need the coordinates to setup the topology, so the easiest might be to turn spce.gro into a table and make topol.xml a standalone topology.

commented

Can someone summarize the problem and maybe the solution once more. I am still lost.

@JensWehner in short the espresso example uses MDAnalysis, which isn't part of Fedora, so hence we need a different mechanism to read in the initial coordinates. One solution would be to use an h5md file instead of the currently used gro file, however VOTCA can only use h5md as trajectory files not topology files. Currently both Espresso and VOTCA use a gro file for the tutorial. So another solution would be to use an ASCII table as initial condition for the espresso and an xml topology for VOTCA, which obviously would duplicate some information.

commented

Alternatives are we write a small python .gro writer or we implement an h5md topology reader?

Yes to both.

Implementing a gro reader is slightly proffered as we don't need to add a binary h5md file to the repo in that case.

commented

but the h5md top reader would be the more rigorous solution.

but the h5md top reader would be the more rigorous solution.

Not sure about rigorous, but would be good to have anyway.

commented

I do not understand the test script. The masses that are used are Carbon masses but the .gro file says CG? Is that intentional?

commented

How does espresso know the masses of the particles.

The mass should be the ones of water, so 18u.

But for static properties, like the rdfs, masses don’t matter.

commented

@junghans okay how do you normally get the masses into espresso, because using a .gro files does not work. I have no knowledge about these methods, but I will finish the small groreader this week.

I just set the masses manually!

commented

In the espresso script?

commented

ahh okay. So I can do that too, in spce.py makes the whole parser a lot easier?

Yes please do the simplest parser!