Skip to content
Snippets Groups Projects
Commit 4fe31b58 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

bugfix: setting an element wiped previsouly set attributes

SetElement sets default properties for mass and radius. Previously
set charge and anisou got wiped in the process. Charge and anisou
are now transferred and only mass and radius are reset.
parent ffd0fbbd
No related branches found
No related tags found
No related merge requests found
......@@ -116,7 +116,13 @@ public:
{
if (element_!=ele) {
element_=ele;
AtomProp* old_prop = prop_;
prop_=impl::AtomProp::GetDefaultProps(element_);
if (old_prop && !old_prop->is_default) {
if(old_prop->has_anisou) this->SetAnisou(old_prop->anisou);
if(old_prop->charge != 0.0) this->SetCharge(old_prop->charge);
delete old_prop;
}
}
}
bool HasDefaultProps() const { return prop_->is_default; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment