From: Bart Bruininks (bartbruininks_at_gmail.com)
Date: Tue Aug 08 2023 - 09:12:23 CDT

Dear VMDers,

I want to add a custom selection word which I can use in the
graphics/representation/selection input. I have a DirectedAcyclicGraph
(DAG) structure which I want to use in the selection syntax.

{[-2, 1, 2, [3, -1] 4]}

The above represents a DAG which can be shown as a dict where the key is
the node and the value are all the nodes that are at equal or deeper depth.
-2 : [-2, -1, 1, 2, 3, 4]
-1 : [-1]
 1 : [1]
 2 : [2]
 3 : [3, -1]
 4 : 4

How would I go about making it so that for example 'container' is my
keyword in the selection and I can then add a value to point at the key of
interest in the DAG, for example:

container '-2' -> The selection of all atoms which have '-2, -1, 1, 2, 3,
4' in their beta value (or if there is a better way)

For now I have the following TCL which I generate with a python script
using the DAG:
dict set containment '-2' {'-2' '1' '2' '4' '3' '-1' }
dict set containment '-1' {'-1' }
dict set containment '1' {'1' }
dict set containment '2' {'2' }
dict set containment '3' {'3' '-1' }
dict set containment '4' {'4' }

proc get_container {container {mol 0} {rep 0} } {
    global containment
    mol modselect $mol $rep beta [dict get $containment $container]
}

However, the problem here is that I cannot use it in the
graphics/representations syntax. I would like to be able to state things
like: 'container -2 and not container 3', which should return all atoms
with beta '-2, 1, 2, 4'.

I tried to refer to all the indices which satisfy the conditions, however,
for large files I run into a buffer overflow. I wonder how keywords like
protein circumvent this problem.

Cheers and thanks in advance,

Bart Bruininks

PS
If you want to know why I am trying to do this take a look at my github for
mdvcontainment <https://urldefense.com/v3/__https://github.com/BartBruininks/mdvcontainment__;!!DZ3fjg!_WEk7LiGfI4lR3C1rrQZllTcWx6notOq1kvUn6PIf1wGvJBT4vnHw65vjRW6bm4l6Vb0TxfC4rAjofqgARj0XscJ$ >.