From 992a5830734f5dd567787df2bda67a9e2ddbb401 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Wed, 18 Oct 2017 11:05:24 -0700 Subject: [PATCH] Copy provenance info when cloning a Hierarchy. 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. --- modules/atom/include/Hierarchy.h | 4 ++-- modules/atom/src/Hierarchy.cpp | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/atom/include/Hierarchy.h b/modules/atom/include/Hierarchy.h index 89a503ee32..2b7cf34841 100644 --- a/modules/atom/include/Hierarchy.h +++ b/modules/atom/include/Hierarchy.h @@ -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 @@ -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 */ diff --git a/modules/atom/src/Hierarchy.cpp b/modules/atom/src/Hierarchy.cpp index 460179d8e2..41b8cecd0c 100644 --- a/modules/atom/src/Hierarchy.cpp +++ b/modules/atom/src/Hierarchy.cpp @@ -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;