pyiron / pyiron_atomistics

pyiron_atomistics - an integrated development environment (IDE) for atomistic simulation in computational materials science.
https://pyiron-atomistics.readthedocs.io
BSD 3-Clause "New" or "Revised" License
43 stars 15 forks source link

Structures species does not update when changing elements #718

Open Leimeroth opened 2 years ago

Leimeroth commented 2 years ago

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.

niklassiemer commented 2 years ago

related https://github.com/pyiron/pyiron_atomistics/pull/700