-
Notifications
You must be signed in to change notification settings - Fork 664
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 density.py #612
Update density.py #612
Conversation
To update atoms selection inside density_from_Universe function: a new parameter has been added ("sel_update"). When user set sel_update=True, then atomselection is updated for each frame. Accordingly lines 515 to 520 have been modified to consider/not to consider updates for each frame.
@@ -511,7 +512,13 @@ def current_coordinates(): | |||
for ts in u.trajectory: | |||
print("Histograming %6d atoms in frame %5d/%d [%5.1f%%]\r" % \ | |||
(len(coord), ts.frame, u.trajectory.n_frames, 100.0 * ts.frame / u.trajectory.n_frames),) | |||
coord = current_coordinates() | |||
if sel_update=True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The syntax is not correct here. To check for equality one would use ==
. But since sel_update
contains a boolean that is not even necessary. Just writinge if sel_update
is enough.
if sel_update:
# do stuff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sel_update --> update_selection
Your tests failed. Follow the link Details for continuous-integration/travis-ci/pr — The Travis CI build failed and fix whatever made the test fail (probably the syntax error that @kain88-de pointed out but you need to check for yourself – that's the usual development pattern: submit PR, check tests, fix, repeat). |
@@ -450,6 +450,7 @@ def density_from_Universe(universe, delta=1.0, atomselection='name OH2', | |||
cutoff | |||
With *cutoff*, select '<atomsel> NOT WITHIN <cutoff> OF <soluteselection>' | |||
(Special routines that are faster than the standard AROUND selection) [0] | |||
sel_update : When set to True, atom selection is updated for each frame |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sel_update --> update_selection
Sorry for the delayed response. Now i corrected code taking your suggestion. I am presently checking it. |
@@ -450,6 +450,8 @@ def density_from_Universe(universe, delta=1.0, atomselection='name OH2', | |||
cutoff | |||
With *cutoff*, select '<atomsel> NOT WITHIN <cutoff> OF <soluteselection>' | |||
(Special routines that are faster than the standard AROUND selection) [0] | |||
update_selection | |||
True: Atom selection is updated for each frame |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at the bottom of the doc string add
.. versionchanged:: 0.13.0
*update_selection* keyword added
Looking good, only a few things to do:
History rewritingDo you know how squish all five commits into a single one (using e.g. The commit history in the develop branch should be reasonable clean, along the lines of "one commit, one feature" (and as little as work in progress). Also, if you rewrite your history with rebase, make the commit title and text more expressive, along the lines of
Then make another commit with CHANGELOG and authorship: CHANGELOG
AuthorshipThis is your first contribution to MDAnalysis --- welcome and thank you!
I am adding you as a contributor to the project on github and you should get a notification soon. |
Hi, |
I'll do the clean-up. |
Note: This PR belongs to #584 . |
This is now on PR #614 |
To update atoms selection inside density_from_Universe function: a new parameter has been added ("sel_update"). When user set sel_update=True, then atomselection is updated for each frame. Accordingly lines 515 to 520 have been modified to consider/not to consider updates for each frame.