Skip to content

Commit

Permalink
Copy provenance info when cloning a Hierarchy.
Browse files Browse the repository at this point in the history
If any part of the Hierarchy has any attached provenance
information, also clone that and attach it to the cloned
Hierarchy in the same place.
  • Loading branch information
benmwebb committed Oct 18, 2017
1 parent 64300c4 commit 992a583
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/atom/include/Hierarchy.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ IMPATOMEXPORT bool get_is_heterogen(Hierarchy h);

//! Clone the Hierarchy
/** This method copies the Bond, Bonded, Atom,
Residue, and Domain data and the particle name to the
Residue, Domain, and provenance data and the particle name to the
new copies in addition to the Hierarchy relationships.
\relates Hierarchy
Expand All @@ -460,7 +460,7 @@ IMPATOMEXPORT Hierarchy create_clone(Hierarchy d);

//! Clone the node in the Hierarchy
/** This method copies the Atom,
Residue, Chain and Domain data and the particle name.
Residue, Chain, Domain, and provenance data and the particle name.
\relates Hierarchy
*/
Expand Down
5 changes: 5 additions & 0 deletions modules/atom/src/Hierarchy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,11 @@ Hierarchy clone_internal(Hierarchy d,
if (Representation::get_is_setup(d.get_particle())) {
nd = Representation::setup_particle(p, Representation(d.get_particle()));
}
if (core::Provenanced::get_is_setup(d.get_particle())) {
core::Provenanced pd(d.get_particle());
core::Provenance prov = core::create_clone(pd.get_provenance());
core::Provenanced::setup_particle(p, prov);
}

if (nd == Hierarchy()) nd = Hierarchy::setup_particle(p);
using core::XYZ;
Expand Down

0 comments on commit 992a583

Please sign in to comment.