Commit 90e99a2b authored by Remi Perenon's avatar Remi Perenon
Browse files

Modification of source file to compel with new scientific and MMTK ILL version

parent 9cf2fc3f
......@@ -103,7 +103,7 @@ def mic_generator_2D(double[:,:] pts not None, double border, double[:] box_para
def mic_generator_3D(double[:,:] pts not None, double border, double[:] box_param):
cdef int i, m, new_id, nb_init_points
cdef int i, j_int, m, new_id, nb_init_points
cdef double x, y, z, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax, j, k, l, n0, n1, n2
cdef vector[equiv_t] equivalence
cdef vector[point] new_points
......@@ -168,8 +168,9 @@ def mic_generator_3D(double[:,:] pts not None, double border, double[:] box_para
for i in range(new_points.size()):
j = i + nb_init_points
res[j,0] = new_points[i][0]
res[j,1] = new_points[i][1]
res[j,2] = new_points[i][2]
j_int = int(j)
res[j_int,0] = new_points[i][0]
res[j_int,1] = new_points[i][1]
res[j_int,2] = new_points[i][2]
return res, d
......@@ -13,8 +13,8 @@ def mt(ndarray[np.float64_t, ndim = 2] config not None,
ndarray[np.int32_t, ndim = 3] grid not None,
double resolution,ndarray[np.float64_t, ndim = 1] mini not None):
cdef int at, nbatom , atom
cdef double Xpos, Ypos, Zpos, i, j, k , mx, my, mz
cdef int at, nbatom, atom, i, j, k
cdef double Xpos, Ypos, Zpos, mx, my, mz
mx = mini[0]
my = mini[1]
......@@ -23,7 +23,7 @@ def mt(ndarray[np.float64_t, ndim = 2] config not None,
nbatom = config.shape[0]
for atom in range(nbatom):
# The of atoms |i| in the current configuration.
i = floor((config[atom,0]-mx)/resolution)
j = floor((config[atom,1]-my)/resolution)
k = floor((config[atom,2]-mz)/resolution)
grid[i,j,k] += 1
i = int(floor((config[atom,0]-mx)/resolution))
j = int(floor((config[atom,1]-my)/resolution))
k = int(floor((config[atom,2]-mz)/resolution))
grid[i][j][k] += 1
......@@ -97,7 +97,11 @@ class DipoleAutoCorrelationFunction(IJob):
dipoleMoment = numpy.zeros((3,),dtype=numpy.float64)
for idx in self._indexes:
dipoleMoment += self.configuration["atom_charges"]["charges"][idx]*conf[idx]
temp = self.configuration["atom_charges"]["charges"][idx]*conf[idx]
# Loop to sum temp because MMTK redefines __add__ operator, leading to a crash
#dipoleMoment = dipoleMoment + self.configuration["atom_charges"]["charges"][idx]*conf[idx]
for k in range(len(temp)):
dipoleMoment[k] = dipoleMoment[k] + temp[k]
return index, dipoleMoment
......
......@@ -107,12 +107,12 @@ class MolecularTrace(IJob):
self.min = numpy.array([minx, miny, minz], dtype = numpy.float64)
self._outputData.add('origin',"line", self.min, units = 'nm')
self.gdim = numpy.ceil(numpy.array([dimx, dimy, dimz])/self.resolution)
self.gdim = numpy.ceil(numpy.array([dimx, dimy, dimz])/self.resolution).astype(numpy.int)
spacing = self.configuration['spatial_resolution']['value']
self._outputData.add('spacing',"line",numpy.array([spacing, spacing, spacing]), units = 'nm')
self.grid = numpy.zeros(self.gdim, dtype = numpy.int32)
self._outputData.add('molecular_trace',"volume", tuple(numpy.ceil(numpy.array([dimx, dimy, dimz])/self.resolution)))
self._outputData.add('molecular_trace',"volume", tuple(numpy.ceil(numpy.array([dimx, dimy, dimz])/self.resolution).astype(numpy.int)))
self._indexes = [idx for idxs in self.configuration['atom_selection']['indexes'] for idx in idxs]
......
......@@ -60,7 +60,7 @@ class SphericalLatticeQVectors(LatticeQVectors):
vects = numpy.mgrid[-hklMax[0]:hklMax[0]+1,-hklMax[1]:hklMax[1]+1,-hklMax[2]:hklMax[2]+1]
vects = vects.reshape(3,(2*hklMax[0]+1)*(2*hklMax[1]+1)*(2*hklMax[2]+1))
vects = vects.reshape(3,int(2*hklMax[0]+1)*int(2*hklMax[1]+1)*int(2*hklMax[2]+1))
vects = numpy.dot(self._reciprocalMatrix,vects)
......
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