From 9b57904e31d76b5f51f91de2a7cd672abfe034a4 Mon Sep 17 00:00:00 2001 From: skarozis Date: Mon, 11 May 2020 21:14:23 +0300 Subject: [PATCH] Change output of res2grid function --- CHANGELOG | 2 +- main.py | 4 ++-- tooba_f.py | 12 +++++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 16315f5..5bfc074 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [0.0.2] - 2020-05-05 +## [0.0.2] - 2020-05-11 ### Added - code for domain decomposition function - code for identify desired atoms diff --git a/main.py b/main.py index 324decb..15284a1 100644 --- a/main.py +++ b/main.py @@ -13,6 +13,6 @@ box_p=tbf.domain_decomposition(data=data_all,dx=2,dy=2,dz=2) #Find atom type index in lists created above group_ndx=tbf.resid_data(atom_type, group=['C1']) #Assign desired atoms (from above function) to subdomains -box_res=tbf.res2grid(data_all,atom_num,box_p, group_ndx) - +_,box_res=tbf.res2grid(data_all,atom_num,box_p, group_ndx) +print(box_res) \ No newline at end of file diff --git a/tooba_f.py b/tooba_f.py index f34c835..f9f80dc 100644 --- a/tooba_f.py +++ b/tooba_f.py @@ -226,12 +226,14 @@ def res2grid(data, atom_num, box_p, ndx): box_p = {dictionary input from 'def domain_decomposition'} ndx = {dictionary input from 'def resid_data'} - output: dictionary + output: dictionaries """ box_res={} + box_res_rev = {} for step in data.keys(): box_res[step]={} + box_res_rev[step] = {} for key in ndx.keys(): for i in ndx[key]: #data[step]['x'][atom_num][x(0),y(1),z(2)] @@ -262,5 +264,9 @@ def res2grid(data, atom_num, box_p, ndx): if zzprev: prev=iz break - box_res[step][atom_num[i]]=[cnt_x,cnt_y,cnt_z] - return box_res \ No newline at end of file + box_res[step][atom_num[i]]=(cnt_x,cnt_y,cnt_z) + #Make subdomain position the key and group the residues + for key, value in sorted(box_res[step].items()): + box_res_rev[step].setdefault(value, []).append(key.strip()) + + return box_res,box_res_rev \ No newline at end of file -- 2.24.1