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
Is your feature request related to a problem? Please describe.
This mailing list issue is a good use case of Linear Density but is foiled by the class not supporting UpdatingAtomGroups.
It is not intuitive to me that LinearDensity.results['x']['pos'] refers to the mass-weighted density in g/cm^3 of the selection. pos makes me think of coordinates. char makes me think of characters.
If the class saves the bins from np.histogram, it would be far easier to take advantage of existing histogram plotting tools. Also, using np.histogramdd seems easier.
The output is just an array of floats and the documentation doesn't say which units the density is in. These are not the normal units of MDAnalysis (amu for mass, Angstrom for length, e for charge) so they need special documentation. Also, the units written in the header of the file output are inaccurate for the charge. See Different units in analysis.LinearDensity #2507 for more
Describe the solution you'd like
Move the code below to _single_frame() so it updates.
# Get masses and charges for the selectiontry: # in case it's not an atomself.masses=np.array([elem.total_mass() forelemingroup])
self.charges=np.array([elem.total_charge() forelemingroup])
exceptAttributeError: # much much faster for atomsself.masses=self._ags[0].massesself.charges=self._ags[0].chargesself.totalmass=np.sum(self.masses)
Call them .mass_density and .charge_density in their own NumPy arrays. Have the results as Numpy arrays instead of dictionaries.
Save the bins
Not change the units.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Happy to do this at some point, if people are ok with breaking scripts that have coded the original .results['x']['pos'] indexing into them
Is your feature request related to a problem? Please describe.
This mailing list issue is a good use case of Linear Density but is foiled by the class not supporting UpdatingAtomGroups.
It is not intuitive to me that
LinearDensity.results['x']['pos']refers to the mass-weighted density in g/cm^3 of the selection.posmakes me think of coordinates.charmakes me think of characters.If the class saves the bins from
np.histogram, it would be far easier to take advantage of existing histogram plotting tools. Also, usingnp.histogramddseems easier.The output is just an array of floats and the documentation doesn't say which units the density is in. These are not the normal units of MDAnalysis (amu for mass, Angstrom for length, e for charge) so they need special documentation. Also, the units written in the header of the file output are inaccurate for the charge. See Different units in analysis.LinearDensity #2507 for more
Describe the solution you'd like
_single_frame()so it updates.Call them
.mass_densityand.charge_densityin their own NumPy arrays. Have the results as Numpy arrays instead of dictionaries.Save the bins
Not change the units.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Happy to do this at some point, if people are ok with breaking scripts that have coded the original
.results['x']['pos']indexing into them