-
Notifications
You must be signed in to change notification settings - Fork 767
Open
Labels
Component-TopologyDifficulty-easyGSOC Starterhelp wantedoutreachy-taskStarter tasks for the Outreachy programStarter tasks for the Outreachy program
Description
Our Topology system is statically typed, each TopologyAttr (found here) should only accept one data type, e.g. atom names (here) should always be strings, resids should always be ints.
Currently setting an atom name to an integer gives "TypeError: 'int' object is not iterable"
import MDAnalysis as mda
u = mda.fetch_mmft('181l')
u.atoms[0].name = 1This should instead fail and inform that atom names need to be strings.
Setting a Residue's resid to a float seems to work...
import MDAnalysis as mda
u = mda.fetch_mmft('181l')
u.residues[0].resid = 2.4
This probably is using the inbuilt rounding in numpy int arrays, but it should probably raise an error too.
To fix this, we could have a check_dtype decorator around TopologyAttr.set_atoms (and residue/segment) to check that the supplied values are the correct type.
Metadata
Metadata
Assignees
Labels
Component-TopologyDifficulty-easyGSOC Starterhelp wantedoutreachy-taskStarter tasks for the Outreachy programStarter tasks for the Outreachy program