Commit 4bcdbbf9 authored by eric pellegrini's avatar eric pellegrini
Browse files

Bug fix when using atom_transmutation configurator

Bug fix when grouping atom through grouping_level configurator
The grouping_level configurator depends now on atom_selection and
atom_transmutation configurator
The weight configurator depends now on atom_selection configurator
parent ccb98160
...@@ -77,7 +77,7 @@ class Configurable(object): ...@@ -77,7 +77,7 @@ class Configurable(object):
for name,(typ,kwds) in self.settings.items(): for name,(typ,kwds) in self.settings.items():
try: try:
self._configuration[name] = REGISTRY["configurator"][typ](name, **kwds) self._configuration[name] = REGISTRY["configurator"][typ](self, name, **kwds)
# Any kind of error has to be caught # Any kind of error has to be caught
except: except:
raise ConfigurationError("Invalid type for %r configurator" % name) raise ConfigurationError("Invalid type for %r configurator" % name)
...@@ -150,22 +150,22 @@ class Configurable(object): ...@@ -150,22 +150,22 @@ class Configurable(object):
continue continue
if conf.check_dependencies(configured): if conf.check_dependencies(configured):
conf.configure(self,parameters[name]) conf.configure(parameters[name])
self._configuration[name]=conf self._configuration[name]=conf
self._info += conf.get_information() self._info += conf.get_information()
configured.add(name) configured.add(name)
progress = True progress = True
if not progress: if not progress:
raise ConfigurationError("Circular or unsatisfiable dependencies when setting up configuration.") raise ConfigurationError("Circular or unsatisfiable dependencies when setting up configuration.")
self._configured=True self._configured=True
def __str__(self): def __str__(self):
''' '''
Returns the informations about the current configuration in text form. Returns the informations about the current configuration in text form.
......
...@@ -44,17 +44,15 @@ class PartialChargeConfigurator(IConfigurator): ...@@ -44,17 +44,15 @@ class PartialChargeConfigurator(IConfigurator):
_default = '' _default = ''
def configure(self, configuration, value): def configure(self, value):
''' '''
Configure a python script. Configure a python script.
:param configuration: the current configuration.
:type configuration: a MDANSE.Framework.Configurable.Configurable object
:param value: the path for the python script. :param value: the path for the python script.
:type value: str :type value: str
''' '''
trajConfig = configuration[self._dependencies['trajectory']] trajConfig = self._configurable[self._dependencies['trajectory']]
if UD_STORE.has_definition(trajConfig["basename"],'partial_charges',value): if UD_STORE.has_definition(trajConfig["basename"],'partial_charges',value):
self.update(UD_STORE.get_definition(trajConfig["basename"],'partial_charges',value)) self.update(UD_STORE.get_definition(trajConfig["basename"],'partial_charges',value))
......
...@@ -45,7 +45,7 @@ class RangeConfigurator(IConfigurator): ...@@ -45,7 +45,7 @@ class RangeConfigurator(IConfigurator):
_default = (0,10,1) _default = (0,10,1)
def __init__(self, name, valueType=int, includeLast=False, sort=False, toList=False, mini=None, maxi=None, **kwargs): def __init__(self, configurable, name, valueType=int, includeLast=False, sort=False, toList=False, mini=None, maxi=None, **kwargs):
''' '''
Initializes the configurator. Initializes the configurator.
...@@ -65,7 +65,7 @@ class RangeConfigurator(IConfigurator): ...@@ -65,7 +65,7 @@ class RangeConfigurator(IConfigurator):
:type maxi: int, float or None :type maxi: int, float or None
''' '''
IConfigurator.__init__(self, name, **kwargs) IConfigurator.__init__(self, configurable, name, **kwargs)
self._valueType = valueType self._valueType = valueType
...@@ -79,12 +79,10 @@ class RangeConfigurator(IConfigurator): ...@@ -79,12 +79,10 @@ class RangeConfigurator(IConfigurator):
self._maxi = maxi self._maxi = maxi
def configure(self, configuration, value): def configure(self, value):
''' '''
Configure a range from its first, last and step values. Configure a range from its first, last and step values.
:param configuration: the current configuration
:type configuration: a MDANSE.Framework.Configurable.Configurable object
:param value: the first, last and step values used to generate the range. :param value: the first, last and step values used to generate the range.
:type value: 3-tuple :type value: 3-tuple
''' '''
...@@ -101,7 +99,7 @@ class RangeConfigurator(IConfigurator): ...@@ -101,7 +99,7 @@ class RangeConfigurator(IConfigurator):
value = value[value >= self._mini] value = value[value >= self._mini]
if self._maxi is not None: if self._maxi is not None:
value = value[value <= self._maxi] value = value[value < self._maxi]
if value.size == 0: if value.size == 0:
raise ConfiguratorError("the input range is empty." , self) raise ConfiguratorError("the input range is empty." , self)
......
...@@ -72,8 +72,9 @@ class BoxCenteredTrajectory(IJob): ...@@ -72,8 +72,9 @@ class BoxCenteredTrajectory(IJob):
# Create a MMTK collection from the atoms selected for translation. # Create a MMTK collection from the atoms selected for translation.
atoms = sorted_atoms(self.configuration['trajectory']['instance'].universe) atoms = sorted_atoms(self.configuration['trajectory']['instance'].universe)
self._selectedAtoms = Collection([atoms[ind] for ind in self.configuration['atom_selection']['indexes']]) self._indexes = [idx for idxs in self.configuration['atom_selection']['indexes'] for idx in idxs]
self._selectedAtoms = Collection([atoms[idx] for idx in self._indexes])
# The output trajectory is opened for writing. # The output trajectory is opened for writing.
self._btt = Trajectory(self._selectedAtoms, self.configuration['output_files']['files'][0], "w") self._btt = Trajectory(self._selectedAtoms, self.configuration['output_files']['files'][0], "w")
self._btt.title = self.__class__.__name__ self._btt.title = self.__class__.__name__
...@@ -117,7 +118,7 @@ class BoxCenteredTrajectory(IJob): ...@@ -117,7 +118,7 @@ class BoxCenteredTrajectory(IJob):
conf = Configuration(self._universe, self._universe._boxToRealPointArray(self._boxCoords)) conf = Configuration(self._universe, self._universe._boxToRealPointArray(self._boxCoords))
# The universe is translated by the center of the selected atoms. # The universe is translated by the center of the selected atoms.
c = center(conf.array[self.configuration['atom_selection']['indexes'],:]) c = center(conf.array[self._indexes,:])
conf.array -= c conf.array -= c
self._universe.setConfiguration(conf) self._universe.setConfiguration(conf)
......
...@@ -56,9 +56,8 @@ class CenterOfMassesTrajectory(IJob): ...@@ -56,9 +56,8 @@ class CenterOfMassesTrajectory(IJob):
settings = collections.OrderedDict() settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{}) settings['trajectory'] = ('mmtk_trajectory',{})
settings['frames'] = ('frames', {'dependencies':{'trajectory':'trajectory'}, 'default':(0,1,1)}) settings['frames'] = ('frames', {'dependencies':{'trajectory':'trajectory'}, 'default':(0,1,1)})
settings['atom_selection'] = ('atom_selection',{'dependencies':{'trajectory':'trajectory', settings['atom_selection'] = ('atom_selection',{'dependencies':{'trajectory':'trajectory'}})
'grouping_level':'grouping_level'}}) settings['grouping_level']=('grouping_level',{"dependencies":{'trajectory':'trajectory','atom_selection':'atom_selection'}})
settings['grouping_level'] = ('grouping_level',{})
settings['output_files'] = ('output_files', {'formats':["netcdf"]}) settings['output_files'] = ('output_files', {'formats':["netcdf"]})
def initialize(self): def initialize(self):
...@@ -67,8 +66,8 @@ class CenterOfMassesTrajectory(IJob): ...@@ -67,8 +66,8 @@ class CenterOfMassesTrajectory(IJob):
""" """
self.numberOfSteps = self.configuration['frames']['number'] self.numberOfSteps = self.configuration['frames']['number']
self._partition = partition_universe(self.configuration['trajectory']['instance'].universe,self.configuration['atom_selection']['groups']) self._partition = partition_universe(self.configuration['trajectory']['instance'].universe,self.configuration['atom_selection']['indexes'])
self._newUniverse = copy.copy(self.configuration['trajectory']['instance'].universe) self._newUniverse = copy.copy(self.configuration['trajectory']['instance'].universe)
......
...@@ -55,8 +55,7 @@ class CoordinationNumber(DistanceHistogram): ...@@ -55,8 +55,7 @@ class CoordinationNumber(DistanceHistogram):
settings['frames'] = ('frames', {'dependencies':{'trajectory':'trajectory'}}) settings['frames'] = ('frames', {'dependencies':{'trajectory':'trajectory'}})
settings['r_values'] = ('range', {'valueType':float, 'includeLast':True, 'mini':0.0}) settings['r_values'] = ('range', {'valueType':float, 'includeLast':True, 'mini':0.0})
settings['atom_selection'] = ('atom_selection', {'dependencies':{'trajectory':'trajectory'}}) settings['atom_selection'] = ('atom_selection', {'dependencies':{'trajectory':'trajectory'}})
settings['transmutated_atoms'] = ('atom_transmutation', {'dependencies':{'trajectory':'trajectory', settings['atom_transmutation'] = ('atom_transmutation', {'dependencies':{'trajectory':'trajectory','atom_selection':'atom_selection'}})
'atom_selection':'atom_selection'}})
settings['output_files'] = ('output_files', {'formats':["netcdf","ascii"]}) settings['output_files'] = ('output_files', {'formats':["netcdf","ascii"]})
settings['running_mode'] = ('running_mode',{}) settings['running_mode'] = ('running_mode',{})
...@@ -94,12 +93,13 @@ class CoordinationNumber(DistanceHistogram): ...@@ -94,12 +93,13 @@ class CoordinationNumber(DistanceHistogram):
for k in self._concentrations.keys(): for k in self._concentrations.keys():
self._concentrations[k] /= nFrames self._concentrations[k] /= nFrames
for pair in self._elementsPairs: nAtomsPerElement = self.configuration['atom_selection'].get_natoms()
ni = self.configuration['atom_selection']['n_atoms_per_element'][pair[0]] for at1,at2 in self._elementsPairs:
nj = self.configuration['atom_selection']['n_atoms_per_element'][pair[1]] ni = nAtomsPerElement[at1]
nj = nAtomsPerElement[at2]
idi = self.selectedElements.index(pair[0]) idi = self.selectedElements.index(at1)
idj = self.selectedElements.index(pair[1]) idj = self.selectedElements.index(at2)
if idi == idj: if idi == idj:
nij = ni*(ni-1)/2.0 nij = ni*(ni-1)/2.0
......
...@@ -67,7 +67,8 @@ class CroppedTrajectory(IJob): ...@@ -67,7 +67,8 @@ class CroppedTrajectory(IJob):
atoms = sorted_atoms(self.configuration['trajectory']['instance'].universe) atoms = sorted_atoms(self.configuration['trajectory']['instance'].universe)
# The collection of atoms corresponding to the atoms selected for output. # The collection of atoms corresponding to the atoms selected for output.
self._selectedAtoms = Collection([atoms[ind] for ind in self.configuration['atom_selection']['indexes']]) indexes = [idx for idxs in self.configuration['atom_selection']['indexes'] for idx in idxs]
self._selectedAtoms = Collection([atoms[ind] for ind in indexes])
# The output trajectory is opened for writing. # The output trajectory is opened for writing.
self._ct = Trajectory(self._selectedAtoms, self.configuration['output_files']['files'][0], "w") self._ct = Trajectory(self._selectedAtoms, self.configuration['output_files']['files'][0], "w")
......
...@@ -35,7 +35,6 @@ import itertools ...@@ -35,7 +35,6 @@ import itertools
import numpy import numpy
from MDANSE import ELEMENTS
from MDANSE.Framework.Jobs.IJob import IJob from MDANSE.Framework.Jobs.IJob import IJob
from MDANSE.Mathematics.Arithmetic import weight from MDANSE.Mathematics.Arithmetic import weight
from MDANSE.Mathematics.Signal import correlation, normalize, get_spectrum from MDANSE.Mathematics.Signal import correlation, normalize, get_spectrum
...@@ -65,9 +64,8 @@ class CurrentCorrelationFunction(IJob): ...@@ -65,9 +64,8 @@ class CurrentCorrelationFunction(IJob):
settings['q_vectors'] = ('q_vectors',{'dependencies':{'trajectory':'trajectory'}}) settings['q_vectors'] = ('q_vectors',{'dependencies':{'trajectory':'trajectory'}})
settings['atom_selection'] = ('atom_selection',{'dependencies':{'trajectory':'trajectory'}}) settings['atom_selection'] = ('atom_selection',{'dependencies':{'trajectory':'trajectory'}})
settings['normalize'] = ('boolean', {'default':False}) settings['normalize'] = ('boolean', {'default':False})
settings['transmutated_atoms'] = ('atom_transmutation',{'dependencies':{'trajectory':'trajectory', settings['atom_transmutation'] = ('atom_transmutation',{'dependencies':{'trajectory':'trajectory','atom_selection':'atom_selection'}})
'atom_selection':'atom_selection'}}) settings['weights'] = ('weights', {'default':'b_coherent',"dependencies":{'trajectory':'trajectory','atom_selection':'atom_selection', 'atom_transmutation':'atom_transmutation'}})
settings['weights'] = ('weights', {'default':'b_coherent'})
settings['output_files'] = ('output_files', {'formats':["netcdf","ascii"]}) settings['output_files'] = ('output_files', {'formats':["netcdf","ascii"]})
settings['running_mode'] = ('running_mode',{}) settings['running_mode'] = ('running_mode',{})
...@@ -91,8 +89,11 @@ class CurrentCorrelationFunction(IJob): ...@@ -91,8 +89,11 @@ class CurrentCorrelationFunction(IJob):
self._outputData.add("times","line", self.configuration['frames']['time'], units='ps') self._outputData.add("times","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("frequency","line", self._instrResolution["frequencies"],units='THz') self._outputData.add("frequency","line", self._instrResolution["frequencies"],units='THz')
self._elementsPairs = sorted(itertools.combinations_with_replacement(self.configuration['atom_selection']['contents'].keys(),2)) self._elements = self.configuration['atom_selection']['unique_names']
self._elementsPairs = sorted(itertools.combinations_with_replacement(self._elements,2))
self._indexesPerElement = self.configuration['atom_selection'].get_indexes()
for pair in self._elementsPairs: for pair in self._elementsPairs:
self._outputData.add("j(q,t)_long_%s%s" % pair,"surface", (nQShells,self._nFrames), axis="q|times", units="au") self._outputData.add("j(q,t)_long_%s%s" % pair,"surface", (nQShells,self._nFrames), axis="q|times", units="au")
...@@ -115,7 +116,7 @@ class CurrentCorrelationFunction(IJob): ...@@ -115,7 +116,7 @@ class CurrentCorrelationFunction(IJob):
#. index (int): The index of the step. #. index (int): The index of the step.
#. rho (numpy.array): The exponential part of I(q,t) #. rho (numpy.array): The exponential part of I(q,t)
""" """
shell = self.configuration["q_vectors"]["shells"][index] shell = self.configuration["q_vectors"]["shells"][index]
if not shell in self.configuration["q_vectors"]["value"]: if not shell in self.configuration["q_vectors"]["value"]:
...@@ -139,7 +140,7 @@ class CurrentCorrelationFunction(IJob): ...@@ -139,7 +140,7 @@ class CurrentCorrelationFunction(IJob):
rhoTrans = {} rhoTrans = {}
rhoLong_loop = {} rhoLong_loop = {}
rhoTrans_loop = {} rhoTrans_loop = {}
for element in self.configuration['atom_selection']['contents'].keys(): for element in self._elements:
rho[element] = numpy.zeros((self._nFrames, 3, nQVectors), dtype = numpy.complex64) rho[element] = numpy.zeros((self._nFrames, 3, nQVectors), dtype = numpy.complex64)
rho_loop[element] = numpy.zeros((self._nFrames, 3, nQVectors), dtype = numpy.complex64) rho_loop[element] = numpy.zeros((self._nFrames, 3, nQVectors), dtype = numpy.complex64)
rhoLong_loop[element] = numpy.zeros((self._nFrames, 3, nQVectors), dtype = numpy.complex64) rhoLong_loop[element] = numpy.zeros((self._nFrames, 3, nQVectors), dtype = numpy.complex64)
...@@ -150,7 +151,7 @@ class CurrentCorrelationFunction(IJob): ...@@ -150,7 +151,7 @@ class CurrentCorrelationFunction(IJob):
conf = traj.configuration[frame] conf = traj.configuration[frame]
vel = traj.velocities[frame] vel = traj.velocities[frame]
for element,idxs in self.configuration['atom_selection']['contents'].items(): for element,idxs in self._indexesPerElement.items():
selectedCoordinates = conf.array[idxs,:] selectedCoordinates = conf.array[idxs,:]
selectedVelocities = vel.array[idxs,:] selectedVelocities = vel.array[idxs,:]
selectedVelocities = numpy.transpose(selectedVelocities)[:,:,numpy.newaxis] selectedVelocities = numpy.transpose(selectedVelocities)[:,:,numpy.newaxis]
...@@ -159,7 +160,7 @@ class CurrentCorrelationFunction(IJob): ...@@ -159,7 +160,7 @@ class CurrentCorrelationFunction(IJob):
Q2 = numpy.sum(qVectors**2,axis=0) Q2 = numpy.sum(qVectors**2,axis=0)
for element in self.configuration['atom_selection']['contents'].keys(): for element in self._elements:
qj = numpy.sum(rho[element]*qVectors,axis=1) qj = numpy.sum(rho[element]*qVectors,axis=1)
rhoLong[element] = (qj[:,numpy.newaxis,:]*qVectors[numpy.newaxis,:,:])/Q2 rhoLong[element] = (qj[:,numpy.newaxis,:]*qVectors[numpy.newaxis,:,:])/Q2
rhoTrans[element] = rho[element] - rhoLong[element] rhoTrans[element] = rho[element] - rhoLong[element]
...@@ -173,32 +174,34 @@ class CurrentCorrelationFunction(IJob): ...@@ -173,32 +174,34 @@ class CurrentCorrelationFunction(IJob):
#. index (int): The index of the step.\n #. index (int): The index of the step.\n
#. x (any): The returned result(s) of run_step #. x (any): The returned result(s) of run_step
""" """
if x is None: if x is None:
return return
jLong, jTrans = x jLong, jTrans = x
for pair in self._elementsPairs: for at1,at2 in self._elementsPairs:
corrLong = numpy.zeros((self._nFrames,),dtype=numpy.float64) corrLong = numpy.zeros((self._nFrames,),dtype=numpy.float64)
corrTrans = numpy.zeros((self._nFrames,),dtype=numpy.float64) corrTrans = numpy.zeros((self._nFrames,),dtype=numpy.float64)
for i in range(3): for i in range(3):
corrLong += correlation(jLong[pair[0]][:,i,:],jLong[pair[1]][:,i,:], axis=0, average=1) corrLong += correlation(jLong[at1][:,i,:],jLong[at2][:,i,:], axis=0, average=1)
corrTrans += correlation(jTrans[pair[0]][:,i,:],jTrans[pair[1]][:,i,:], axis=0, average=1) corrTrans += correlation(jTrans[at1][:,i,:],jTrans[at2][:,i,:], axis=0, average=1)
self._outputData["j(q,t)_long_%s%s" % pair][index,:] += corrLong self._outputData["j(q,t)_long_%s%s" % (at1,at2)][index,:] += corrLong
self._outputData["j(q,t)_trans_%s%s" % pair][index,:] += corrTrans self._outputData["j(q,t)_trans_%s%s" % (at1,at2)][index,:] += corrTrans
def finalize(self): def finalize(self):
""" """
Finalizes the calculations (e.g. averaging the total term, output files creations ...) Finalizes the calculations (e.g. averaging the total term, output files creations ...)
""" """
nAtomsPerElement = self.configuration['atom_selection'].get_natoms()
for pair in self._elementsPairs: for pair in self._elementsPairs:
ni = self.configuration['atom_selection']['n_atoms_per_element'][pair[0]] at1,at2 = pair
nj = self.configuration['atom_selection']['n_atoms_per_element'][pair[1]] ni = nAtomsPerElement[at1]
nj = nAtomsPerElement[at2]
self._outputData["j(q,t)_long_%s%s" % pair][:] /= ni*nj self._outputData["j(q,t)_long_%s%s" % pair][:] /= ni*nj
self._outputData["j(q,t)_trans_%s%s" % pair][:] /= ni*nj self._outputData["j(q,t)_trans_%s%s" % pair][:] /= ni*nj
self._outputData["J(q,f)_long_%s%s" % pair][:] = get_spectrum(self._outputData["j(q,t)_long_%s%s" % pair], self._outputData["J(q,f)_long_%s%s" % pair][:] = get_spectrum(self._outputData["j(q,t)_long_%s%s" % pair],
...@@ -215,22 +218,16 @@ class CurrentCorrelationFunction(IJob): ...@@ -215,22 +218,16 @@ class CurrentCorrelationFunction(IJob):
self._outputData["j(q,t)_long_%s%s" % pair] = normalize(self._outputData["j(q,t)_long_%s%s" % pair],axis=1) self._outputData["j(q,t)_long_%s%s" % pair] = normalize(self._outputData["j(q,t)_long_%s%s" % pair],axis=1)
self._outputData["j(q,t)_trans_%s%s" % pair] = normalize(self._outputData["j(q,t)_trans_%s%s" % pair],axis=1) self._outputData["j(q,t)_trans_%s%s" % pair] = normalize(self._outputData["j(q,t)_trans_%s%s" % pair],axis=1)
props = dict([[k,ELEMENTS[k,self.configuration["weights"]["property"]]] for k in self.configuration['atom_selection']['n_atoms_per_element'].keys()]) jqtLongTotal = weight(self.configuration["weights"].get_weights(),self._outputData,nAtomsPerElement,2,"j(q,t)_long_%s%s")
jqtLongTotal = weight(props,self._outputData,self.configuration['atom_selection']['n_atoms_per_element'],2,"j(q,t)_long_%s%s")
self._outputData["j(q,t)_long_total"][:] = jqtLongTotal self._outputData["j(q,t)_long_total"][:] = jqtLongTotal
jqtTransTotal = weight(props,self._outputData,self.configuration['atom_selection']['n_atoms_per_element'],2,"j(q,t)_trans_%s%s") jqtTransTotal = weight(self.configuration["weights"].get_weights(),self._outputData,nAtomsPerElement,2,"j(q,t)_trans_%s%s")
self._outputData["j(q,t)_trans_total"][:] = jqtTransTotal self._outputData["j(q,t)_trans_total"][:] = jqtTransTotal
sqfLongTotal = weight(props, sqfLongTotal = weight(self.configuration["weights"].get_weights(),self._outputData,nAtomsPerElement,2,"J(q,f)_long_%s%s")
self._outputData,
self.configuration['atom_selection']['n_atoms_per_element'],
2,
"J(q,f)_long_%s%s")
self._outputData["J(q,f)_long_total"][:] = sqfLongTotal self._outputData["J(q,f)_long_total"][:] = sqfLongTotal
sqfTransTotal = weight(props,self._outputData,self.configuration['atom_selection']['n_atoms_per_element'],2,"J(q,f)_trans_%s%s") sqfTransTotal = weight(self.configuration["weights"].get_weights(),self._outputData,nAtomsPerElement,2,"J(q,f)_trans_%s%s")
self._outputData["J(q,f)_trans_total"][:] = sqfTransTotal self._outputData["J(q,f)_trans_total"][:] = sqfTransTotal
self._outputData.write(self.configuration['output_files']['root'], self.configuration['output_files']['formats'], self._info) self._outputData.write(self.configuration['output_files']['root'], self.configuration['output_files']['formats'], self._info)
......
...@@ -32,7 +32,6 @@ Created on Apr 10, 2015 ...@@ -32,7 +32,6 @@ Created on Apr 10, 2015
import collections import collections
from MDANSE import ELEMENTS
from MDANSE.Framework.Jobs.IJob import IJob from MDANSE.Framework.Jobs.IJob import IJob
from MDANSE.Mathematics.Arithmetic import weight from MDANSE.Mathematics.Arithmetic import weight
from MDANSE.Mathematics.Signal import correlation, differentiate, get_spectrum from MDANSE.Mathematics.Signal import correlation, differentiate, get_spectrum
...@@ -56,17 +55,13 @@ class DensityOfStates(IJob): ...@@ -56,17 +55,13 @@ class DensityOfStates(IJob):
settings = collections.OrderedDict() settings = collections.OrderedDict()
settings['trajectory'] = ('mmtk_trajectory',{}) settings['trajectory'] = ('mmtk_trajectory',{})
settings['frames'] = ('frames', {'dependencies':{'trajectory':'trajectory'}}) settings['frames'] = ('frames', {'dependencies':{'trajectory':'trajectory'}})
settings['instrument_resolution'] = ('instrument_resolution',{'dependencies':{'trajectory':'trajectory', settings['instrument_resolution'] = ('instrument_resolution',{'dependencies':{'trajectory':'trajectory','frames' : 'frames'}})
'frames' : 'frames'}}) settings['interpolation_order'] = ('interpolation_order', {'label':"velocities",'dependencies':{'trajectory':'trajectory'}})
settings['interpolation_order'] = ('interpolation_order', {'label':"velocities",
'dependencies':{'trajectory':'trajectory'}})
settings['projection'] = ('projection', {'label':"project coordinates"}) settings['projection'] = ('projection', {'label':"project coordinates"})
settings['atom_selection'] = ('atom_selection',{'dependencies':{'trajectory':'trajectory', settings['atom_selection'] = ('atom_selection',{'dependencies':{'trajectory':'trajectory'}})
'grouping_level':'grouping_level'}}) settings['grouping_level']=('grouping_level',{"dependencies":{'trajectory':'trajectory','atom_selection':'atom_selection', 'atom_transmutation':'atom_transmutation'}})
settings['grouping_level'] = ('grouping_level',{}) settings['atom_transmutation'] = ('atom_transmutation',{'dependencies':{'trajectory':'trajectory','atom_selection':'atom_selection'}})
settings['atom_transmutation'] = ('atom_transmutation',{'dependencies':{'trajectory':'trajectory', settings['weights']=('weights',{"dependencies":{"atom_selection":"atom_selection"}})
'atom_selection':'atom_selection'}})
settings['weights'] = ('weights',{})
settings['output_files'] = ('output_files', {'formats':["netcdf","ascii"]}) settings['output_files'] = ('output_files', {'formats':["netcdf","ascii"]})
settings['running_mode'] = ('running_mode',{}) settings['running_mode'] = ('running_mode',{})
...@@ -75,7 +70,7 @@ class DensityOfStates(IJob): ...@@ -75,7 +70,7 @@ class DensityOfStates(IJob):
Initialize the input parameters and analysis self variables Initialize the input parameters and analysis self variables
""" """
self.numberOfSteps = self.configuration['atom_selection']['n_groups'] self.numberOfSteps = self.configuration['atom_selection']['selection_length']
instrResolution = self.configuration["instrument_resolution"] instrResolution = self.configuration["instrument_resolution"]
...@@ -85,7 +80,7 @@ class DensityOfStates(IJob): ...@@ -85,7 +80,7 @@ class DensityOfStates(IJob):
self._outputData.add("frequency","line", instrResolution["frequencies"], units='THz') self._outputData.add("frequency","line", instrResolution["frequencies"], units='THz')
self._outputData.add("frequency_window","line", instrResolution["frequency_window"], axis="frequency", units="au") self._outputData.add("frequency_window","line", instrResolution["frequency_window"], axis="frequency", units="au")
for element in self.configuration['atom_selection']['contents'].keys(): for element in self.configuration['atom_selection']['unique_names']:
self._outputData.add("vacf_%s" % element,"line", (self.configuration['frames']['number'],), axis="time", units="nm2/ps2") self._outputData.add("vacf_%s" % element,"line", (self.configuration['frames']['number'],), axis="time", units="nm2/ps2")
self._outputData.add("dos_%s" % element,"line", (instrResolution['n_frequencies'],), axis="frequency", units="nm2/ps") self._outputData.add("dos_%s" % element,"line", (instrResolution['n_frequencies'],), axis="frequency", units="nm2/ps")
self._outputData.add("vacf_total","line", (self.configuration['frames']['number'],), axis="time", units="nm2/ps2") self._outputData.add("vacf_total","line", (self.configuration['frames']['number'],), axis="time", units="nm2/ps2")
...@@ -104,14 +99,16 @@ class DensityOfStates(IJob): ...@@ -104,14 +99,16 @@ class DensityOfStates(IJob):
""" """
# get atom index # get atom index
indexes = self.configuration['atom_selection']["groups"][index] indexes = self.configuration['atom_selection']["indexes"][index]
masses = self.configuration['atom_selection']["masses"][index]
series = read_atoms_trajectory(self.configuration["trajectory"]["instance"], series = read_atoms_trajectory(self.configuration["trajectory"]["instance"],
indexes, indexes,
first=self.configuration['frames']['first'], first=self.configuration['frames']['first'],
last=self.configuration['frames']['last']+1, last=self.configuration['frames']['last']+1,
step=self.configuration['frames']['step'], step=self.configuration['frames']['step'],
variable=self.configuration['interpolation_order']["variable"]) variable=self.configuration['interpolation_order']["variable"],
weights=masses)
val = self.configuration["interpolation_order"]["value"] val = self.configuration["interpolation_order"]["value"]
...@@ -135,7 +132,7 @@ class DensityOfStates(IJob): ...@@ -135,7 +132,7 @@ class DensityOfStates(IJob):
""" """