Permalink
Browse files

copy_particles now returns the mapping

  • Loading branch information...
1 parent c21c50d commit 77c7cdceb288a8e4717ad9ab4d608a6fc4ac93d2 @arnolda arnolda committed Feb 18, 2014
Showing with 10 additions and 2 deletions.
  1. +9 −2 doc/ug/part.tex
  2. +1 −0 scripts/auxiliary.tcl
View
@@ -624,8 +624,15 @@ \subsection{\texttt{copy\_particles}: copying a set of particles}
otherwise the copied set is at exactly the same position as the
original set. The particles can be given as a combination of
\opt{list}s or \opt{range}s. The new particles obtain in any case
-consecutive identities after the largest current identity. Bonds
-within the defined particle set are copied with translated identities,
+consecutive identities after the largest current identity. The mapping
+of the particles is returned as a list of old-new pairs, which can be
+conveniently read into an array:
+\begin{tclcode}
+array set newidentities [copy_particles ...]
+puts "particle 42 is now at position $newidentities(42)"
+\end{tclcode}
+
+Bonds within the defined particle set are copied with translated identities,
but not bonds with particles outside the list. That is, if the
particle set corresponds to a molecule, intramolecular bonds are
preserved, but not intermolecular ones.
View
@@ -632,4 +632,5 @@ proc copy_particles { args } {
eval part $newid exclude $exclusions
}
}
+ return [array get newids]
}

0 comments on commit 77c7cdc

Please sign in to comment.