patrickfuchs / buildH

:computer: Build hydrogen atoms from united-atom molecular dynamics of lipids and calculate the order parameters.
https://buildh.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
14 stars 7 forks source link

Test and update to MDAnalysis 2.0.0 #152

Closed pierrepo closed 3 years ago

pierrepo commented 3 years ago

MDAnalysis 2.0.0 has been released a week ago. This new release is compatible with Python 3.9 (contrary to previous version 1.1.1 compatible up to Python 3.8).

We might want to evaluate this new release and update to it.

patrickfuchs commented 3 years ago

Yes good idea. We can talk about it this afternoon.

HubLot commented 3 years ago
patrickfuchs commented 3 years ago

Just tried the notebooks with MDAnalysis2.0. We have some new Warnings for Notebooks 2, 3, 4 and 5. Always the same ones, for example in Notebook 2 :

$ buildH -c start_128popc.pdb -l Berger_POPC -t popc0-25ns_dt1000.xtc -d Berger_POPC.def -o OP_POPC.dat -opx traj_POPC_wH
Constructing the system...
/home/fuchs/software/miniconda3/envs/GOGO/lib/python3.8/site-packages/MDAnalysis/topology/PDBParser.py:317: UserWarning: Element information is missing, elements attribute will not be populated. If needed these can be guessed using MDAnalysis.topology.guessers.
  warnings.warn("Element information is missing, elements attribute "
System has 28526 atoms
Writing new pdb with hydrogens.
/home/fuchs/software/miniconda3/envs/GOGO/lib/python3.8/site-packages/MDAnalysis/topology/PDBParser.py:317: UserWarning: Element information is missing, elements attribute will not be populated. If needed these can be guessed using MDAnalysis.topology.guessers.
  warnings.warn("Element information is missing, elements attribute "
Writing trajectory with hydrogens in xtc file.
Dealing with frame 0 at 0.0 ps.
Dealing with frame 1 at 1000.0 ps.
[...]

The first warning appears when we create the Universe with a pdb (no problem with a gro). The second warning appears when we use option -opx, I guess when we create the Universe with Hs.

Looks like MDAnalysis can't guess some attributes (e.g. masses). Maybe we should use MDAnalysis.topology.guessers as suggested there?

lilyminium commented 3 years ago

Those warnings will always appear for reading a PDB file without an elements column. You could guess the elements from names, I think it should work alright for standard atom names, but I think it'll assign CH groups as C. For reading in PDB files you could get rid of the warnings by using a TPR file instead. Alternatively, you could just filter this specific warning.

For the second warning you could prevent that by writing out a PDB with elements here: https://github.com/patrickfuchs/buildH/blob/ac30bb83e9c3ee361283299b2a87c1832bb34652/buildh/core.py#L621-L635 (the warning comes when you read it back in for the new universe).

patrickfuchs commented 3 years ago

Thanks very much @lilyminium, this is very useful! I think we will probably silent the warning coming from the input pdb because we are not sure whether the user provides a valid pdb. For the output pdb, we can indeed add the element. It's not an issue per se since we don't use the element attributes.

patrickfuchs commented 3 years ago

I understand why those warnings appeared, this is just because it changed between MDAnalysis 1.1.1 and 2.0.0.

In fact, we already silenced this warning in the previous version in __init.py__. I update this now.

patrickfuchs commented 3 years ago

Done in 87cc4fb !