summaryrefslogtreecommitdiff
path: root/ml_exp
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <55825613+luevano@users.noreply.github.com>2020-02-22 18:37:50 -0700
committerDavid Luevano Alvarado <55825613+luevano@users.noreply.github.com>2020-02-22 18:37:50 -0700
commit85198178482767d2831ddf3762e5e6eeafa990bd (patch)
tree60524aef277834d8d1ccc2bb231a222678ff85a5 /ml_exp
parent8d0a22b9fdef41ece399468423cb533768d0e631 (diff)
Fix bug, current errors present on adj matrix
Diffstat (limited to 'ml_exp')
-rw-r--r--ml_exp/__main__.py3
-rw-r--r--ml_exp/representations.py16
2 files changed, 8 insertions, 11 deletions
diff --git a/ml_exp/__main__.py b/ml_exp/__main__.py
index cb8a9a3f1..17119623e 100644
--- a/ml_exp/__main__.py
+++ b/ml_exp/__main__.py
@@ -28,6 +28,3 @@ if __name__ == '__main__':
test = []
for i in range(1, 10):
test.append(Compound(f'/home/luevano/py/ml_exp/data/qm7/000{i}.xyz'))
- test[i-1].gen_cm(size=1, as_eig=False)
- test[i-1].gen_ljm(size=1, as_eig=False)
- test[i-1].gen_am(size=1)
diff --git a/ml_exp/representations.py b/ml_exp/representations.py
index ae870f3b0..796d15f98 100644
--- a/ml_exp/representations.py
+++ b/ml_exp/representations.py
@@ -48,8 +48,8 @@ def coulomb_matrix(coords,
size. Arrays are not of the right shape.')
if size < n:
- print('Error. Compound size (n) is greater han (size). Using (n)\
- instead of (size).')
+ print('Error. Compound size (n) is greater han (size). Using (n)',
+ 'instead of (size).')
size = n
cm = np.zeros((size, size), dtype=float)
@@ -115,8 +115,8 @@ def lennard_jones_matrix(coords,
size. Arrays are not of the right shape.')
if size < n:
- print('Error. Compound size (n) is greater han (size). Using (n)\
- instead of (size).')
+ print('Error. Compound size (n) is greater han (size). Using (n)',
+ 'instead of (size).')
size = n
lj = np.zeros((size, size), dtype=float)
@@ -137,10 +137,10 @@ def lennard_jones_matrix(coords,
# so no square root is calculated.
# Conversion factor is included in r^2.
rv = xyz_i - xyz_j
- r = sigma*np.linalg.norm(rv)/cr
+ r = np.linalg.norm(rv)/cr
# 1/r^n
- r_2 = 1/r**2
+ r_2 = sigma**2/r**2
r_6 = r_2**3
r_12 = r_6**2
lj[i, j] = (4*epsilon*(r_12 - r_6))
@@ -204,9 +204,9 @@ def first_neighbor_matrix(coords,
cs_bond = sorted(['C', 'S'])
if use_forces:
- fnm = np.empty((n, n), dtype=float)
+ fnm = np.zeros((n, n), dtype=float)
else:
- fnm = np.empty((n, n), dtype=int)
+ fnm = np.zeros((n, n), dtype=int)
bonds = []
forces = []