From d0635e04971e3ee3b951d1c74c43b755b0096bb2 Mon Sep 17 00:00:00 2001 From: David Luevano <55825613+luevano@users.noreply.github.com> Date: Thu, 12 Dec 2019 03:51:16 -0700 Subject: Add function for multiple molecules and fix spelling --- c_matrix.py | 21 ++++++++++++++++++++- lj_matrix.py | 21 ++++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/c_matrix.py b/c_matrix.py index dff638bc5..f6f18976e 100644 --- a/c_matrix.py +++ b/c_matrix.py @@ -31,7 +31,7 @@ def c_matrix(mol_data, as_eig=False, bohr_radius_units=False): """ - Creates the coulomb matrix from the molecule data given. + Creates the Coulomb Matrix from the molecule data given. mol_data: molecule data, matrix of atom coordinates. nc_data: nuclear charge data, array of atom data. max_len: maximum amount of atoms in molecule. @@ -144,3 +144,22 @@ def c_matrix(mol_data, return np.sort(eig(cm)[0])[::-1] else: return cm + + +def c_matrix_multiple(mol_data, + nc_data, + max_len=25, + as_eig=False, + bohr_radius_units=False): + """ + Calculates the Coulomb Matrix of multiple molecules. + mol_data: molecule data, matrix of atom coordinates. + nc_data: nuclear charge data, array of atom data. + 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. + """ + cm_data = np.array([c_matrix(mol, nc, max_len, as_eig, bohr_radius_units) + for mol, nc in zip(mol_data, nc_data)]) + + return cm_data diff --git a/lj_matrix.py b/lj_matrix.py index c99982731..40ff30d3d 100644 --- a/lj_matrix.py +++ b/lj_matrix.py @@ -31,7 +31,7 @@ def lj_matrix(mol_data, as_eig=False, bohr_radius_units=False): """ - Creates the coulomb matrix from the molecule data given. + Creates the Lennard-Jones Matrix from the molecule data given. mol_data: molecule data, matrix of atom coordinates. nc_data: nuclear charge data, array of atom data. max_len: maximum amount of atoms in molecule. @@ -162,3 +162,22 @@ def lj_matrix(mol_data, return np.sort(eig(lj)[0])[::-1] else: return lj + + +def c_matrix_multiple(mol_data, + nc_data, + max_len=25, + as_eig=False, + 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. + 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. + """ + ljm_data = np.array([lj_matrix(mol, nc, max_len, as_eig, bohr_radius_units) + for mol, nc in zip(mol_data, nc_data)]) + + return ljm_data -- cgit v1.2.3-54-g00ecf