sknano.core.atoms.XAtoms.mapatomattr¶
-
XAtoms.mapatomattr(attr, from_attr, attrmap)[source][source]¶ Set/update atom attribute from another atom attribute with dict.
Parameters: attr, from_attr :
strattrmap :
dictExamples
Suppose you have an
XAtomsinstance namedatomsthat hasXAtominstances of two atomtypes 1 and 2 and we want to set allXAtoms with atomtype=1 to Nitrogen and allXAtoms with atomtype=2 to Argon.We’d call this method like so:
>>> atoms.mapatomattr('element', 'atomtype', {1: 'N', 2: 'Ar'})