Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relax numpy requirement #414

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading