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
For at least moment_of_inertia and asphericity the use of compounds seems to be broken:
Expected behavior
fromMDAnalysis.tests.datafilesimportTRZ_psf, TRZu=mda.Universe(TRZ_psf, TRZ) # universe with 24 residuesu.atoms.asphericity(compound='residues')
# expected a 1D array with 24 values of asphericity, one per residue# equivalent tonp.array([res.atoms.asphericity() forresinu.residues])
u.atoms.moment_of_inertia(compound='residues')
# expected a 3D array with 24 MoI 3x3 tensors, one per residue, with shape (24,3,3)# equivalent tonp.array([res.atoms.moment_of_inertia() forresinu.residues])
Actual behavior
u.atoms.asphericity(compound='residues')
~/src/MDAnalysis/mdanalysis/package/MDAnalysis/lib/util.pyinwrapper(group, *args, **kwargs)
1841# has already been thrown:1842ifgroup.isuniqueorwarn_if_not_unique.warned:
->1843returngroupmethod(group, *args, **kwargs)
1844# Otherwise, throw a DuplicateWarning and execute the method.1845method_name=".".join(
~/src/MDAnalysis/mdanalysis/package/MDAnalysis/core/groups.pyinwrapped(group, *args, **kwargs)
386raiseValueError(
387"both 'pbc' and 'unwrap' can not be set to true")
-->388returnfunction(group, *args, **kwargs)
389returnwrapped390~/src/MDAnalysis/mdanalysis/package/MDAnalysis/core/topologyattrs.pyinasphericity(group, pbc, unwrap, compound)
1418pbc=pbc, unwrap=unwrap, compound=compound)
1419ifcompound!='group':
->1420com= (com*group.masses[:, None]
1421 ).sum(axis=0) /group.masses.sum()
1422ValueError: operandscouldnotbebroadcasttogetherwithshapes (24,3) (8184,1)
u.atoms.moment_of_inertia(compound='residues')
~/src/MDAnalysis/mdanalysis/package/MDAnalysis/lib/util.pyinwrapper(group, *args, **kwargs)
1841# has already been thrown:1842ifgroup.isuniqueorwarn_if_not_unique.warned:
->1843returngroupmethod(group, *args, **kwargs)
1844# Otherwise, throw a DuplicateWarning and execute the method.1845method_name=".".join(
~/src/MDAnalysis/mdanalysis/package/MDAnalysis/core/groups.pyinwrapped(group, *args, **kwargs)
386raiseValueError(
387"both 'pbc' and 'unwrap' can not be set to true")
-->388returnfunction(group, *args, **kwargs)
389returnwrapped390~/src/MDAnalysis/mdanalysis/package/MDAnalysis/core/topologyattrs.pyinmoment_of_inertia(group, pbc, **kwargs)
1260pbc=pbc, unwrap=unwrap, compound=compound)
1261ifcompound!='group':
->1262com= (com*group.masses[:, None]
1263 ).sum(axis=0) /group.masses.sum()
1264ValueError: operandscouldnotbebroadcasttogetherwithshapes (24,3) (8184,1)
Calling the method on a ResidueGroup seems to default to using compound='group' and yield a single value. More puzzingly, calling it on a ResidueGroup and explicitly passing compound='residues' works (no ValueError) but yields the same single value (with some precision difference betraying a different logic route):
For at least
moment_of_inertia
andasphericity
the use of compounds seems to be broken:Expected behavior
Actual behavior
Calling the method on a
ResidueGroup
seems to default to usingcompound='group'
and yield a single value. More puzzingly, calling it on aResidueGroup
and explicitly passingcompound='residues'
works (noValueError
) but yields the same single value (with some precision difference betraying a different logic route):A consolidated compound-splitting strategy (#3000) might help fix these issues and uniformize the API.
Current version of MDAnalysis
2.0.0-dev0
(at commit beb5232)3.6.9
The text was updated successfully, but these errors were encountered: