From 7353c9772de3043e1e477d8b4a6e7364394a4e41 Mon Sep 17 00:00:00 2001 From: Luna Pratali Maffei Date: Thu, 14 Nov 2024 16:02:39 +0100 Subject: [PATCH] improved stupid/unstable ped and dos merging --- mechanalyzer/calculator/ene_partition.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/mechanalyzer/calculator/ene_partition.py b/mechanalyzer/calculator/ene_partition.py index 211bad1..af8f038 100644 --- a/mechanalyzer/calculator/ene_partition.py +++ b/mechanalyzer/calculator/ene_partition.py @@ -335,23 +335,21 @@ def init_dos(pressure, temp): # calculate rho_non1(ene1_vect) rho_non1 = [] - for idx in self.ene1_vect: - # first iter should be 0 + #for idx in self.ene1_vect: + ###old, relied on the fact that energy vector had spacing of 1, however not always accurate + for idx, _ in enumerate(self.ene1_vect[:-1]): # the sum of the energies in rhovib_prod2 and - # rho_trasl is always ene1 - idx_ene_int = np.arange(0, idx+1, dtype=int) + # rho_trasl is always ene1 + # ene1 = ene1_vect_w0[idx_ene_int] + ene1_vect_w0[idx_ene_int[::-1]] + # oldĀ # idx_ene_int = np.arange(0, idx+1, dtype=int) + idx_ene_int = np.arange(0, idx+2, dtype=int) idx_ene_minus_ene_int = idx_ene_int[::-1] rho_non1_integrand = ( rho_rovib_prod2[idx_ene_int] * rho_trasl[idx_ene_minus_ene_int] ) - try: - rho_non1.append(np.trapz(rho_non1_integrand, - x=self.ene1_vect[idx_ene_int])) - except IndexError: - continue - #probably just missed 1 index - #print(pressure, temp, self.ene1_vect, idx, idx_ene_int) + rho_non1.append(np.trapz(rho_non1_integrand, + x=self.ene1_vect[idx_ene_int])) rho_non1 = np.array(rho_non1)