Commit 00f4c0d7 authored by eric pellegrini's avatar eric pellegrini

Fixed bug when using q vectors under NPT conditions

parent e56a01f5
Pipeline #4328 failed with stages
in 9 minutes and 53 seconds
...@@ -124,20 +124,24 @@ class DynamicCoherentStructureFactor(IJob): ...@@ -124,20 +124,24 @@ class DynamicCoherentStructureFactor(IJob):
return index, None return index, None
else: else:
traj = self.configuration['trajectory']['instance'] traj = self.configuration['trajectory']['instance']
qVectors = self.configuration["q_vectors"]["value"][shell]["q_vectors"] nQVectors = self.configuration["q_vectors"]["value"][shell]["q_vectors"].shape[1]
rho = {} rho = {}
for element in self.configuration['atom_selection']['unique_names']: for element in self.configuration['atom_selection']['unique_names']:
rho[element] = numpy.zeros((self._nFrames, qVectors.shape[1]), dtype = numpy.complex64) rho[element] = numpy.zeros((self._nFrames, nQVectors), dtype = numpy.complex64)
# loop over the trajectory time steps # loop over the trajectory time steps
for i, frame in enumerate(self.configuration['frames']['value']): for i, frame in enumerate(self.configuration['frames']['value']):
qVectors = self.configuration["q_vectors"]["value"][shell]["q_vectors"]
conf = traj.configuration[frame] conf = traj.configuration[frame]
for element,idxs in self._indexesPerElement.items(): for element,idxs in self._indexesPerElement.items():
selectedCoordinates = numpy.take(conf.array, idxs, axis=0) selectedCoordinates = numpy.take(conf.array, idxs, axis=0)
rho[element][i,:] = numpy.sum(numpy.exp(1j*numpy.dot(selectedCoordinates, qVectors)),axis=0) rho[element][i,:] = numpy.sum(numpy.exp(1j*numpy.dot(selectedCoordinates, qVectors)),axis=0)
...@@ -183,4 +187,4 @@ class DynamicCoherentStructureFactor(IJob): ...@@ -183,4 +187,4 @@ class DynamicCoherentStructureFactor(IJob):
self.configuration['trajectory']['instance'].close() self.configuration['trajectory']['instance'].close()
REGISTRY['dcsf'] = DynamicCoherentStructureFactor REGISTRY['dcsf'] = DynamicCoherentStructureFactor
\ No newline at end of file
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