Commit 16071ec2 authored by Remi Perenon's avatar Remi Perenon

Merge branch 'bugfix-fix_vacf_normalization_ccf_q_vectors_and_initial_time_issues' into 'develop'

Bugfix fix vacf normalization ccf q vectors and initial time issues

See merge request !33
parents c482b22f da449e2a
Pipeline #4309 passed with stages
in 21 minutes and 59 seconds
......@@ -2,10 +2,12 @@ version 1.2.0
--------------
* ADDED issue #27 Better error handling when an error occurs when running an analysis from the GUI
* ADDED issue #10 Implemented Gromacs trajectory converter
* FIXED issue #30 Normalization of VACF total value was incorrect
* FIXED issue #29 Some jobs (AC, CCF, DOS, DACF, DCSF, DISF, GACF, MSD, PACF, RMSD, VACF) did not behave properly if first time of the MD is not zero
* FIXED issue #28 The time step is now part of the settings for DCD based converters
* FIXED issue #26 Data can be deleted from the GUI
* FIXED issue #25 The plotter is now compliant with all matplotlib versions (was crashing on ubuntu-xenial)
* FIXED issue #25 The plotter is now compliant with all matplotlib versions (was crashing on ubuntu-xenial)
* FIXED issue #24 Q vectors in CCF Job were incorrect
* FIXED issue #21 "Save a template for new analysis" button produced an error
* FIXED issue #20 Opening the theoretical help on MacOS is now OK
* FIXED issue #18 The items of the checkable combobox are now checkable on Windows
......
......@@ -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')
......@@ -128,11 +128,7 @@ class CurrentCorrelationFunction(IJob):
traj = self.configuration['trajectory']['instance']
qVectors = self.configuration["q_vectors"]["value"][shell]["q_vectors"]
qVectors = traj.universe._boxToRealPointArray(qVectors.T)
qVectors = qVectors.T
nQVectors = qVectors.shape[1]
rho = {}
......
......@@ -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')
......@@ -127,11 +127,11 @@ class DynamicCoherentStructureFactor(IJob):
traj = self.configuration['trajectory']['instance']
qVectors = self.configuration["q_vectors"]["value"][shell]["q_vectors"]
qVectors = traj.universe._boxToRealPointArray(qVectors.T)
qVectors = qVectors.T
rho = {}
for element in self.configuration['atom_selection']['unique_names']:
rho[element] = numpy.zeros((self._nFrames, qVectors.shape[1]), dtype = numpy.complex64)
......@@ -140,7 +140,7 @@ class DynamicCoherentStructureFactor(IJob):
for i, frame in enumerate(self.configuration['frames']['value']):
conf = traj.configuration[frame]
conf.convertToBoxCoordinates()
for element,idxs in self._indexesPerElement.items():
......
......@@ -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))
......@@ -53,6 +50,10 @@ class OutputData(collections.OrderedDict):
for fmt in formats:
REGISTRY["format"][fmt].write(basename, self, header)
def __setitem__(self, item, value):
# Explicitely discard any changes on output data
pass
class IOutputVariable(numpy.ndarray):
'''
......
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