summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <55825613+luevano@users.noreply.github.com>2020-03-10 12:47:25 -0700
committerDavid Luevano Alvarado <55825613+luevano@users.noreply.github.com>2020-03-10 12:47:25 -0700
commitc8e6c3890a805bd090e31736a56585251ee34a5e (patch)
treede365fc93d747e0d22508b45d6f6bfb802e3b203
parent5cbaae0eb1e39a0514424ab0c0005fbb7f78261c (diff)
Match Am timings.
-rw-r--r--ml_exp/representations.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/ml_exp/representations.py b/ml_exp/representations.py
index 937268d0c..4a685d388 100644
--- a/ml_exp/representations.py
+++ b/ml_exp/representations.py
@@ -239,19 +239,19 @@ the current compound.')
instead of (size).')
size = n
- am = np.zeros((size, size), dtype=np.float64)
-
- for i, bond_i in enumerate(bonds_i):
- for j, bond_j in enumerate(bonds_i):
- # Ignore the diagonal.
- if i != j:
- if (bond_i[0] in bond_j) or (bond_i[1] in bond_j):
- if use_forces:
- am[i, j] = np.dot(bonds_f[i], bonds_f[j])
- else:
- am[i, j] = bonds_k[i]
-
- return am
+ am = np.zeros((n, n), dtype=np.float64)
+
+ for i in range(n - 1):
+ for j in range(i + 1, n):
+ if (bonds_i[i][0] in bonds_i[j]) or (bonds_i[i][1] in bonds_i[j]):
+ if use_forces:
+ am[i, j] = np.dot(bonds_f[i], bonds_f[j])
+ am[j, i] = am[i, j]
+ else:
+ am[i, j] = bonds_k[i]
+ am[j, i] = am[i, j]
+
+ return np.pad(am, ((0, size - n), (0, size - n)), 'constant')
def check_bond(bags,