Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
T
TooBBA
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stelios Karozis
TooBBA
Commits
f6edc38e
Commit
f6edc38e
authored
Sep 14, 2020
by
Stelios Karozis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch to keep track of molecule group
parent
ccb1ccb1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
121 additions
and
10 deletions
+121
-10
.gitignore
.gitignore
+2
-1
CHANGELOG
CHANGELOG
+10
-0
main.py
main.py
+11
-9
tooba_f.py
tooba_f.py
+98
-0
No files found.
.gitignore
View file @
f6edc38e
...
...
@@ -12,3 +12,4 @@ __pycache__/
*.code-workspace
*.itp
system/
20190322_10
\ No newline at end of file
CHANGELOG
View file @
f6edc38e
...
...
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.1.1] - 2020-09-14
### Added
- add atom2group funtion in order to keep fixed the molecules per domain id
### Changed
- None
### Removed
- None
## [0.1.0] - 2020-07-31
### Added
- None
...
...
main.py
View file @
f6edc38e
...
...
@@ -8,9 +8,9 @@ import tooba_gmx as tbgmx
# in case of tail is the one closest to the head, hence
# the code is a good approximation
###################################################
SYSTEM_NAME
=
'
test
'
SYSTEM_NAME
=
'
20190322_10
'
DISCET
=
[
3.5
,
3.5
,
3.5
]
NUM_FR
=
2
NUM_FR
=
750
TRAJ
=
SYSTEM_NAME
+
'/eq_traj.trr'
GRO
=
SYSTEM_NAME
+
'/eq_final.gro'
TPR
=
SYSTEM_NAME
+
'/eq_run.tpr'
...
...
@@ -164,7 +164,8 @@ for i in GROUPS.keys():
#Assign desired atoms (from above function) to subdomains
##result1: {step:{res:{atom_type:{atom_num:(subX,subYsubZ)}}}}
##result2: {step:{res:{atom_type:{(subX,subYsubZ):[atom_num]}}}}
_
,
box_res
=
tbf
.
atom2grid
(
data_all
,
box_p
,
group_ndx
)
#todo keep fixed the initial domain name and the molecules that are grouped for all the steps
_
,
box_res
=
tbf
.
atom2group
(
data_all
,
box_p
,
group_ndx
)
tbf
.
topickle
(
fl
=
box_res
,
sv_name
=
'./'
+
SYSTEM_NAME
+
'/'
+
SYSTEM_NAME
+
'_'
+
i
+
'_box'
)
del
data_all
del
group_ndx
...
...
@@ -346,17 +347,18 @@ for i in GROUPS.keys():
#Input to COMBINE property
if
j
[
0
]
!=
'COMB'
:
if
j
[
1
]
==
'surf'
:
surf
=
surf
[
j
[
0
]]
surf
_inuse
=
surf
[
j
[
0
]]
#del surf[j[0]]
if
j
[
1
]
==
'vector'
:
vector
=
vector
[
j
[
0
]]
vector
_inuse
=
vector
[
j
[
0
]]
#del vector[j[0]]
#Calculate COMBINE property
if
j
[
0
]
==
'COMB'
:
if
j
[
1
]
==
'tilt'
and
sv_index
[
i
][
str
(
j
)][
'status'
]
==
'not exist'
:
tilt
=
tbf
.
SurfVector_angle
(
surf
,
vector
)
del
surf
del
vector
tilt
=
tbf
.
SurfVector_angle
(
surf_inuse
,
vector_inuse
)
#ToDo: check "if str(value['domain']).strip() == str(sub).strip():"
del
surf_inuse
del
vector_inuse
#Loop over timesteps and keep avgs tilts for each step
avg
=
{}
for
step
in
tilt
.
keys
():
...
...
@@ -368,7 +370,7 @@ for i in GROUPS.keys():
avg
[
sub
]
=
avgs
else
:
avg
[
sub
]
.
append
(
avgs
)
del
tilt
#
del tilt
#Calculate total average
tot_avg
=
{}
for
sub
in
avg
.
keys
():
...
...
tooba_f.py
View file @
f6edc38e
...
...
@@ -515,6 +515,104 @@ def atom2grid(data, box_p, ndx):
bar
.
finish
()
return
box_res
,
box_res_rev
def
atom2group
(
data
,
box_p
,
ndx
):
"""
Assign atom number that corresponds to ndx (see 'def atomid_data')
to sudomains created from 'def domain_decomposition' only for the first step.
Then the same domain id is kept for the same group of molecules. The output
is a the box location (non zero based) in xyz-space for each atom number.
parameters: data = {dictionary input from 'def fr_export'}
box_p = {dictionary input from 'def domain_decomposition'}
ndx = {dictionary input from 'def atomid_data'}
output: dictionaries
1. box_res = {step:{resid:{res_type:{atom_type:{atom_num:(subX,subYsubZ)}}}}}
2. box_res_rev = {step:{resid:{res:{(subX,subYsubZ):[atom_num]}}}}
"""
print
(
' '
)
print
(
'Assing atom to group progress:'
)
print
(
'=============================='
)
step_cnt
=
0
domain_list
=
{}
box_res
=
{}
box_res_rev
=
{}
for
step
in
data
.
keys
():
step_cnt
=
step_cnt
+
1
#print('Step: '+step)
bar
=
Bar
(
'Step: '
+
step
,
max
=
len
(
ndx
.
keys
()))
box_res
[
step
]
=
{}
box_res_rev
[
step
]
=
{}
for
resid
in
ndx
.
keys
():
box_res
[
step
][
resid
]
=
{}
box_res_rev
[
step
][
resid
]
=
{}
for
res
in
ndx
[
resid
]
.
keys
():
box_res
[
step
][
resid
][
res
]
=
{}
box_res_rev
[
step
][
resid
][
res
]
=
{}
for
atom
in
ndx
[
resid
][
res
]
.
keys
():
box_res
[
step
][
resid
][
res
][
atom
]
=
{}
box_res_rev
[
step
][
resid
][
res
][
atom
]
=
{}
for
atomnum
in
ndx
[
resid
][
res
][
atom
]:
#data[step]['x'][atom_num-1][x(0),y(1),z(2)]
if
step_cnt
==
1
:
xx
=
data
[
step
][
'x'
][
int
(
atomnum
)
-
1
][
0
]
cnt_x
=-
1
prev
=-
1
for
ix
in
box_p
[
step
][
'x'
]:
cnt_x
=
cnt_x
+
1
if
xx
<
ix
and
xx
>
prev
:
prev
=
ix
break
yy
=
data
[
step
][
'x'
][
int
(
atomnum
)
-
1
][
1
]
cnt_y
=-
1
prev
=-
1
for
iy
in
box_p
[
step
][
'y'
]:
cnt_y
=
cnt_y
+
1
if
yy
<
iy
and
yy
>
prev
:
prev
=
iy
break
zz
=
data
[
step
][
'x'
][
int
(
atomnum
)
-
1
][
2
]
cnt_z
=-
1
prev
=-
1
for
iz
in
box_p
[
step
][
'z'
]:
cnt_z
=
cnt_z
+
1
if
zz
<
iz
and
zz
>
prev
:
prev
=
iz
break
domain_list
[
atomnum
]
=
(
cnt_x
,
cnt_y
,
cnt_z
)
box_res
[
step
][
resid
][
res
][
atom
][
atomnum
]
=
(
cnt_x
,
cnt_y
,
cnt_z
)
else
:
box_res
[
step
][
resid
][
res
][
atom
][
atomnum
]
=
domain_list
[
atomnum
]
#Make subdomain position the key and group the residues
for
key
,
value
in
sorted
(
box_res
[
step
][
resid
][
res
][
atom
]
.
items
()):
box_res_rev
[
step
][
resid
][
res
]
.
setdefault
(
value
,
[])
.
append
(
key
.
strip
())
#Remove atom_type as key of dictionary
box_res_rev
[
step
][
resid
][
res
]
.
pop
(
atom
,
None
)
#If atoms of residue lie in more than one subdomain, put the all in the first one
if
len
(
box_res_rev
[
step
][
resid
][
res
])
>
1
:
tmp
=
[]
flattened_list
=
[]
kk
=
[]
for
sb
in
box_res_rev
[
step
][
resid
][
res
]
.
keys
():
kk
.
append
(
sb
)
tmp
.
append
(
box_res_rev
[
step
][
resid
][
res
][
sb
])
#Remove keys
for
k
in
kk
:
box_res_rev
[
step
][
resid
][
res
]
.
pop
(
k
,
None
)
#flatten the lists
flattened_list
=
[
y
for
x
in
tmp
for
y
in
x
]
#Keep first key and results
box_res_rev
[
step
][
resid
][
res
][
kk
[
0
]]
=
flattened_list
#box_res_rev[step][resid][res]=[i for i, e in enumerate(box_res_rev[step][resid][res]) if e.strip() != .strip()]
bar
.
next
()
bar
.
finish
()
return
box_res
,
box_res_rev
def
sub_coord
(
box
,
data
,
res_num
=
[]):
"""
Use the box_res_rev from 'def atom2grid' and data from 'def fr_export'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment