Commit 56ee68be authored by eric pellegrini's avatar eric pellegrini

Replaced nmoldyn by MDANSE in several files

Refactored the mdanse_gui script
parent 114407d1
import wx
from MDANSE.App.GUI.MainFrame import MainFrame
from MDANSE.App.GUI.Framework.Plugins.Plotter.PlotterPlugin import PlotterFrame
from MDANSE.App.GUI.Framework.Plugins.PeriodicTablePlugin import PeriodicTableFrame
from MDANSE.App.GUI.Framework.Plugins.UserDefinitionViewerPlugin import UserDefinitionViewerFrame
class MainApplication(wx.App):
def OnInit(self):
f = MainFrame(None)
f.Show()
self.SetTopWindow(f)
return True
class PeriodicTableApplication(wx.App):
def OnInit(self):
f = PeriodicTableFrame(None)
f.Show()
self.SetTopWindow(f)
return True
class PlotterApplication(wx.App):
def OnInit(self):
f = PlotterFrame(None)
f.Show()
self.SetTopWindow(f)
return True
class UserDefinitionViewerApplication(wx.App):
def OnInit(self):
f = UserDefinitionViewerFrame(None)
f.Show()
self.SetTopWindow(f)
return True
\ No newline at end of file
......@@ -238,7 +238,7 @@ or directly to the MDANSE mailing list:
def on_help(self, event):
webbrowser.open('http://www.ill.eu/fileadmin/users_files/img/instruments_and_support/support_facilities/computing_for_science/Computing_for_Science/CS_Software/nMoldyn/documentation/index.html')
webbrowser.open('https://github.com/eurydyce/MDANSE/tree/master/MDANSE')
def on_load_data(self, event=None):
......@@ -289,9 +289,10 @@ or directly to the MDANSE mailing list:
def on_open_mdanse_url(self, event):
webbrowser.open('http://www.ill.eu/fr/instruments-support/computing-for-science/cs-software/all-software/nmoldyn/')
webbrowser.open('https://github.com/eurydyce/MDANSE/tree/master/MDANSE')
def on_quit(self, event=None):
d = wx.MessageDialog(None, 'Do you really want to quit ?', 'Question', wx.YES_NO|wx.YES_DEFAULT|wx.ICON_QUESTION)
if d.ShowModal() == wx.ID_YES:
self.Destroy()
......@@ -308,7 +309,7 @@ or directly to the MDANSE mailing list:
def on_start_plotter(self, event = None):
from nMOLDYN.Framework.Plugins.PlotterPlugin import PlotterFrame
from MDANSE.App.GUI.Framework.Plugins.Plotter.PlotterPlugin import PlotterFrame
f = PlotterFrame(None)
......
......@@ -316,10 +316,10 @@ class Preferences(object):
raise PreferencesError("Invalid type for preferences filename: %s" % path)
if not os.path.exists(path):
raise PreferencesError("The preferences files %s does not exists. nMolDyn will use the default preferences." % path)
raise PreferencesError("The preferences files %s does not exists. MDANSE will use the default preferences." % path)
try:
# Read the preferences and overwrites the nmoldyn default preferences.
# Read the preferences and overwrites the MDANSE default preferences.
self._parser.read(path)
except ConfigParser.ParsingError as e:
raise PreferencesError(e)
......
......@@ -266,9 +266,9 @@ class LAMMPSConverter(Converter):
if self._lammpsConfig["n_bonds"] is not None:
netcdf = self._trajectory.trajectory.file
netcdf.createDimension("NMOLDYN_NBONDS",self._lammpsConfig["n_bonds"])
netcdf.createDimension("NMOLDYN_TWO",2)
VAR = netcdf.createVariable("nmoldyn_bonds", numpy.dtype(numpy.int32).char, ("NMOLDYN_NBONDS","NMOLDYN_TWO"))
netcdf.createDimension("MDANSE_NBONDS",self._lammpsConfig["n_bonds"])
netcdf.createDimension("MDANSE_TWO",2)
VAR = netcdf.createVariable("mdanse_bonds", numpy.dtype(numpy.int32).char, ("MDANSE_NBONDS","MDANSE_TWO"))
VAR.assignValue(self._lammpsConfig["bonds"])
# Close the output trajectory.
......
......@@ -41,7 +41,7 @@ class CoordinationNumber(DistanceHistogram):
"""
The Coordination Number computes the pair distribution function for a set of atoms,
it could be defined has the total number of neighbours of a central atom in a molecule or ion.
In nMoldyn the definition of the Coordination Number can be seen as an extension of this previous definition,
In MDANSE the definition of the Coordination Number can be seen as an extension of this previous definition,
indeed, we are not only defining central atom but also centers of gravity of a set of group of atoms as center.
"""
......
......@@ -43,7 +43,7 @@ class GlobalMotionFilteredTrajectory(IJob):
It is often of interest to separate global motion from internal motion, both for quantitative
analysis and for visualization by animated display. Obviously, this can be done under the
hypothesis that global and internal motions are decoupled within the length and timescales of
the analysis. nMoldyn can create Global Motion Filtered Trajectory (GMFT) by filtering
the analysis. MDANSE can create Global Motion Filtered Trajectory (GMFT) by filtering
out global motions (made of the three translational and rotational degrees of freedom), either
on the whole system or on an user-defined subset, by fitting it to a reference structure (usually
the first frame of the MD). Global motion filtering uses a straightforward algorithm:
......
......@@ -93,10 +93,10 @@ class McStasVirtualInstrument(IJob):
settings['trajectory'] = ('mmtk_trajectory', {})
settings['frames'] = ('frames', {"dependencies":{'trajectory':'trajectory'}})
settings['sample_coh'] = ('netcdf_input_file', {"widget":'input_file',
"label":'nMoldyn Coherent Structure Factor',
"label":'MDANSE Coherent Structure Factor',
"variables":['q','frequency','s(q,f)_total']})
settings['sample_inc'] = ('netcdf_input_file', {"widget":'input_file',
"label":'nMoldyn Incoherent Structure Factor',
"label":'MDANSE Incoherent Structure Factor',
"variables" :['q','frequency','s(q,f)_total']})
settings['temperature'] = ('float', {"default":298.0})
settings['instrument'] = ('mcstas_instrument',{"label":'mcstas instrument'})
......@@ -202,7 +202,7 @@ class McStasVirtualInstrument(IJob):
if "ERROR" in line:
raise McStasError("An error occured during McStas run: %s" % line)
with open(os.path.join(self.configuration["options"]["mcstas_output_directory"],"mcstas_nmoldyn.mvi"),"w") as f:
with open(os.path.join(self.configuration["options"]["mcstas_output_directory"],"mcstas_mdanse.mvi"),"w") as f:
f.write(out)
return index, None
......
......@@ -43,7 +43,7 @@ class RadiusOfGyration(IJob):
Radius Of Gyration (ROG) is the name of several related measures of the size of an object,
a surface, or an ensemble of points. It is calculated as the Root Mean Square Distance between
the system and a reference that can be either the center of gravity of the system either a given
axis. In nMOLDYN, the reference is choosen to be the center of gravity of the system under
axis. In MDANSE, the reference is choosen to be the center of gravity of the system under
study.
"""
......
......@@ -79,7 +79,7 @@ def databasePath(filename, directory, try_direct = False):
if entries is None:
if directory == "Atoms":
LOGGER("Atom %r not found in the MMTK database. nMolDyn will create a default one." % basename,"warning")
LOGGER("Atom %r not found in the MMTK database. MDANSE will create a default one." % basename,"warning")
ELEMENTS.add_element(basename,save=True)
return os.path.join(PLATFORM.local_mmtk_database_directory(),"Atoms", basename)
else:
......@@ -87,7 +87,7 @@ def databasePath(filename, directory, try_direct = False):
else:
return entries
# Add the path to the nmoldyn database to complete the MMTK database.
# Add the path to the MDANSE database to complete the MMTK database.
Database.databasePath = databasePath
Database.path.insert(0,os.path.join(PLATFORM.package_directory(), 'Data'))
Database.path.insert(0,PLATFORM.local_mmtk_database_directory())
......@@ -250,7 +250,7 @@ class CommandLineParser(optparse.OptionParser):
# Case where an error occured when writing the template.
except IOError:
raise CommandLineParserError("Could not write the job template as %r" % filename)
# If the job class has no save method, thisis not a valid nMolDyn job.
# If the job class has no save method, thisis not a valid MDANSE job.
except KeyError:
raise CommandLineParserError("The job %r is not a valid MDANSE job" % name)
# Otherwise, print some information about the saved template.
......@@ -268,7 +268,7 @@ if __name__ == "__main__":
group = optparse.OptionGroup(parser, "General options")
group.add_option('--add-mmtk-def', action='callback', callback=parser.add_mmtk_definition, help='Add a definition to the MMTK database.')
group.add_option('-d', '--database', action='callback', callback=parser.display_element_info, help='Display chemical informations about a given element.')
group.add_option('-r', '--registry', action='callback', callback=parser.query_classes_registry, help='Display the contents of nmoldyn classes registry.')
group.add_option('-r', '--registry', action='callback', callback=parser.query_classes_registry, help='Display the contents of MDANSE classes registry.')
group.add_option('-t', '--traj', action='callback', callback=parser.display_trajectory_contents, help='Display the chemical contents of a trajectory.')
# Add the goup to the parser.
......@@ -283,7 +283,7 @@ if __name__ == "__main__":
group.add_option('--jcheck', action='callback', callback=parser.check_job, help='Check the status of a given job.')
group.add_option('--jlist', action='callback', callback=parser.display_jobs_list, help='Display the jobs list.')
group.add_option('--jrun' , action='callback', callback=parser.run_job, help='Run MDANSE job(s).')
group.add_option('--jsave', action='callback', callback=parser.save_job_template, help='Save a template for a job.', metavar = "nMOLDYNSCRIPT")
group.add_option('--jsave', action='callback', callback=parser.save_job_template, help='Save a template for a job.', metavar = "MDANSE_SCRIPT")
# The command line is parsed.
options, _ = parser.parse_args()
#!/usr/bin/env python
import optparse
import sys
from nMOLDYN.Core.Error import Error
from nMOLDYN.Utilities.CommandLine import IndentedHelpFormatterWithNL
from nMOLDYN.GUI.Application import MainApplication, PeriodicTableApplication, PlotterApplication
from MDANSE.Core.Error import Error
from MDANSE.App.HelpFormatter import IndentedHelp
from MDANSE.App.GUI.Main import MainApplication, PeriodicTableApplication, PlotterApplication
class CommandLineParserError(Error):
pass
......@@ -16,7 +15,7 @@ class CommandLineParser(optparse.OptionParser):
'''
def start(self):
'''Starts the nmoldyn plotter directly from the command line.
'''Starts the MDANSE plotter directly from the command line.
@param option: the option that triggered the callback.
@type option: str
......@@ -27,8 +26,8 @@ class CommandLineParser(optparse.OptionParser):
@param value: the argument for the option.
@type value: str
@param parser: the nMOLDYN option parser.
@type parser: instance of nMOLDYNOptionParser
@param parser: the MDANSE option parser.
@type parser: instance of MDANSEOptionParser
'''
app = MainApplication(None)
......@@ -38,7 +37,7 @@ class CommandLineParser(optparse.OptionParser):
def start_periodictable(self):
'''Starts the nmoldyn database directly from the command line.
'''Starts the MDANSE database directly from the command line.
@param option: the option that triggered the callback.
@type option: str
......@@ -49,8 +48,8 @@ class CommandLineParser(optparse.OptionParser):
@param value: the argument for the option.
@type value: str
@param parser: the nMOLDYN option parser.
@type parser: instance of nMOLDYNOptionParser
@param parser: the MDANSE option parser.
@type parser: instance of MDANSEOptionParser
'''
app = PeriodicTableApplication()
......@@ -60,7 +59,7 @@ class CommandLineParser(optparse.OptionParser):
def start_plotter(self):
'''Starts the nmoldyn plotter directly from the command line.
'''Starts the MDANSE plotter directly from the command line.
@param option: the option that triggered the callback.
@type option: str
......@@ -71,8 +70,8 @@ class CommandLineParser(optparse.OptionParser):
@param value: the argument for the option.
@type value: str
@param parser: the nMOLDYN option parser.
@type parser: instance of nMOLDYNOptionParser
@param parser: the MDANSE option parser.
@type parser: instance of MDANSEOptionParser
'''
app = PlotterApplication()
......@@ -82,16 +81,16 @@ class CommandLineParser(optparse.OptionParser):
if __name__ == "__main__":
from nMOLDYN.__pkginfo__ import __version__, __versiondate__
from MDANSE.__pkginfo__ import __version__, __date__
# Creates the option parser.
parser = CommandLineParser(formatter=IndentedHelpFormatterWithNL(), version = 'nMolDyn %s (%s)' % (__version__, __versiondate__))
parser = CommandLineParser(formatter=IndentedHelp(), version = 'MDANSE %s (%s)' % (__version__, __date__))
# Creates a first the group of general options.
group = optparse.OptionGroup(parser, "General options")
group.add_option("-d", "--database", action="store_true", dest="database", help='Start nMolDyn database application')
group.add_option("-m", "--main", action="store_true", dest="main", help='Start nMolDyn main application')
group.add_option("-p", "--plot", action="store_true", dest="plot", help='Start the nMolDyn plotting application')
group.add_option("-d", "--database", action="store_true", dest="database", help='Start MDANSE database application')
group.add_option("-m", "--main", action="store_true", dest="main", help='Start MDANSE main application')
group.add_option("-p", "--plot", action="store_true", dest="plot", help='Start the MDANSE plotting application')
# Add the goup to the parser.
parser.add_option_group(group)
......
......@@ -131,19 +131,17 @@ def find_data(where=".", exclude=EXCLUDE, exclude_directories=EXCLUDE_DIRECTORIE
#################################
PACKAGE_INFO = {}
execfile('nMOLDYN/__pkginfo__.py', PACKAGE_INFO)
execfile('MDANSE/__pkginfo__.py', PACKAGE_INFO)
PACKAGES = find_packages(path=".", exclude=os.path.join("nMOLDYN","GUI"))
PACKAGES = find_packages(path=".", exclude=os.path.join("MDANSE","App","GUI"))
PACKAGES = PACKAGES.keys()
#################################
# Package data section
#################################
# Retrieve all the data related to the nMoldyn package.
PACKAGE_DATA = find_package_data(where='nMOLDYN',
package='nMOLDYN',
show_ignored=False)
# Retrieve all the data related to the MDANSE package.
PACKAGE_DATA = find_package_data(where='MDANSE', package='MDANSE', show_ignored=False)
#################################
# User data section
......@@ -156,7 +154,7 @@ DATA_FILES = []
#################################
SCRIPTS = []
SCRIPTS.append(os.path.join(SCRIPTS_PATH,'nmoldyn_console'))
SCRIPTS.append(os.path.join(SCRIPTS_PATH,'mdanse'))
#################################
# Extensions section
......@@ -166,26 +164,26 @@ if 'linux' in sys.platform:
(opt,) = get_config_vars('OPT')
os.environ['OPT'] = " ".join(flag for flag in opt.split() if flag != '-Wstrict-prototypes')
EXTENSIONS = [Extension('nMOLDYN.Extensions.distance_histogram',
EXTENSIONS = [Extension('MDANSE.Extensions.distance_histogram',
include_dirs=INCLUDE_DIR,
sources = [os.path.join("Extensions",'distance_histogram.pyx')]),
Extension('nMOLDYN.Extensions.fast_calculation',
Extension('MDANSE.Extensions.fast_calculation',
include_dirs=INCLUDE_DIR,
sources = [os.path.join("Extensions",'fast_calculation.pyx')]),
Extension('nMOLDYN.Extensions.sas_fast_calc',
Extension('MDANSE.Extensions.sas_fast_calc',
include_dirs=INCLUDE_DIR,
sources = [os.path.join("Extensions",'sas_fast_calc.pyx')]),
Extension('nMOLDYN.Extensions.mt_fast_calc',
Extension('MDANSE.Extensions.mt_fast_calc',
include_dirs=INCLUDE_DIR,
sources = [os.path.join("Extensions",'mt_fast_calc.pyx')]),
Extension('nMOLDYN.Extensions.sd_fast_calc',
Extension('MDANSE.Extensions.sd_fast_calc',
include_dirs=INCLUDE_DIR,
sources = [os.path.join("Extensions",'sd_fast_calc.pyx')]),
Extension('nMOLDYN.Extensions.mic_fast_calc',
Extension('MDANSE.Extensions.mic_fast_calc',
include_dirs=INCLUDE_DIR,
sources = [os.path.join("Extensions",'mic_fast_calc.pyx')],
language="c++"),
Extension('nMOLDYN.Extensions.qhull',
Extension('MDANSE.Extensions.qhull',
include_dirs = QHULL_INCLUDE_DIR,
sources = glob.glob(os.path.join(QHULL_DIR, 'src','*.c')) + [os.path.join("Extensions",'qhull.pyx')],
define_macros = [('qh_QHpointer','1')])
......@@ -198,7 +196,7 @@ class ModifiedBuildScripts(build_scripts):
build_scripts.finalize_options(self)
if self.distribution.command_obj['build'].gui:
self.scripts.append(os.path.join(SCRIPTS_PATH,'nmoldyn_gui'))
self.scripts.append(os.path.join(SCRIPTS_PATH,'mdanse_gui'))
class ModifiedBuildPy(build_py):
......@@ -208,16 +206,16 @@ class ModifiedBuildPy(build_py):
build_py.finalize_options(self)
if self.distribution.command_obj['build'].gui:
self.packages.append('nMOLDYN.GUI')
self.packages.extend(find_packages(path=os.path.join("nMOLDYN","GUI"), base="nMOLDYN.GUI").keys())
self.packages.append('MDANSE.App.GUI')
self.packages.extend(find_packages(path=os.path.join("MDANSE","App","GUI"), base="MDANSE.App.GUI").keys())
self.data_files = self.get_data_files()
class ModifiedBuild(build):
user_options = build.user_options + [('gui',None,'Build nMOLDYN with GUI [default]'),
('no-gui', None, "Build nMOLDYN without GUI")]
user_options = build.user_options + [('gui',None,'Build MDANSE with GUI [default]'),
('no-gui', None, "Build MDANSE without GUI")]
boolean_options = build.boolean_options + ['gui']
......@@ -232,11 +230,11 @@ class ModifiedBuild(build):
# The setup section
#################################
setup (name = "nMOLDYN",
setup (name = "MDANSE",
version = PACKAGE_INFO["__version__"],
description = "Analysis of Molecular Dynamics trajectories",
long_description =
"""nMOLDYN is an interactive program for the analysis of Molecular
"""MDANSE is an interactive program for the analysis of Molecular
Dynamics simulations. It is especially designed for the computation
and decomposition of neutron scattering spectra. The structure and
dynamics of the simulated systems can be characterized in terms of
......@@ -244,11 +242,11 @@ various space and time correlation functions. To analyze the dynamics
of complex systems, rigid-body motions of arbitrarily chosen molecular
subunits can be studied.
""",
author = "B. Aoun & G. Goret & E. Pellegrini, G.R. Kneller",
author_email = "aoun.ill.fr, goretg@ill.fr, pellegrini@ill.fr, kneller@cnrs-orleans.fr",
author = "B. Aoun & G. Goret & E. Pellegrini",
author_email = "aoun.ill.fr, goretg@ill.fr, pellegrini@ill.fr",
maintainer = "B. Aoun, G. Goret, E. Pellegrini",
maintainer_email = "aoun.ill.fr, goretg.ill.fr, pellegrini@ill.fr",
url = "https://forge.epn-campus.eu/projects/nmoldyn/",
url = "https://github.com/eurydyce/MDANSE/tree/master/MDANSE",
license = "CeCILL",
packages = PACKAGES,
package_data = PACKAGE_DATA,
......
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