Skip to content

Commit

Permalink
Merge pull request #414 from mir-group/np-upgrade
Browse files Browse the repository at this point in the history
relax numpy requirement
  • Loading branch information
jonpvandermause authored Sep 16, 2024
2 parents 48d9cdd + 26943d9 commit 4f4a285
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion flare/descriptors/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def setup_mask(self, cutoffs_mask):
self.cut3b_mask = cutoffs_mask.get("cut3b_mask", None)
if "threebody_cutoff_list" in cutoffs_mask:
self.threebody_cutoff_list = np.array(
cutoffs_mask["threebody_cutoff_list"], dtype=np.float
cutoffs_mask["threebody_cutoff_list"], dtype=np.float64
)

def compute_env(self):
Expand Down
2 changes: 1 addition & 1 deletion flare/utils/parameter_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ def summarize_group(self, group_type):
for ele in self.groups["specie"][idt]:
atom_n = atomic_numbers[ele]
if atom_n >= len(self.species_mask):
new_mask = np.ones(atom_n, dtype=np.int) * (nspecie - 1)
new_mask = np.ones(atom_n, dtype=np.int8) * (nspecie - 1)
new_mask[: len(self.species_mask)] = self.species_mask
self.species_mask = new_mask
self.species_mask[atom_n] = idt
Expand Down
4 changes: 2 additions & 2 deletions flare/utils/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def check_instantiation(hyps, cutoffs, kernels, param_dict):

# check mask has the right dimension and values
mask = param_dict[f"{kernel}_mask"]
param_dict[f"{kernel}_mask"] = nparray(mask, dtype=np.int)
param_dict[f"{kernel}_mask"] = nparray(mask, dtype=np.int8)

assert npmax(mask) < n
dim = Parameters.ndim[kernel]
Expand Down Expand Up @@ -247,7 +247,7 @@ def check_instantiation(hyps, cutoffs, kernels, param_dict):

# Ensure typed correctly as numpy array
param_dict["original_hyps"] = nparray(
param_dict["original_hyps"], dtype=np.float
param_dict["original_hyps"], dtype=np.float64
)
if (len(param_dict["original_hyps"]) - 1) not in param_dict["map"]:
assert (
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy >=1.18, <1.23
numpy
scipy
memory_profiler
numba
Expand Down
8 changes: 4 additions & 4 deletions tests/test_grid_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ def get_reference(grid_env, species, parameter, kernel_name, same_hyps):
)
args = from_mask_to_args(hm["hyps"], hm["cutoffs"], None if same_hyps else hm)

energy_force = np.zeros(3, dtype=np.float)
# force_force = np.zeros(3, dtype=np.float)
# force_energy = np.zeros(3, dtype=np.float)
# energy_energy = np.zeros(3, dtype=np.float)
energy_force = np.zeros(3, dtype=np.float64)
# force_force = np.zeros(3, dtype=np.float64)
# force_energy = np.zeros(3, dtype=np.float64)
# energy_energy = np.zeros(3, dtype=np.float64)
for i in range(3):
energy_force[i] = force_en_kernel(env, grid_env, i + 1, *args)
# force_energy[i] = force_en_kernel(env, grid_env, i, *args)
Expand Down

0 comments on commit 4f4a285

Please sign in to comment.