You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off, thanks for making and maintaining this, it's a really nice project!
I have a problem where I want to calculate the density of a molecule in multiple simulations. I've solved this by subclassing AnalysisBase and feeding my atom positions to np.histogramdd. This works. What I want now is to calculate a similar density profile, but only looking at the center of mass of the molecule. The cleanest way (from the perspective of my code) of doing this would be by changing my selection string from resid 0-17 to com of resid 0-17, which MDA would deal with by creating an atomgroup with a single particle, which would be some kind of pseudo-atom.
If you have more questions, feel free to ask :)
The text was updated successfully, but these errors were encountered:
pckroon
changed the title
Add pseudo-atoms for analysis
Add 'com of' selection syntax
Jul 30, 2018
What you're suggesting is sort of #1861 where we want a fake particle which represents the aggregated properties of many particles. I posted some code here which does the trick, although it only does positions (until you hack in more attributes)
So you could use it as
ag=u.select_atoms('resid 0-17')
bg=BeadGroup([ag])
bg.positions# should give you an array of 1 position# And to capture many groups..ag2=u.select_atoms(????)
bg=BeadGroup([ag, ag2])
# bg now has length 2, ie represents the COM of 2 groups
It should be fairly easy to hack in extra attributes, ie mass you'd want to sum for each group etc. Hope that helps!
Thanks! It's indeed similar. To me as an outsider it sounds like it would be a good idea if a com of or cog of selection would create one of these BeadGroups, or AgregateGroups under the hood.
Hello world!
First off, thanks for making and maintaining this, it's a really nice project!
I have a problem where I want to calculate the density of a molecule in multiple simulations. I've solved this by subclassing
AnalysisBase
and feeding my atom positions tonp.histogramdd
. This works. What I want now is to calculate a similar density profile, but only looking at the center of mass of the molecule. The cleanest way (from the perspective of my code) of doing this would be by changing my selection string fromresid 0-17
tocom of resid 0-17
, which MDA would deal with by creating an atomgroup with a single particle, which would be some kind of pseudo-atom.If you have more questions, feel free to ask :)
The text was updated successfully, but these errors were encountered: