I am trying to create a CV that would characterize whether a group of atoms in a 3D simulation locally form a planar (2D) structure. In other words, how do we describe groups of atoms close to each other being planar or not? I see three-ish possible ways of doing it, but cannot seem to make any of them complete:
1. looking at torsion angles between all sets of four atoms in the group: they should be near-zero or near-pi, weighted by three pairwise distances between the four atoms in each TORSION as switches. This would be trivial if the TORSIONS action worked as ANGLES with a GROUP, but it does not, and it looks like ANGLES is set for deprecation anyway. It would be great to not have to manually specify all sets of four atoms: while it is possible to write a script to generate them by brute force, and then apply 3x distance switching functions, that seems too cumbersome and not vectorized to be the way to go about it; even a set of 10 atoms would have >2K torsions.
2. taking two top eigenvalues of a PCA of the positions; this is a bit confusing since the examples I have seen use PCA on displacements rather than on positions themselves
3. something with contact matrices, putting together 2x BOND_DIRECTIONS, which leaves only the third distance challenging to add because of indexing. In other words, if there are atoms 1,2,3,4 in a group, BOND_DIRECTIONS can give 2-1 weighted by relevant distance, 3-4 also weighted, but where the index of the 2-3 distance would be is unclear.
I would be grateful for any pointers or thoughts from folks here :)