next up previous contents index
Next: Other selections Up: VMD Atom Selection Language Previous: Comparison selections

Comparison Operators

There are two types of comparison operators -- numeric and string -- which allow the user to specify the appropriate comparison function. Suppose the segment name, which takes on a string value, contains the names `11', and `8'. VMD cannot figure out if `8' should be less than `11' (in the numeric sense) or greater than `11' (in the lexographical sense). Instead of trying to resolve this problem through some sort of internal heuristics, VMD leaves it up to the user so that 8 < 11 but 11 lt 8. (Perl users should recognize this solution.)

The numeric comparisons are the standard ones: <, <=, = or ==, >=, >, and !=. The corresponding string comparisons are: lt, le, eq, ge, gt, and ne. As in perl there is a ``match'' operator, =~, so that

        'CA' =~ "C.*"
        segname =~ "VP[1-4]" (matches VP1, VP2, VP3, and VP4, present in some
                              virus structures)

are valid. No distinction is made between single and double quotes.

Justin Gullingsrud
Tue Apr 6 09:22:39 CDT 1999