pyiron_atomistics
pyiron_atomistics copied to clipboard
Structures species does not update when changing elements
When f.e. removing an element from a structure completely using f.e. s[s.numbers==12] = "Cu" the structures .species attribute is not updated. This leads to problems with using interatomic potentials. Exemplary Backtrace:
File ~/git_projects/pyiron_atomistics/pyiron_atomistics/lammps/base.py:207, in LammpsBase.potential(self, potential_filename) 205 potential_elements = list(potential["Species"])[0] 206 if not set(structure_elements).issubset(potential_elements): --> 207 raise ValueError( 208 "Potential {} does not support elements " 209 "in structure {}.".format(potential_elements, structure_elements) 210 ) 211 self.input.potential.df = potential 212 if "Citations" in potential.columns.values:
ValueError: Potential ['Si', 'O'] does not support elements in structure ['C' 'O' 'Si'].
after removing the "C" from the structure
This generally looks very dangerous imo, because I could imagine several situations where this not correctly being updated leads to a wrong assignment of POSCAR files or atom types in potentials.
related https://github.com/pyiron/pyiron_atomistics/pull/700