sknano.core.atoms.KDTAtoms.mapatomattr

KDTAtoms.mapatomattr(attr, from_attr, attrmap)[source]

Set/update atom attribute from another atom attribute with dict.

Parameters:

attr, from_attr : str

attrmap : dict

Examples

Suppose you have an XAtoms instance named atoms that has XAtom instances of two atomtypes 1 and 2 and we want to set all XAtoms with atomtype=1 to Nitrogen and all XAtoms with atomtype=2 to Argon.

We’d call this method like so:

>>> atoms.mapatomattr('element', 'atomtype', {1: 'N', 2: 'Ar'})