Commit e1965474 authored by Miguel Angel Gonzalez's avatar Miguel Angel Gonzalez Committed by Remi Perenon

Fix problem with normalization and change from time to duration in analysis...

Fix problem with normalization and change from time to duration in analysis computing correlations between different frames
parent c482b22f
......@@ -84,6 +84,8 @@ class FramesConfigurator(RangeConfigurator):
self['time_step'] = self['time'][1] - self['time'][0]
except IndexError:
self['time_step'] = 1.0
self['duration'] = self['time'] - self['time'][0]
def get_information(self):
'''
......
......@@ -85,7 +85,7 @@ class AngularCorrelation(IJob):
self.numberOfSteps = self.configuration['axis_selection']['n_values']
self._outputData.add("time","line", self.configuration['frames']['time'],units='ps')
self._outputData.add("time","line", self.configuration['frames']['duration'],units='ps')
self._outputData.add("axis_index","line", numpy.arange(self.configuration['axis_selection']['n_values']), units='au')
......
......@@ -85,7 +85,7 @@ class CurrentCorrelationFunction(IJob):
self._outputData.add("q","line", numpy.array(self.configuration["q_vectors"]["shells"]), units="inv_nm")
self._outputData.add("time","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time","line", self.configuration['frames']['duration'], units='ps')
self._outputData.add("time_window","line", self._instrResolution["time_window"], units="au")
self._outputData.add("omega","line", self._instrResolution["omega"],units='rad/ps')
......
......@@ -73,7 +73,7 @@ class DensityOfStates(IJob):
instrResolution = self.configuration["instrument_resolution"]
self._outputData.add("time","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time","line", self.configuration['frames']['duration'], units='ps')
self._outputData.add("time_window","line", instrResolution["time_window"], axis="time", units="au")
self._outputData.add("omega","line", instrResolution["omega"], units='rad/ps')
......
......@@ -64,7 +64,7 @@ class DipoleAutoCorrelationFunction(IJob):
self.numberOfSteps = self.configuration['frames']['number']
# Will store the time.
self._outputData.add("time","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time","line", self.configuration['frames']['duration'], units='ps')
self._dipoleMoments = numpy.zeros((self.configuration['frames']['number'],3),dtype=numpy.float64)
......
......@@ -91,7 +91,7 @@ class DynamicCoherentStructureFactor(IJob):
self._outputData.add("q","line",self.configuration["q_vectors"]["shells"], units="inv_nm")
self._outputData.add("time","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time","line", self.configuration['frames']['duration'], units='ps')
self._outputData.add("time_window","line", self._instrResolution["time_window"], units="au")
self._outputData.add("omega","line", self._instrResolution["omega"], units='rad/ps')
......
......@@ -82,7 +82,7 @@ class DynamicIncoherentStructureFactor(IJob):
self._outputData.add("q","line", self.configuration["q_vectors"]["shells"], units="inv_nm")
self._outputData.add("time","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time","line", self.configuration['frames']['duration'], units='ps')
self._outputData.add("time_window","line", self._instrResolution["time_window"], axis="time", units="au")
self._outputData.add("omega","line", self._instrResolution["omega"], units='rad/ps')
......
......@@ -86,7 +86,7 @@ class GaussianDynamicIncoherentStructureFactor(IJob):
self._outputData.add("q2","line",self._kSquare,units="inv_nm**2")
self._outputData.add("time","line",self.configuration['frames']['time'], units='ps')
self._outputData.add("time","line",self.configuration['frames']['duration'], units='ps')
self._outputData.add("time_window","line",self._instrResolution["time_window"], axis="time", units="au")
self._outputData.add("omega","line",self.configuration["instrument_resolution"]["omega"], units='rad/ps')
......
......@@ -69,7 +69,7 @@ class GeneralAutoCorrelationFunction(IJob):
self.numberOfSteps = self.configuration['atom_selection']['selection_length']
# Will store the time.
self._outputData.add("time","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time","line", self.configuration['frames']['duration'], units='ps')
# Will store the mean square displacement evolution.
for element in self.configuration['atom_selection']['unique_names']:
......
......@@ -89,7 +89,7 @@ class MeanSquareDisplacement(IJob):
self.numberOfSteps = self.configuration['atom_selection']['selection_length']
# Will store the time.
self._outputData.add("time", "line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time", "line", self.configuration['frames']['duration'], units='ps')
# Will store the mean square displacement evolution.
for element in self.configuration['atom_selection']['unique_names']:
......
......@@ -68,7 +68,7 @@ class PositionAutoCorrelationFunction(IJob):
self.numberOfSteps = self.configuration['atom_selection']['selection_length']
# Will store the time.
self._outputData.add("time","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time","line", self.configuration['frames']['duration'], units='ps')
# Will store the mean square displacement evolution.
for element in self.configuration['atom_selection']['unique_names']:
......
......@@ -72,7 +72,7 @@ class RootMeanSquareDeviation(IJob):
self._referenceIndex = self.configuration['reference_frame']['value']
# Will store the time.
self._outputData.add("time","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time","line", self.configuration['frames']['duration'], units='ps')
# Will store the mean square deviation
for element in self.configuration['atom_selection']['unique_names']:
......
......@@ -93,7 +93,7 @@ class VelocityAutoCorrelationFunction(IJob):
self.numberOfSteps = self.configuration['atom_selection']['selection_length']
# Will store the time.
self._outputData.add("time","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time","line", self.configuration['frames']['duration'], units='ps')
# Will store the mean square displacement evolution.
for element in self.configuration['atom_selection']['unique_names']:
......@@ -160,15 +160,16 @@ class VelocityAutoCorrelationFunction(IJob):
for element, number in nAtomsPerElement.items():
self._outputData["vacf_%s" % element] /= number
if self.configuration['normalize']["value"]:
for element in nAtomsPerElement.keys():
self._outputData["vacf_%s" % element] = normalize(self._outputData["vacf_%s" % element], axis=0)
weights = self.configuration["weights"].get_weights()
vacfTotal = weight(weights,self._outputData,nAtomsPerElement,1,"vacf_%s")
self._outputData["vacf_total"][:] = vacfTotal
if self.configuration['normalize']["value"]:
for element in nAtomsPerElement.keys():
self._outputData["vacf_%s" % element] = normalize(self._outputData["vacf_%s" % element], axis=0)
self._outputData["vacf_total"] = normalize(self._outputData["vacf_total"], axis=0)
self._outputData.write(self.configuration['output_files']['root'], self.configuration['output_files']['formats'], self._info)
self.configuration['trajectory']['instance'].close()
......
......@@ -42,9 +42,6 @@ class OutputVariableError(Error):
class OutputData(collections.OrderedDict):
def __setitem__(self,item,value):
pass
def add(self, dataName, dataType, data, **kwargs):
collections.OrderedDict.__setitem__(self,dataName,REGISTRY["output_variable"][dataType](data, dataName, **kwargs))
......
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