Skip to content

Commit

Permalink
Replace deprecated calls to np.product
Browse files Browse the repository at this point in the history
  • Loading branch information
basilib committed Dec 17, 2024
1 parent 3056cc8 commit 6152cbb
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion vayesta/core/bath/rpa.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def make_bno_coeff(self, cderis=None):
# This is of size O(N), so this whole procedure scales as O(N^4)

target_rot = einsum("ij,ab->iajb", rot_occ, rot_vir)
target_rot = target_rot.reshape(np.product(target_rot.shape[:2]), np.product(target_rot.shape[2:]))
target_rot = target_rot.reshape(np.prod(target_rot.shape[:2]), np.prod(target_rot.shape[2:]))

t0 = timer()
myrpa = ssRIdRRPA(self.base.mf, lov=cderis)
Expand Down
2 changes: 1 addition & 1 deletion vayesta/core/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def unpack_arrays(packed, dtype=float, maxdim=8):
unpacked.append(None)
continue
shape = shape[:ndim]
size = np.product(shape)
size = np.prod(shape)
array, packed = np.hsplit(packed, [size])
unpacked.append(array.view(dtype).reshape(shape))
return unpacked
Expand Down
2 changes: 1 addition & 1 deletion vayesta/core/symmetry/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def get_atom_at(pos):
if self.group.dimension == 1 and (dy != 0):
continue
dr = np.asarray([dx, dy, dz])
phase = np.product(self.boundary_phases[dr != 0])
phase = np.prod(self.boundary_phases[dr != 0])
dists = np.linalg.norm(atom_coords_abc + dr - pos, axis=1)
idx = np.argmin(dists)
if dists[idx] < self.xtol:
Expand Down
2 changes: 1 addition & 1 deletion vayesta/core/symmetry/tsymmetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def get_atom_at(pos, xtol=1e-8):
if cell.dimension == 1 and (dy != 0):
continue
dr = np.asarray([dx, dy, dz])
phase = np.product(boundary[dr != 0])
phase = np.prod(boundary[dr != 0])
# log.debugv("dx= %d dy= %d dz= %d phase= %d", dx, dy, dz, phase)
# print(atom_coords.shape, dr.shape, pos.shape)
dists = np.linalg.norm(atom_coords + dr - pos, axis=1)
Expand Down
2 changes: 1 addition & 1 deletion vayesta/dmet/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def _unflatten_params(self, params):

def get_nonflat(flat_params, shapes, x):
if type(shapes[0]) == int:
return flat_params[x : x + np.product(shapes)].reshape(shapes), x + np.product(shapes)
return flat_params[x : x + np.prod(shapes)].reshape(shapes), x + np.prod(shapes)
else:
finres = []
for shape in shapes:
Expand Down
2 changes: 1 addition & 1 deletion vayesta/mpi/rma.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def remote_init(self):
def size(self):
if self.shape is None:
return 0
return np.product(self.shape)
return np.prod(self.shape)

# @property
# def itemsize(self):
Expand Down
4 changes: 2 additions & 2 deletions vayesta/tools/plotting/plotly_mol.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def mol_supercell(mol, charges, spins):
mol = pyscf.pbc.tools.super_cell(mol, images)
# mol = pyscf.pbc.tools.cell_plus_imgs(mol, images)
# nimages = images[0]*images[1]*images[2]
# ncells = np.product(2*np.asarray(images)+1)
ncells = np.product(images)
# ncells = np.prod(2*np.asarray(images)+1)
ncells = np.prod(images)
if charges is not None:
charges = ncells * list(charges)
if spins is not None:
Expand Down

0 comments on commit 6152cbb

Please sign in to comment.