Commit 9b57904e authored by Stelios Karozis's avatar Stelios Karozis

Change output of res2grid function

parent 236a9cf9
...@@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [0.0.2] - 2020-05-05 ## [0.0.2] - 2020-05-11
### Added ### Added
- code for domain decomposition function - code for domain decomposition function
- code for identify desired atoms - code for identify desired atoms
......
...@@ -13,6 +13,6 @@ box_p=tbf.domain_decomposition(data=data_all,dx=2,dy=2,dz=2) ...@@ -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 #Find atom type index in lists created above
group_ndx=tbf.resid_data(atom_type, group=['C1']) group_ndx=tbf.resid_data(atom_type, group=['C1'])
#Assign desired atoms (from above function) to subdomains #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
...@@ -226,12 +226,14 @@ def res2grid(data, atom_num, box_p, ndx): ...@@ -226,12 +226,14 @@ def res2grid(data, atom_num, box_p, ndx):
box_p = {dictionary input from 'def domain_decomposition'} box_p = {dictionary input from 'def domain_decomposition'}
ndx = {dictionary input from 'def resid_data'} ndx = {dictionary input from 'def resid_data'}
output: dictionary output: dictionaries
""" """
box_res={} box_res={}
box_res_rev = {}
for step in data.keys(): for step in data.keys():
box_res[step]={} box_res[step]={}
box_res_rev[step] = {}
for key in ndx.keys(): for key in ndx.keys():
for i in ndx[key]: for i in ndx[key]:
#data[step]['x'][atom_num][x(0),y(1),z(2)] #data[step]['x'][atom_num][x(0),y(1),z(2)]
...@@ -262,5 +264,9 @@ def res2grid(data, atom_num, box_p, ndx): ...@@ -262,5 +264,9 @@ def res2grid(data, atom_num, box_p, ndx):
if zz<iz and zz>prev: if zz<iz and zz>prev:
prev=iz prev=iz
break break
box_res[step][atom_num[i]]=[cnt_x,cnt_y,cnt_z] box_res[step][atom_num[i]]=(cnt_x,cnt_y,cnt_z)
return box_res #Make subdomain position the key and group the residues
\ No newline at end of file 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment