Commit 3c7e2cc1 authored by eric pellegrini's avatar eric pellegrini Committed by Remi Perenon

refactored disf with external loop in q

parent 9d752529
...@@ -52,7 +52,7 @@ class DynamicIncoherentStructureFactor(IJob): ...@@ -52,7 +52,7 @@ class DynamicIncoherentStructureFactor(IJob):
Initialize the input parameters and analysis self variables Initialize the input parameters and analysis self variables
""" """
self.numberOfSteps = self.configuration['atom_selection']['selection_length'] self.numberOfSteps = self.configuration["q_vectors"]["n_shells"]
self._nQShells = self.configuration["q_vectors"]["n_shells"] self._nQShells = self.configuration["q_vectors"]["n_shells"]
...@@ -88,34 +88,41 @@ class DynamicIncoherentStructureFactor(IJob): ...@@ -88,34 +88,41 @@ class DynamicIncoherentStructureFactor(IJob):
#. atomicSF (numpy.array): The atomic structure factor #. atomicSF (numpy.array): The atomic structure factor
""" """
# get atom index shell = self.configuration["q_vectors"]["shells"][index]
indexes = self.configuration['atom_selection']["indexes"][index]
masses = self.configuration['atom_selection']["masses"][index]
series = read_atoms_trajectory(self.configuration["trajectory"]["instance"],
indexes,
first=self.configuration['frames']['first'],
last=self.configuration['frames']['last']+1,
step=self.configuration['frames']['step'],
weights=masses)
series = self.configuration['projection']["projector"](series) if not shell in self.configuration["q_vectors"]["value"]:
return index, None
else:
atomicSF = numpy.zeros((self._nQShells,self._nFrames), dtype=numpy.float64) qVectors = self.configuration["q_vectors"]["value"][shell]["q_vectors"]
for i,q in enumerate(self.configuration["q_vectors"]["shells"]):
disf_per_q_shell = {}
if not q in self.configuration["q_vectors"]["value"]: for element in self.configuration['atom_selection']['unique_names']:
continue disf_per_q_shell[element] = numpy.zeros((self._nFrames,), dtype = numpy.float)
qVectors = self.configuration["q_vectors"]["value"][q]["q_vectors"] for i,atom_indexes in enumerate(self.configuration['atom_selection']["indexes"]):
masses = self.configuration['atom_selection']["masses"][i]
element = self.configuration['atom_selection']["names"][i]
rho = numpy.exp(1j*numpy.dot(series, qVectors)) series = read_atoms_trajectory(self.configuration["trajectory"]["instance"],
res = correlation(rho, axis=0, average=1) atom_indexes,
first=self.configuration['frames']['first'],
atomicSF[i,:] += res last=self.configuration['frames']['last']+1,
step=self.configuration['frames']['step'],
weights=[masses])
series = self.configuration['projection']["projector"](series)
rho = numpy.exp(1j*numpy.dot(series, qVectors))
res = correlation(rho, axis=0, average=1)
disf_per_q_shell[element] += res
return index, atomicSF return index, disf_per_q_shell
def combine(self, index, x): def combine(self, index, x):
...@@ -126,11 +133,9 @@ class DynamicIncoherentStructureFactor(IJob): ...@@ -126,11 +133,9 @@ class DynamicIncoherentStructureFactor(IJob):
#. x (any): The returned result(s) of run_step #. x (any): The returned result(s) of run_step
""" """
element = self.configuration['atom_selection']["names"][index] for k,v in x.items():
self._outputData["f(q,t)_%s" % k][index,:] += v
self._outputData["f(q,t)_%s" % element] += x
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 ...)
......
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