From 5fd560b30ae5b2f51ef1fdaab8b1e2abddd5f43a Mon Sep 17 00:00:00 2001
From: yakomaxa <47655565+yakomaxa@users.noreply.github.com>
Date: Mon, 15 Aug 2022 15:38:38 +0900
Subject: [PATCH] Added experimental within to rasmol

---
 src/mol-script/transpilers/rasmol/operators.ts | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/mol-script/transpilers/rasmol/operators.ts b/src/mol-script/transpilers/rasmol/operators.ts
index 0074a7625..8c228ccfb 100644
--- a/src/mol-script/transpilers/rasmol/operators.ts
+++ b/src/mol-script/transpilers/rasmol/operators.ts
@@ -41,5 +41,15 @@ export const operators: OperatorList = [
         rule: h.infixOp(/OR|\||\|\|/i),
         map: (op, s1, s2) => B.struct.combinator.merge([s1, s2])
     }
+    {
+        '@desc': 'Selects atoms within a specified distance of a selection',
+        '@examples': ['within 5 of name FE'],
+        name: 'within',
+        type: h.prefix,
+        rule: h.prefixOp(/WITHIN\s+([-+]?[0-9]*\.?[0-9]+)\s+OF/i, 1).map((x: any) => parseFloat(x)),
+        map: (radius: number, selection: Expression) => {
+            return B.struct.modifier.includeSurroundings({ 0: selection, radius });
+        }
+    },
 ];
 
-- 
GitLab