Commit ffd0bc20 authored by eric pellegrini's avatar eric pellegrini
Browse files

Bug fix in AtomSelectionPlugin

Slight change in atom selection selectors name
parent 9f8c10a8
...@@ -139,12 +139,13 @@ class Query(object): ...@@ -139,12 +139,13 @@ class Query(object):
return [] return []
try: try:
selection = self._parser(self.get_expression(),True) expression = self.get_expression()
selection = self._parser.parse(expression)
except AtomSelectionParserError: except AtomSelectionParserError:
selection = ("",[]) return ("",[])
else:
return selection return (expression,selection)
def pop(self): def pop(self):
return self._list.pop() return self._list.pop()
...@@ -178,7 +179,7 @@ class AtomSelectionPlugin(ComponentPlugin): ...@@ -178,7 +179,7 @@ class AtomSelectionPlugin(ComponentPlugin):
self._mainPanel = wx.Panel(self, wx.ID_ANY, size=self.GetSize()) self._mainPanel = wx.Panel(self, wx.ID_ANY, size=self.GetSize())
self._notebook = wxaui.AuiNotebook(self._mainPanel, wx.ID_ANY, style=wxaui.AUI_NB_DEFAULT_STYLE^wxaui.AUI_NB_TAB_MOVE) self._notebook = wxaui.AuiNotebook(self._mainPanel, wx.ID_ANY, style=wxaui.AUI_NB_DEFAULT_STYLE&~wxaui.AUI_NB_CLOSE_ON_ACTIVE_TAB&~wxaui.AUI_NB_TAB_MOVE)
settingsPanel = wx.Panel(self._mainPanel,wx.ID_ANY) settingsPanel = wx.Panel(self._mainPanel,wx.ID_ANY)
...@@ -321,7 +322,7 @@ class AtomSelectionPlugin(ComponentPlugin): ...@@ -321,7 +322,7 @@ class AtomSelectionPlugin(ComponentPlugin):
self._selectionSummary.AppendText("List of selected atoms:\n") self._selectionSummary.AppendText("List of selected atoms:\n")
for idx in self._selection: for idx in self._selection:
self._selectionSummary.AppendText("\t%s\n" % self._atoms[idx].fullName()) self._selectionSummary.AppendText("\t%s (MMTK index: %d)\n" % self._atoms[idx].fullName(),self._atoms[idx].index)
def insert_keyword_values(self, keyword, values): def insert_keyword_values(self, keyword, values):
...@@ -378,7 +379,7 @@ class AtomSelectionPlugin(ComponentPlugin): ...@@ -378,7 +379,7 @@ class AtomSelectionPlugin(ComponentPlugin):
return return
if not self._selectors.has_key(selectionFilter): if not self._selectors.has_key(selectionFilter):
self._selectors[selectionFilter] = [str(v) for v in REGISTRY["selector"](selectionFilter, self._parent.trajectory.universe).choices] self._selectors[selectionFilter] = [str(v) for v in REGISTRY["selector"][selectionFilter](self._parent.trajectory.universe).choices]
self.values.Set(self._selectors[selectionFilter]) self.values.Set(self._selectors[selectionFilter])
......
...@@ -207,6 +207,7 @@ https://github.com/eurydyce/MDANSE/tree/master/MDANSE ...@@ -207,6 +207,7 @@ https://github.com/eurydyce/MDANSE/tree/master/MDANSE
for any other request, please send an email to: for any other request, please send an email to:
\tpellegrini@ill.fr \tpellegrini@ill.fr
\tgonzalezm@ill.fr
\tjohnson@ill.fr \tjohnson@ill.fr
or directly to the MDANSE mailing list: or directly to the MDANSE mailing list:
......
...@@ -41,9 +41,9 @@ class AtomSelectionParserError(Error): ...@@ -41,9 +41,9 @@ class AtomSelectionParserError(Error):
class AtomSelectionParser(object): class AtomSelectionParser(object):
def __init__(self, trajectory): def __init__(self, universe):
self._universe = trajectory.universe self._universe = universe
def operator_and(self, token): def operator_and(self, token):
......
...@@ -92,7 +92,7 @@ class AtomSelectionConfigurator(IConfigurator): ...@@ -92,7 +92,7 @@ class AtomSelectionConfigurator(IConfigurator):
ud = UD_STORE[trajConfig["basename"],"atom_selection",value] ud = UD_STORE[trajConfig["basename"],"atom_selection",value]
# The input value is an atom selection string: parse it and update the configuration # The input value is an atom selection string: parse it and update the configuration
except UserDefinitionError: except UserDefinitionError:
parser = AtomSelectionParser(trajConfig["instance"]) parser = AtomSelectionParser(trajConfig["instance"].universe)
self["indexes"] = parser.parse(value) self["indexes"] = parser.parse(value)
self["expression"] = value self["expression"] = value
else: else:
......
...@@ -89,7 +89,7 @@ class AtomTransmutationConfigurator(IConfigurator): ...@@ -89,7 +89,7 @@ class AtomTransmutationConfigurator(IConfigurator):
trajConfig = configuration[self._dependencies['trajectory']] trajConfig = configuration[self._dependencies['trajectory']]
parser = AtomSelectionParser(trajConfig["instance"]) parser = AtomSelectionParser(trajConfig["instance"].universe)
# If the input value is a dictionary, it must have a selection string as key and the element # If the input value is a dictionary, it must have a selection string as key and the element
# to be transmutated to as value # to be transmutated to as value
......
#MDANSE : Molecular Dynamics Analysis for Neutron Scattering Experiments
#------------------------------------------------------------------------------------------
#Copyright (C)
#2015- Eric C. Pellegrini Institut Laue-Langevin
#BP 156
#6, rue Jules Horowitz
#38042 Grenoble Cedex 9
#France
#pellegrini[at]ill.fr
#goret[at]ill.fr
#aoun[at]ill.fr
#
#This library is free software; you can redistribute it and/or
#modify it under the terms of the GNU Lesser General Public
#License as published by the Free Software Foundation; either
#version 2.1 of the License, or (at your option) any later version.
#
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#Lesser General Public License for more details.
#
#You should have received a copy of the GNU Lesser General Public
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
'''
Created on Jun 4, 2015
@author: Eric C. Pellegrini
'''
from MDANSE.Framework.Jobs.Converters.Discover import DiscoverConverter
class DMolConverter(DiscoverConverter):
"""
Converts a DMol trajectory to a MMTK trajectory.
"""
type = 'dmol'
label = "DMol"
\ No newline at end of file
...@@ -34,12 +34,12 @@ from MDANSE.Framework.Selectors.ISelector import ISelector ...@@ -34,12 +34,12 @@ from MDANSE.Framework.Selectors.ISelector import ISelector
class AtomFullName(ISelector): class AtomFullName(ISelector):
type = "atomfullname" type = "atom_fullname"
section = "atoms" section = "atoms"
def __init__(self, universe): def __init__(self, universe):
ISelector.__init__(self,universe) ISelector.__init__(self,universe)
self._choices.extend(sorted(set([at.fullName().strip().lower() for at in self._universe.atomList()]))) self._choices.extend(sorted(set([at.fullName().strip().lower() for at in self._universe.atomList()])))
......
...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector ...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector
class AtomIndex(ISelector): class AtomIndex(ISelector):
type = "atomindex" type = "atom_index"
section = "atoms" section = "atoms"
......
...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector ...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector
class AtomName(ISelector): class AtomName(ISelector):
type = "atomname" type = "atom_name"
section = "atoms" section = "atoms"
......
...@@ -34,6 +34,6 @@ from MDANSE.Framework.Selectors.AtomIndex import AtomIndex ...@@ -34,6 +34,6 @@ from MDANSE.Framework.Selectors.AtomIndex import AtomIndex
class AtomPicked(AtomIndex): class AtomPicked(AtomIndex):
type = "atompicked" type = "atom_picked"
section = "miscellaneous" section = "miscellaneous"
...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector ...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector
class AtomSymbol(ISelector): class AtomSymbol(ISelector):
type = "atomsymbol" type = "atom_symbol"
section = "atoms" section = "atoms"
......
...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector ...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector
class AtomType(ISelector): class AtomType(ISelector):
type = "atomtype" type = "atom_type"
section = "atoms" section = "atoms"
......
...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector ...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector
class CarboHydrogen(ISelector): class CarboHydrogen(ISelector):
type = "carbohydrogen" type = "carbo_hydrogen"
section = "hydrogens" section = "hydrogens"
......
...@@ -36,7 +36,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector ...@@ -36,7 +36,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector
class ChainName(ISelector): class ChainName(ISelector):
type = "chainname" type = "chain_name"
section = "proteins" section = "proteins"
......
...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector ...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector
class HeteroHydrogenBound(ISelector): class HeteroHydrogenBound(ISelector):
type = "heterohydrogen" type = "hetero_hydrogen"
section = "hydrogens" section = "hydrogens"
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
''' '''
Created on Mar 27, 2015 Created on Mar 27, 2015
@author: pellegrini :author: Eric C. Pellegrini
''' '''
from MDANSE.Framework.Selectors.ISelector import ISelector from MDANSE.Framework.Selectors.ISelector import ISelector
......
...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector ...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector
class NitroHydrogen(ISelector): class NitroHydrogen(ISelector):
type = "nitrohydrogen" type = "nitro_hydrogen"
section = "hydrogens" section = "hydrogens"
......
...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector ...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector
class OxyHydrogen(ISelector): class OxyHydrogen(ISelector):
type = "O-H" type = "oxy_hydrogen"
section = "hydrogens" section = "hydrogens"
......
...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector ...@@ -34,7 +34,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector
class PythonScript(ISelector): class PythonScript(ISelector):
type = "pythonscript" type = "python_script"
section = None section = None
......
...@@ -36,7 +36,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector ...@@ -36,7 +36,7 @@ from MDANSE.Framework.Selectors.ISelector import ISelector
class ResType(ISelector): class ResType(ISelector):
type = "restype" type = "residue_type"
section = "proteins" section = "proteins"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment