From d5a22fcb3c5ea412658f3c8818e78bbae90f8163 Mon Sep 17 00:00:00 2001 From: mane292 Date: Mon, 25 Mar 2024 04:56:56 -0400 Subject: [PATCH] Add functionality to calculate minimum distance to cage atoms --- pyef/.analysis.py.swp | Bin 16384 -> 0 bytes pyef/analysis.py | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) delete mode 100644 pyef/.analysis.py.swp diff --git a/pyef/.analysis.py.swp b/pyef/.analysis.py.swp deleted file mode 100644 index 7302c1eb0efbb9a1126bd4a3b1ed5ba897023854..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeHOO^hQ)748HGLUdk0#qr<^D{LSg1f zTjRfz@h@fLq?4{(&p$H$)pXeUd3MkFf6w?{HvZ|1k@NqS@h@lmudng{n(;rM@n2u# z|0Uz+70<(2z`6dnGk)&hvupf6XMFCHz{bzk_-|$WCo=ngTH}8x8~;>x-^~Vc``K`D zD-b9UC=e(RC=e(RC=e(RC=e(RC=e(RC=mFsAfQ~!qMG#v6{7h2e_sE;^`K?F3Hm+g zSD@EGuY$f0`X=bBpc&`@)B-&Wdh-FxdIR)p&@VujL3^M9=q#uO`Yh;9(0A{*tS^J^ z0{!7W%X%Jk1N2GIU7*FimKB2T2L1LP%X$TL6ZFE}mh}|qD(E*Kv#bW_M<2DUOQ3h} zvaBD2o(8@B5zG1(s0sSzhb=1tJp_6gb$1W+JJjd5L63lbg4ikk>;KteT&!NDy|A<+ z%H5XiZdXLJUJ&ZE>?3yiY@S4P{V_IjcVy&td zrKd@*0~L^KK#wiAp{YSSuE(q%Ghwz_W78cx5%2Pdd3B!G#9X-5u87u#{wG*Try<*2 z%x%CwxCBXf0xwxhr^Ry{7_Cd2>=5rDo!FM!u-?F2TXqmZeZxY}kSpz`?2;hEP=`Zs z1xhsY5FQLS7zP_pjNTbG(C*4^4U7hK!!tYqzcq}m2c%`YB?+Jg1JR(6;fpApSIq3n zHkoH6>ST<0srh<}Dfk(d8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oGO{$%jFH{ z3BXQMlKrCHl{#?Ds@btDP9qmfJWo8|NY{&p^hDpFFs5~n4u?ssbt;&S`rat#$J&JR z7@y;m?}R>u1$=>es=?LI&$X4k7{`karB7eEiNNmlRnCc2;9>wjk(-YN^I3FALqU`e znfVA%(dR!ONn+*bk#e5P2mEk?&*&t7HB*Wwf1~eq{ydwhrQUFAIOqqc*}o0?0_Yvo>aT&m0eTYjMUVtN2zmhYCiK1m z`XT5g&~4BJvLZQoudP}*k2vHfvDB=T` zOE7K}P)+&hQCo^;JK>xw(%t3L0 zl|{VOYc+x!r896$T++cLnVQlwyX@!?UDBgEH=nyX59Q!R>J(_q1mF~-cB%Jc<#Y1; ziF13X*jH!v-p?lReHIlSY@|tG#IYqYe|juyS;*C}y@GH~HhZ%WO9ITiif1Tk1<&5aY2 zIZH{KwNsE5SuH;}&08+(w}d9`B<1?^`v(i2awp5BGIt$m0G&V1u73*!@@GQ>p!Ndv zC5EeNZ)AJ!87q$=zoYj@UAH0rfBanG7P=<_dy&MB+!Scz_#s;5F}0=8QxAYRT9^t4 X1_R65a6F**gg+6G)?=12xMTejEUFdZ diff --git a/pyef/analysis.py b/pyef/analysis.py index 955e0ec..340e2af 100644 --- a/pyef/analysis.py +++ b/pyef/analysis.py @@ -314,6 +314,43 @@ def calcdist(espatom_idx, charge_file): return [distances_vertices, Ga_self_dist] + def calcNearestCageAtom(espatom_idx, charge_file): + df = pd.read_csv(charge_file, sep='\s+', names=["Atom",'x', 'y', 'z', "charge"]) + k = 8.987551*(10**9) # Coulombic constant in kg*m**3/(s**4*A**2) + + # Convert each column to list for quicker indexing + atoms = df['Atom'] + charges = df['charge'] + xs = df['x'] + ys = df['y'] + zs = df['z'] + + # Pick the index of the atom at which the esp should be calculated + idx_atom = espatom_idx + + # Determine position and charge of the target atom + xo = xs[idx_atom] + yo = ys[idx_atom] + zo = zs[idx_atom] + chargeo = charges[idx_atom] + total_esp = 0 + + # Distance to cage atoms + cage_idxs = list(np.range(0, 280)) + distances_toCage = [] + counter = 0 + + for cage_idx in cage_idxs: + Cax = xs[cage_idx] + Cay = ys[cage_idx] + Caz = zs[cage_idx] + r = (((Cax - xo))**2 + ((Cay - yo))**2 + ((Caz - zo))**2)**(0.5) + distances_toCage.append(r) + array_dists = np.array(distances_toCage) + NearestCageAtom = np.min(array_dists) + + return [NearestCageAtom] + def calcesp(espatom_idx, charge_range, charge_file): """ @@ -760,8 +797,10 @@ def getESPData(self, charge_types, ESPdata_filename): # If .molden files deal with encapsulated TMCS, complete an additional set of analyses if self.inGaCageBool: [distoGa, Ga_selfdist]=Electrostatics.calcdist(atom_idx, full_file_path) + [cageAtomdist]=Electrostatics.calcNearestCageAtom(atom_idx, full_file_path) results_dict['MetaltoGa_dist'] = distoGa results_dict['GatoGa_dist'] = Ga_selfdist + results_dict['NearestCageAtom'] = cageAtomdist else: continue except Exception as e: