Hi everyone,
Attached script can be used to test a structure containing one or more rings whether any of its bonds go through any of its rings. The structure can be periodic or non-periodic. For each spearing found, a set is created containing the ring atoms and the bond atoms, which can be visualized as desired in Materials Studio.
The script works by calculating the winding number of the point where the bond vector intersects the ring plane, see http://en.wikipedia.org/wiki/Winding_number.
An example is provided containing 4 Poly (ethylene terephthalate) chains in a periodic box. The structure contains 7 spearings (per unit cell), which can be difficult to spot by eye.
NOTE: To use this script SUBSTRUCTURES MUST BE DEFINED for each ring.
To define substructures you can use the Find Patterns tool in Materials Studio:
1. Create a new document with just a ring.
2. Edit > Find Patterns. Select the new document as the Pattern document.
3. Open the document with the structure to be tested.
4. Press Find.
You should now have substructures for each ring.
The structure can now be used in this script.
Enjoy,
Reinier