Closed bienchen closed 1 year ago
I've just added elements to the ihm.ChemComp._element_mass
dictionary when I've needed them (e.g. it contains Fe which isn't in any peptide or nucleic acid). If you need others, just open a PR to add the masses you need (or the whole table if you like). I don't think a function to add new elements at runtime is necessary though - new elements (particularly those found in biological ligands) aren't discovered all that often!
Resolved by #100.
ihm.ChemComp._element_mass
only contains atoms known to the peptide/ nucleic acidChemComp
classes. So_entity.formula_weight
can not be calculated properly for a lot of non-poly entities. I can add elements toihm.ChemComp._element_mass
myself, but then Pylint (rightfully) complains about accessing a protected member of a class. While there are hacky workarounds for the message, it would be nice to have a proper way to handle elements.A simple solution would be to add the whole periodic table to
ihm.ChemComp
. Otherwise it would be good to have a function to check if an element is known toihm.ChemComp
and a function to add new elements to prevent accessing_element_mass
directly.