-
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
Proper error message and suggestion for AlignTraj on trajectory without mass #2469
Comments
Can this issue be worked around by setting all masses to 1 (as your beads
happen to have identical masses)?
…On Sun, Jan 26, 2020 at 21:37, Zhiyi Wu ***@***.***> wrote:
*Is your feature request related to a problem? Please describe.*
Coarse-grain trajectory has no assigned mass but it still makes sense to
use the AlignTraj. Thus, if one were to run.
u = mda.Universe(gro)
protein = u.select_atoms('bynum 1-518')
traj = mda.Universe(xtc, xtc)
AlignTraj(traj, protein, select='bynum 1-518', in_memory=True)
He will get
File "pa.py", line 13, in plot
AlignTraj(traj, protein, select='bynum 1-518', in_memory=True)
File "/Users//GitHub/mdanalysis/package/MDAnalysis/analysis/align.py", line 668, in __init__
strict=strict, match_atoms=match_atoms)
File "/Users//GitHub/mdanalysis/package/MDAnalysis/analysis/align.py", line 1187, in get_matching_atoms
mass_mismatches = (np.absolute(ag1.masses - ag2.masses) > tol_mass)
File "/Users//GitHub/mdanalysis/package/MDAnalysis/core/groups.py", line 2294, in __getattr__
cls=self.__class__.__name__, attr=attr))
AttributeError: AtomGroup has no attribute masses
I felt that there should be certain options to disable the check on mass
if the weight is not set to mass.
Say if one run
AlignTraj(traj, protein, select='bynum 1-518', in_memory=True,
weights=None)
Then the AlignTraj should work without checking for mass.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2469?email_source=notifications&email_token=ACGSGB72YE43NFV4RQKQDQLQ7X7CTA5CNFSM4KLZLXD2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IIZCRSQ>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACGSGB24TI7J4X6EYMWOFD3Q7X7CTANCNFSM4KLZLXDQ>
.
|
@richardjgowers Yes, I'm currently solving it by adding the mass. But I felt that since the AlignTraj doesn't require mass information in this case, it doesn't make sense by force the mass attribute to be present, |
Try setting Edit: although I think that's only in the develop branch. And possibly it should be off by default anyway. |
@lilyminium Thanks. It seems to be working. It might be a good idea to document it. |
I think this just needs a doc fix rather than a behaviour change. The case where all atoms are similar mass (so don't required weighting) is very niche, and I can see more people (with dissimilar masses) getting burnt by weighting being ignored when masses aren't available. |
@richardjgowers mdanalysis/package/MDAnalysis/analysis/align.py Line 1367 in 3be5c98
to |
@lilyminium I'm making the changes suggested by you hope these try to solve the problem of mismatching. |
@lilyminium If could please spare some time to review my PR and suggest the changes required. |
@xiki-tempula actually I'm surprised your topology didn't have masses, because I thought that was a mandatory attribute that would be guessed if not given. |
* Fixes issue #2469 * raise SelectionWarning if AlignTraj is called with match_atoms=True and masses are not present * fit_translation and fit_trans_rot now raise TypeErrors (originally ValueErrors) for getting weights from atoms without masses * get_weights now raises ValueError if weights is given as incorrect value (originally TypeError) Co-authored-by: Philip Loche <ploche@physik.fu-berlin.de> Co-authored-by: Oliver Beckstein <orbeckst@gmail.com>
Is your feature request related to a problem? Please describe.
Coarse-grain trajectory has no assigned mass but it still makes sense to use the AlignTraj. Thus, if one were to run.
He will get
I felt that there should be certain options to disable the check on mass if the weight is not set to mass.
Say if one run
AlignTraj(traj, protein, select='bynum 1-518', in_memory=True, weights=None)
Then the AlignTraj should work without checking for mass.
The text was updated successfully, but these errors were encountered: