Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to chemfiles 0.10 #3126

Merged
merged 7 commits into from
May 8, 2021
Merged

Conversation

Luthaf
Copy link
Contributor

@Luthaf Luthaf commented Feb 19, 2021

Changes made in this Pull Request:

  • Chemfiles coordinate reader updated to the API changes in chemfiles 0.10 (in practice, the only relevant change here is a different constructor for UnitCell).

Chemfiles 0.10 contains multiple fixes to different format readers; and add support for crystalographic CIF files, and extended XYZ (cf https://wiki.fysik.dtu.dk/ase/ase/io/formatoptions.html#extxyz)

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?

@pep8speaks
Copy link

pep8speaks commented Feb 19, 2021

Hello @Luthaf! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 26:80: E501 line too long (83 > 79 characters)
Line 28:80: E501 line too long (84 > 79 characters)
Line 40:80: E501 line too long (85 > 79 characters)
Line 132:80: E501 line too long (85 > 79 characters)
Line 169:80: E501 line too long (80 > 79 characters)
Line 316:80: E501 line too long (80 > 79 characters)
Line 346:80: E501 line too long (80 > 79 characters)

Line 26:80: E501 line too long (83 > 79 characters)
Line 27:80: E501 line too long (86 > 79 characters)
Line 32:80: E501 line too long (89 > 79 characters)
Line 33:80: E501 line too long (91 > 79 characters)
Line 40:80: E501 line too long (85 > 79 characters)
Line 47:80: E501 line too long (136 > 79 characters)
Line 49:80: E501 line too long (89 > 79 characters)
Line 52:80: E501 line too long (83 > 79 characters)
Line 132:80: E501 line too long (85 > 79 characters)

Comment last updated at 2021-05-08 00:15:17 UTC

@codecov
Copy link

codecov bot commented Feb 19, 2021

Codecov Report

Merging #3126 (b836d43) into develop (da46e84) will increase coverage by 0.52%.
The diff coverage is 94.59%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3126      +/-   ##
===========================================
+ Coverage    93.03%   93.55%   +0.52%     
===========================================
  Files          172      172              
  Lines        22724    22806      +82     
  Branches      3193     3193              
===========================================
+ Hits         21141    21337     +196     
+ Misses        1533     1419     -114     
  Partials        50       50              
Impacted Files Coverage Δ
package/MDAnalysis/coordinates/chemfiles.py 96.75% <94.59%> (+64.93%) ⬆️
package/MDAnalysis/analysis/base.py 96.61% <0.00%> (-0.03%) ⬇️
package/MDAnalysis/analysis/diffusionmap.py 100.00% <0.00%> (ø)
package/MDAnalysis/analysis/helix_analysis.py 100.00% <0.00%> (ø)
...nalysis/analysis/hydrogenbonds/wbridge_analysis.py 97.42% <0.00%> (+<0.01%) ⬆️
...DAnalysis/analysis/hydrogenbonds/hbond_analysis.py 98.70% <0.00%> (+0.06%) ⬆️
package/MDAnalysis/analysis/align.py 98.32% <0.00%> (+0.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update da46e84...b836d43. Read the comment docs.

@@ -333,7 +347,12 @@ def _timestep_to_chemfiles(self, ts):
if ts.has_velocities:
frame.add_velocities()
frame.velocities[:] = ts.velocities[:]
frame.cell = chemfiles.UnitCell(*ts.dimensions)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is the only real change, could we have a try/except here and allow 0.9 and 0.10?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only change in the part of the API used in MDA yes.

I could add a version check here, but for the future I'd like to not keep old versions around too long, and drop 0.9 when 0.11 comes out 😃

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way this goes, can the minimum version be pinned in the gh actions CI workflow? That way we can be sure we're picking up the right thing.

@Luthaf
Copy link
Contributor Author

Luthaf commented Feb 28, 2021

@IAlibay

Either way this goes, can the minimum version be pinned in the gh actions CI workflow? That way we can be sure we're picking up the right thing.

I've pinned chemfiles to == 0.9 in CI, do you think there should be automated tests with both 0.9.3 and 0.10.x?

@Luthaf Luthaf force-pushed the chemfiles-0.10 branch 2 times, most recently from 6950d1d to 4f2fe62 Compare February 28, 2021 14:23
@IAlibay
Copy link
Member

IAlibay commented Feb 28, 2021

@IAlibay

Either way this goes, can the minimum version be pinned in the gh actions CI workflow? That way we can be sure we're picking up the right thing.

I've pinned chemfiles to == 0.9 in CI, do you think there should be automated tests with both 0.9.3 and 0.10.x?

Probably the best thing here is to do >=0.9 and then if we want to test legacy versions we can create a cron job for it when we get around to implementing #3052 (at least in my opinion, ideally the only legacy version we really want to test at every push is numpy, otherwise we'll quickly end up with a giant matrix).

@Luthaf Luthaf force-pushed the chemfiles-0.10 branch 2 times, most recently from d03e815 to 63007cb Compare March 2, 2021 12:59
@Luthaf
Copy link
Contributor Author

Luthaf commented Mar 3, 2021

The codecov failure is weird, but other than that this should be ready to go!

@IAlibay
Copy link
Member

IAlibay commented Mar 13, 2021

@Luthaf Apologies for the delay. I thought it was probably easier to merge #3128 first so that any changes could then be updated to reflect those being done here (e.g. version of the docs being linked to). Could you resolve the conflicts and then we can aim for a merge?

@Luthaf
Copy link
Contributor Author

Luthaf commented Mar 13, 2021

Rebased! Let's see what CI says.

@Luthaf
Copy link
Contributor Author

Luthaf commented Mar 13, 2021

The python 3.6 runner fails with OSError: libssl.so.1.0.0: cannot open shared object file: No such file or directory when trying to load libchemfiles.so. Is there any difference in the environment between the 3.6 builders and the other ones? I'll investigate a bit more where the dependency on libssl comes from, since chemfiles itself is not using it.

@IAlibay
Copy link
Member

IAlibay commented Mar 13, 2021

The python 3.6 runner fails with OSError: libssl.so.1.0.0: cannot open shared object file: No such file or directory when trying to load libchemfiles.so. Is there any difference in the environment between the 3.6 builders and the other ones? I'll investigate a bit more where the dependency on libssl comes from, since chemfiles itself is not using it.

How strange. We've been having some occasional issues with gh actions and py3.6 lately. I have restarted CI to see if somehow that fixes it.

@IAlibay
Copy link
Member

IAlibay commented Mar 13, 2021

It seems like a consistent error. Strangely enough it's not happening on the 3.6 runner with numpy 1.16.0.
I guess there might be some kind of dependency clash here that is causing chemfiles to fail?

@Luthaf Luthaf force-pushed the chemfiles-0.10 branch 6 times, most recently from 1bc8d2d to e2ca585 Compare April 4, 2021 22:57
@Luthaf
Copy link
Contributor Author

Luthaf commented Apr 4, 2021

I think I found the origin of the issue here: libchemfiles links to libnetcdf, which links to libcurl. For a yet unknown reason, the conda build pulls in libssh2 from the biobuilds channel, which is linked by libcurl. libssh2 links to libopenssl.so.1.0.0, which is not installed (instead conda-forge gives us libopenssl.so.1.1.1). Given that the last update to libssh2 in biobuilds is more than 3 years old, I think it is best to stick with the conda-forge version.

It looks like the biobuilds channel is used only for clustalw, is this right? It looks like removing biobuilds from the main list of channels and instead using the channel as a one shot (conda install -c biobuilds clustalw=2.1) fixes the issue, and conda picks the newer llibssh2/openssl. I'll re-run the full CI with this configuration.

@Luthaf
Copy link
Contributor Author

Luthaf commented Apr 5, 2021

The failed build is due to an HTTP error while fetching conda package. Could you restart it?

@Luthaf
Copy link
Contributor Author

Luthaf commented Apr 5, 2021

Everything looks ok now, thanks for the restart! I'm not sure what to do about the codecov patch coverage error: most of the "not covered" lines are related to codepath for chemfiles 0.9

Copy link
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Luthaf sorry about all the CI related queries 😅 couple more things

.github/workflows/gh-ci.yaml Outdated Show resolved Hide resolved
.github/workflows/gh-ci.yaml Outdated Show resolved Hide resolved
package/MDAnalysis/coordinates/chemfiles.py Show resolved Hide resolved
package/MDAnalysis/coordinates/chemfiles.py Outdated Show resolved Hide resolved
package/MDAnalysis/coordinates/chemfiles.py Show resolved Hide resolved
@Luthaf Luthaf force-pushed the chemfiles-0.10 branch 2 times, most recently from f90b7e6 to 2c94ba0 Compare April 5, 2021 21:49
@IAlibay IAlibay added this to the 2.0 milestone Apr 6, 2021
@Luthaf Luthaf force-pushed the chemfiles-0.10 branch from 3a62f46 to 562bd43 Compare May 2, 2021 11:45
Copy link
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Luthaf I'll approve as-is, if you can add the suggested test that'd be great, if it proves more complicated than just that addition then let's just go with this and we can fix coverage some other time.

@Luthaf Luthaf force-pushed the chemfiles-0.10 branch from e12e44c to 961b996 Compare May 7, 2021 06:30

lengths = ts.dimensions[:3]
angles = ts.dimensions[3:]
if angles[0] == 0.0 and angles[1] == 0.0 and angles[2] == 0.0:
Copy link
Member

@IAlibay IAlibay May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Luthaf I'm actually not sure what's being done here, do you have a quick explanation you can provide?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be me being overly defensive. Does MDA guarantee angles to have valid values? If so this check can probably be removed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O I see I guess you're capturing the [0., 0., 0., 0., 0., 0.] default case here mostly? (i.e. #2698)

I'm going to ping @richardjgowers here who was working on this for 2.0 if I remember correctly, and might have better insights.

Maybe the best thing to do here is just to check for [0., 0., 0., 0., 0., 0.] or None as the default box case, and then if that's not the case crash out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, chemfiles is fine with lengths of 0 but requires angles to be 90 in this case. I try to be generous in what code accept, so checking only for angles gives the maximal flexibility, but I'm also fine with checking if ts.dimensions is [0., 0., 0., 0., 0., 0.] and rejecting more wrong/missing cells.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what's the decision here? Should I change this to check for either [0., 0., 0., 0., 0., 0.] or None?

@richardjgowers
Copy link
Member

richardjgowers commented May 7, 2021 via email

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

package/MDAnalysis/coordinates/chemfiles.py Outdated Show resolved Hide resolved
@richardjgowers richardjgowers merged commit a9eafab into MDAnalysis:develop May 8, 2021
@Luthaf Luthaf deleted the chemfiles-0.10 branch May 8, 2021 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants