-
Notifications
You must be signed in to change notification settings - Fork 22
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
Refactor pmda after universe can be serialized #132
Open
yuxuanzhuang
wants to merge
34
commits into
MDAnalysis:master
Choose a base branch
from
yuxuanzhuang:refactor_pmda
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
1e3d27b
refactor parallel.py
yuxuanzhuang 4435f29
refactor custom
yuxuanzhuang 1981673
pep8
yuxuanzhuang 0a70857
refactor rmsd
yuxuanzhuang cafe65f
refactor rmsf
yuxuanzhuang 185d19a
refactor contacts
yuxuanzhuang ef86b9d
refactor density
yuxuanzhuang c0b0bd6
refactor rdf
yuxuanzhuang bfa629c
refactor HBonds
yuxuanzhuang 495033f
leaflet broken
yuxuanzhuang 8700223
build mdanalysis on serialize_io
yuxuanzhuang c8e9973
build mdanalysis on serialize_io fix
yuxuanzhuang 356cfb9
push leaflet fix back
yuxuanzhuang 58fea5d
travis fix
yuxuanzhuang dfd3588
travis fix
yuxuanzhuang 0921882
test parallel
yuxuanzhuang 49288e8
timing test
yuxuanzhuang 9a0e0c5
leaflet fix
yuxuanzhuang 187463b
pep8
yuxuanzhuang 8a42040
make sure universe before atomgroup
yuxuanzhuang 053225b
change travis back
yuxuanzhuang 83becd7
travis to develop
yuxuanzhuang f9c89e6
remove getstate
yuxuanzhuang 61bce8f
pep8
yuxuanzhuang cb99fc8
update setup.py
yuxuanzhuang d95add1
pep8 warning
yuxuanzhuang a505282
travis
yuxuanzhuang 608a803
setup reverse
yuxuanzhuang 18988c5
pep
yuxuanzhuang 61a34c7
setup py3
yuxuanzhuang 7bf68f5
rewind doc
yuxuanzhuang 5ceaebf
doc
yuxuanzhuang d424f6d
merge to develop
yuxuanzhuang b649c04
Merge branch 'master' into refactor_pmda
orbeckst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,9 +22,6 @@ | |
MDAnalysis.analysis.density.density_from_Universe | ||
|
||
""" | ||
|
||
from __future__ import absolute_import | ||
|
||
import numpy as np | ||
|
||
from MDAnalysis.lib.util import fixedwidth_bins | ||
|
@@ -241,7 +238,7 @@ def __init__(self, atomgroup, delta=1.0, atomselection=None, | |
parameters=None, gridcenter=None, xdim=None, ydim=None, | ||
zdim=None): | ||
u = atomgroup.universe | ||
super(DensityAnalysis, self).__init__(u, (atomgroup, )) | ||
super().__init__(u) | ||
self._atomgroup = atomgroup | ||
self._delta = delta | ||
self._atomselection = atomselection | ||
|
@@ -259,10 +256,15 @@ def __init__(self, atomgroup, delta=1.0, atomselection=None, | |
elif not updating and atomselection is not None: | ||
raise ValueError("""With updating=False, the atomselection='{}' is | ||
not used and should be None""".format(atomselection)) | ||
elif updating and atomselection is not None: | ||
self._select_atomgroup = atomgroup.select_atoms(atomselection, | ||
updating=True) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do updating AtomGroups work with the serialization? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes! Thanks to what has already been implemented by Richard:) |
||
else: | ||
self._select_atomgroup = atomgroup | ||
|
||
|
||
def _prepare(self): | ||
coord = self.current_coordinates(self._atomgroup, self._atomselection, | ||
self._updating) | ||
coord = self._select_atomgroup.positions | ||
if self._gridcenter is not None: | ||
# Generate a copy of smin/smax from coords to later check if the | ||
# defined box might be too small for the selection | ||
|
@@ -294,10 +296,10 @@ def _prepare(self): | |
self._arange = arange | ||
self._bins = bins | ||
|
||
def _single_frame(self, ts, atomgroups): | ||
coord = self.current_coordinates(atomgroups[0], self._atomselection, | ||
self._updating) | ||
result = np.histogramdd(coord, bins=self._bins, range=self._arange, | ||
def _single_frame(self): | ||
result = np.histogramdd(self._select_atomgroup.positions, | ||
bins=self._bins, | ||
range=self._arange, | ||
normed=False) | ||
return result[0] | ||
|
||
|
@@ -330,12 +332,3 @@ def _reduce(res, result_single_frame): | |
else: | ||
res += result_single_frame | ||
return res | ||
|
||
@staticmethod | ||
def current_coordinates(atomgroup, atomselection, updating): | ||
"""Retrieves the current coordinates of all atoms in the chosen atom | ||
selection. | ||
Note: currently required to allow for updating selections""" | ||
ag = atomgroup if not updating else atomgroup.select_atoms( | ||
atomselection) | ||
return ag.positions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Hm, cool that this works.