summaryrefslogtreecommitdiff
path: root/lj_matrix.py
diff options
context:
space:
mode:
authorDavid Luevano <55825613+luevano@users.noreply.github.com>2019-12-12 20:49:41 -0700
committerDavid Luevano <55825613+luevano@users.noreply.github.com>2019-12-12 20:49:41 -0700
commitada04a42528c29ea86e48f0a19cb8723c8bc0a66 (patch)
tree4c72d4aaec333f34cb0e8b699e190583b3fd910b /lj_matrix.py
parent4c1c9c0e6c74f51c2557fb2ef2d236321b62f43a (diff)
First working parallelism
Diffstat (limited to 'lj_matrix.py')
-rw-r--r--lj_matrix.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/lj_matrix.py b/lj_matrix.py
index 6769bc0c3..55e729c56 100644
--- a/lj_matrix.py
+++ b/lj_matrix.py
@@ -30,7 +30,7 @@ from numpy.linalg import eig
def lj_matrix(mol_data,
nc_data,
max_len=25,
- as_eig=False,
+ as_eig=True,
bohr_radius_units=False):
"""
Creates the Lennard-Jones Matrix from the molecule data given.
@@ -168,13 +168,16 @@ def lj_matrix(mol_data,
def lj_matrix_multiple(mol_data,
nc_data,
+ pipe=None,
max_len=25,
- as_eig=False,
+ as_eig=True,
bohr_radius_units=False):
"""
Calculates the Lennard-Jones Matrix of multiple molecules.
mol_data: molecule data, matrix of atom coordinates.
nc_data: nuclear charge data, array of atom data.
+ pipe: for multiprocessing purposes. Sends the data calculated
+ through a pipe.
max_len: maximum amount of atoms in molecule.
as_eig: if data should be returned as matrix or array of eigenvalues.
bohr_radius_units: if units should be in bohr's radius units.
@@ -185,6 +188,9 @@ def lj_matrix_multiple(mol_data,
ljm_data = np.array([lj_matrix(mol, nc, max_len, as_eig, bohr_radius_units)
for mol, nc in zip(mol_data, nc_data)])
+ if pipe:
+ pipe.send(ljm_data)
+
toc = time.perf_counter()
printc('\tL-JM calculation took {:.4f} seconds.'.format(toc-tic), 'GREEN')