Skip to content

fixed make_whole only working on 0 base AtomGroups#1987

Merged
richardjgowers merged 3 commits intodevelopfrom
make_whole_fix
Jul 17, 2018
Merged

fixed make_whole only working on 0 base AtomGroups#1987
richardjgowers merged 3 commits intodevelopfrom
make_whole_fix

Conversation

@richardjgowers
Copy link
Copy Markdown
Member

@jbarnoud the bug you found was actually worse than initially thought. bonds.to_indices gave the global index of the atoms involved, whereas indexing .positions uses local indices (ie the index within the AtomGroup)

@richardjgowers richardjgowers requested a review from jbarnoud July 14, 2018 22:25
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 15, 2018

Codecov Report

Merging #1987 into develop will decrease coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1987      +/-   ##
===========================================
- Coverage    88.48%   88.45%   -0.03%     
===========================================
  Files          142      142              
  Lines        17202    17202              
  Branches      2635     2635              
===========================================
- Hits         15221    15216       -5     
- Misses        1385     1389       +4     
- Partials       596      597       +1
Impacted Files Coverage Δ
package/MDAnalysis/coordinates/TRJ.py 90.6% <0%> (-0.91%) ⬇️
package/MDAnalysis/lib/util.py 86.19% <0%> (-0.34%) ⬇️

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 50d8687...e8b2b17. Read the comment docs.

@jbarnoud
Copy link
Copy Markdown
Contributor

I tries it and it appears to work. We are missing two tests, though: a test where the AtomGroup that is passed to make_whole is not at the beginning of the global atom sequence, an a test where the atom group is shuffled.

# Draw vector from atom to other
for i in range(3):
vec[i] = oldpos[other, i] - oldpos[atom, i]
vec[i] = oldpos[other, i] - newpos[atom, i]
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

because we're using newpos[atom, i] later (and is equivalent to oldpos[atom, i]), maybe this can cause a cache hit

@richardjgowers
Copy link
Copy Markdown
Member Author

@jbarnoud should be good to go

@richardjgowers
Copy link
Copy Markdown
Member Author

The linter is crying and I'm not sure why, and I can't reproduce it locally. Thanks pylint

@jbarnoud
Copy link
Copy Markdown
Contributor

It looks like pylint got updated and now detects new things. The fixes should probably go in an other PR.

Copy link
Copy Markdown
Contributor

@jbarnoud jbarnoud left a comment

Choose a reason for hiding this comment

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

I needed it today, and it works just as expected. Along side @davidercruz's on-the-fly transformation it is pure magic.

I'll see how long it takes to fix the pylint error before I merge, though.

- env: NAME="Lint"
PYLINTRC="${TRAVIS_BUILD_DIR}/package/.pylintrc"
MAIN_CMD="pylint package/MDAnalysis && pylint testsuite/MDAnalysisTests"
MAIN_CMD="pylint --rcfile=$PYLINTRC package/MDAnalysis && pylint --rcfile=$PYLINTRC testsuite/MDAnalysisTests"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this isn't changing anything. It should already pick up the right RC file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants