Allow 'atomname' and 'atomtype' in selections.
authorTeemu Murtola <teemu.murtola@gmail.com>
Tue, 4 Sep 2012 03:48:25 +0000 (06:48 +0300)
committerTeemu Murtola <teemu.murtola@gmail.com>
Tue, 4 Sep 2012 03:48:25 +0000 (06:48 +0300)
'atomname' is now synonymous to 'name', and similarly for 'atomtype' and
'type'.  This reduces confusion, as the code uses atomname and atomtype
internally.  Also use the aliases in tests.

Change-Id: Ifa96840c1fc9c519be53b1bb5aae4f4910cdb0ff

src/gromacs/selection/selmethod.cpp
src/gromacs/selection/sm_simple.cpp
src/gromacs/selection/tests/refdata/SelectionCollectionDataTest_HandlesAtomname.xml
src/gromacs/selection/tests/refdata/SelectionCollectionDataTest_HandlesResIndex.xml
src/gromacs/selection/tests/refdata/SelectionCollectionDataTest_HandlesResnr.xml
src/gromacs/selection/tests/selectioncollection.cpp

index 517baa550e512aa79cd422bf98bf20b92b00a85e..8f351e1df523481321a4b8be4a25cca639b73049 100644 (file)
@@ -138,7 +138,9 @@ static const t_register_method smtable_def[] = {
     {"mol",        &sm_molindex},
     {"molecule",   &sm_molindex},
     {NULL,         &sm_atomname},
+    {"name",       &sm_atomname},
     {NULL,         &sm_atomtype},
+    {"type",       &sm_atomtype},
     {NULL,         &sm_resname},
     {NULL,         &sm_insertcode},
     {NULL,         &sm_chain},
index a7ff1d43500f95c29ffc53ac55cdc958953838d7..1c52cb030eee09975cb1bebb26685bbb872c18f1 100644 (file)
@@ -70,14 +70,14 @@ check_molecules(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data
 static void
 evaluate_molindex(t_topology *top, t_trxframe *fr, t_pbc *pbc,
                   gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data);
-/** Evaluates the \p name selection keyword. */
+/** Evaluates the \p atomname selection keyword. */
 static void
 evaluate_atomname(t_topology *top, t_trxframe *fr, t_pbc *pbc,
                   gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data);
 /** Checks whether atom types are present in the topology. */
 static void
 check_atomtype(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data);
-/** Evaluates the \p type selection keyword. */
+/** Evaluates the \p atomtype selection keyword. */
 static void
 evaluate_atomtype(t_topology *top, t_trxframe *fr, t_pbc *pbc,
                   gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data);
@@ -214,9 +214,9 @@ gmx_ana_selmethod_t sm_molindex = {
     NULL,
 };
 
-/** \internal Selection method data for \p name selection keyword. */
+/** \internal Selection method data for \p atomname selection keyword. */
 gmx_ana_selmethod_t sm_atomname = {
-    "name", STR_VALUE, SMETH_REQTOP,
+    "atomname", STR_VALUE, SMETH_REQTOP,
     0, NULL,
     NULL,
     NULL,
@@ -228,9 +228,9 @@ gmx_ana_selmethod_t sm_atomname = {
     NULL,
 };
 
-/** \internal Selection method data for \p type selection keyword. */
+/** \internal Selection method data for \p atomtype selection keyword. */
 gmx_ana_selmethod_t sm_atomtype = {
-    "type", STR_VALUE, SMETH_REQTOP,
+    "atomtype", STR_VALUE, SMETH_REQTOP,
     0, NULL,
     NULL,
     NULL,
index c66b2312f725d12442f8cf05444ec96b5a3e2bc9..85a8d625c0d60e0c26814f27909a76b146f134a7 100644 (file)
@@ -9,9 +9,9 @@
       <Bool Name="Dynamic">false</Bool>
     </ParsedSelection>
     <ParsedSelection Name="Selection2">
-      <String Name="Input">name S1 S2</String>
-      <String Name="Name">name S1 S2</String>
-      <String Name="Text">name S1 S2</String>
+      <String Name="Input">atomname S1 S2</String>
+      <String Name="Name">atomname S1 S2</String>
+      <String Name="Text">atomname S1 S2</String>
       <Bool Name="Dynamic">false</Bool>
     </ParsedSelection>
   </ParsedSelections>
index f602e13ff9088e950614d5bf336dab02c9a5e9e4..5351607e59174b243f8bbb5ab2c333574af81db4 100644 (file)
@@ -8,6 +8,12 @@
       <String Name="Text">resindex 1 4</String>
       <Bool Name="Dynamic">false</Bool>
     </ParsedSelection>
+    <ParsedSelection Name="Selection2">
+      <String Name="Input">residue 1 3</String>
+      <String Name="Name">residue 1 3</String>
+      <String Name="Text">residue 1 3</String>
+      <Bool Name="Dynamic">false</Bool>
+    </ParsedSelection>
   </ParsedSelections>
   <CompiledSelections Name="Compiled">
     <Selection Name="Selection1">
         <Int>11</Int>
       </Sequence>
     </Selection>
+    <Selection Name="Selection2">
+      <Sequence Name="Atoms">
+        <Int Name="Length">6</Int>
+        <Int>0</Int>
+        <Int>1</Int>
+        <Int>2</Int>
+        <Int>6</Int>
+        <Int>7</Int>
+        <Int>8</Int>
+      </Sequence>
+    </Selection>
   </CompiledSelections>
 </ReferenceData>
index 23ef8aea3cd5406df457799d892e012c7445a8ab..d44e6b351275787543846da87548229e87250f0c 100644 (file)
@@ -9,9 +9,9 @@
       <Bool Name="Dynamic">false</Bool>
     </ParsedSelection>
     <ParsedSelection Name="Selection2">
-      <String Name="Input">resnr 4 to 3</String>
-      <String Name="Name">resnr 4 to 3</String>
-      <String Name="Text">resnr 4 to 3</String>
+      <String Name="Input">resid 4 to 3</String>
+      <String Name="Name">resid 4 to 3</String>
+      <String Name="Text">resid 4 to 3</String>
       <Bool Name="Dynamic">false</Bool>
     </ParsedSelection>
   </ParsedSelections>
index 804dd51b8e5869082a8b8f1bd3eb61269095b651..6452971dae6d4672f718ba6b218138eabfcb9b7d 100644 (file)
@@ -495,7 +495,7 @@ TEST_F(SelectionCollectionDataTest, HandlesResnr)
 {
     static const char * const selections[] = {
         "resnr 1 2 5",
-        "resnr 4 to 3",
+        "resid 4 to 3",
         NULL
     };
     runTest("simple.gro", selections);
@@ -505,6 +505,7 @@ TEST_F(SelectionCollectionDataTest, HandlesResIndex)
 {
     static const char * const selections[] = {
         "resindex 1 4",
+        "residue 1 3",
         NULL
     };
     runTest("simple.pdb", selections);
@@ -516,7 +517,7 @@ TEST_F(SelectionCollectionDataTest, HandlesAtomname)
 {
     static const char * const selections[] = {
         "name CB",
-        "name S1 S2",
+        "atomname S1 S2",
         NULL
     };
     runTest("simple.gro", selections);