masses_new

mdtools.check.masses_new(ag, verbose=False)[source]

Check atom masses.

Note

mdtools.check.masses_new() will replace mdtools.check.masses() in a future release. When doing so, masses_new() will be renamed to mdtools.check.masses() (hence lines containing mdtools.check.masses_new() can have 76 characters instead of 72).

MDAnalysis always guesses atom masses from the atom types, even if the input file contains the masses. This might result in wrong mass assignments. If the mass cannot be guessed at all, a mass of 0 is assigned. Hence, it is important to check the correct assignment of masses before calculating mass dependent quantities like the center of mass.

Parameters:
  • ag (MDAnalysis.core.groups.AtomGroup) – The MDAnalysis AtomGroup whose masses shall be checked.

  • verbose (bool, optional) – If True, print a list of all different atom types in ag with their corresponding masses as guessed by MDAnalysis to standard output so that the user can check whether the masses were guessed correctly.

Raises:

ValueError – If at least one Atom of ag has a mass equal to or less than zero.

Note

This function only checks if any atom type was assigned a mass less than or equal to zero. This functions checks not whether positive masses were assigned correctly. This can be done manually by the user, when verbose is True.