Create Intersection of Atom-Level Groups

PURPOSE: In DS 2.0, the Scripts | Structure Editing | Group Intersection command/script is useful for creating a new group which is the intersection of 2 residue-level groups but it will not work if either of the selected groups contain only some atoms in a residue.
The attached script does not have that limitation, it will work on groups which contain whole or partial residues.

INSTALLATION INSTRUCTIONS: Save CreateAtomGroupIntersection.pl to a local directory or location accessible from the Files Explorer

USAGE: This script is intended for use from the DS Client and will act on the most recently accessed 3D Window.
Before executing this script, select 2 defined groups from the Hierarchy view. From the Files Explorer, double-click on the CreateAtomGroupIntersection.pl to launch the script or right-click on the file and select Open With | Script Window then launch the script using the Run command from the Scripting toolbar.

REQUIREMENTS: An open 3D window in which 2 groups have been selected.

DISCLAIMER: This custom script is compatible with Discovery Studio 2.0. It is provided "as is" and is NOT supported by Accelrys nor is it warranted for any purpose whatsoever. The user assumes responsibility for any malfunctions or bugs.

EXPECTED RESULTS: When this script is executed on the sample .msv file included in the attachment, a new group called "Intersection (Backbone,MyGroup)" will be created. It will contain all atoms that the 2 selected groups have in common.

The attached .zip contains:
1. A README.txt
2. The CreateAtomGroupIntersection.pl DiscoveryScript
3. A sample input file called 1crn_2groups_select.msv which has 2 groups already selected and is ready to have CreateAtomGroupIntersection.pl executed on it.