Skip to content

Proper error message and suggestion for AlignTraj on trajectory without mass #2469

@xiki-tempula

Description

@xiki-tempula

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions