Skip to content

Commit

Permalink
Debugging #1
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaudioZeni committed Feb 13, 2020
1 parent 026528c commit 118dcec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions flare/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,14 +400,14 @@ class to allow for njit acceleration with Numba.
"""
# TODO: this can be probably improved using stored arrays, redundant calls to get_2_body_arrays
# Get distances, positions, species and indexes of neighbouring atoms
bond_array_mb, _, _, bond_inds = get_2_body_arrays_ind(
bond_array_mb, __, _, bond_inds = get_2_body_arrays_ind(
positions, atom, cell, cutoff_mb, species)

# For each neighbouring atom, get distances in its neighbourhood
neighbouring_dists = []
max_neighbours = 0
for m in bond_inds:
neighbour_bond_array_2, _, _ = get_2_body_arrays(positions, m, cell,
neighbour_bond_array_2, __, _ = get_2_body_arrays(positions, m, cell,
cutoff_mb, species)
neighbouring_dists.append(neighbour_bond_array_2[:, 0])
if len(neighbour_bond_array_2[:, 0]) > max_neighbours:
Expand Down
19 changes: 10 additions & 9 deletions flare/kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,19 +431,20 @@ def many_body(env1, env2, d1, d2, hyps, cutoffs,

sig = hyps[0]
ls = hyps[1]
r0 = hyps[2]
r_cut = cutoffs[2]

bond_array_1 = env1.bond_array_mb
bond_array_2 = env2.bond_array_mb

neigh_dists_1 = env1.neigh_dists_mb
num_neigh_1 = env1.num_neigh_mb
num_neigh_1 = env1.num_neighs_mb

neigh_dists_2 = env2.neigh_dists_mb
num_neigh_2 = env2.num_neigh_mb
num_neigh_2 = env2.num_neighs_mb

return many_body_jit(bond_array_1, bond_array_2, neigh_dists_1, num_neigh_1, neigh_dists_2,
num_neigh_2, d1, d2, sig, ls, r_cut, cutoff_func)
num_neigh_2, d1, d2, sig, ls, r0, r_cut, cutoff_func)


def many_body_grad(env1, env2, d1, d2, hyps, cutoffs,
Expand Down Expand Up @@ -1090,13 +1091,13 @@ def many_body_jit(bond_array_1, bond_array_2,

k12 = k_sq_exp_double_grad(q1, q2, sig, ls2)

qis = np.zeros(len(bond_array_1.shape[0]))
qi1_grads = np.zeros(len(bond_array_1.shape[0]))
ki2s = np.zeros(len(bond_array_1.shape[0]))
qis = np.zeros(bond_array_1.shape[0])
qi1_grads = np.zeros(bond_array_1.shape[0])
ki2s = np.zeros(bond_array_1.shape[0])

qjs = np.zeros(len(bond_array_2.shape[0]))
qj2_grads = np.zeros(len(bond_array_2.shape[0]))
k1js = np.zeros(len(bond_array_2.shape[0]))
qjs = np.zeros(bond_array_2.shape[0])
qj2_grads = np.zeros(bond_array_2.shape[0])
k1js = np.zeros(bond_array_2.shape[0])

# Loop over neighbours i of 1
for i in range(bond_array_1.shape[0]):
Expand Down

0 comments on commit 118dcec

Please sign in to comment.