index | modules | gitlab | page source

# Chemical symbols

class ase.symbols.Symbols(numbers)

  A sequence of chemical symbols.

  `atoms.symbols` is a `ase.symbols.Symbols` object. This object works like an editable view of `atoms.numbers`, except its elements are manipulated as strings.

  Examples:

      >>> from ase.build import molecule
      >>> atoms = molecule('CH3CH2OH')
      >>> atoms.symbols
      Symbols('C2OH6')
      >>> atoms.symbols[:3]
      Symbols('C2O')
      >>> atoms.symbols == 'H'
      array([False, False, False,  True,  True,  True,  True,  True,  True], dtype=bool)
      >>> atoms.symbols[-3:] = 'Pu'
      >>> atoms.symbols
      Symbols('C2OH3Pu3')
      >>> atoms.symbols[3:6] = 'Mo2U'
      >>> atoms.symbols
      Symbols('C2OMo2UPu3')
      >>> atoms.symbols.formula
      Formula('C2OMo2UPu3')

  The `ase.formula.Formula` object is useful for extended formatting options and analysis.