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
cec97309
Commit
cec97309
authored
May 14, 2020
by
Stelios Karozis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrections
parent
592ec4e6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
18 deletions
+49
-18
CHANGELOG
CHANGELOG
+2
-0
main.py
main.py
+21
-13
tooba_f.py
tooba_f.py
+26
-5
No files found.
CHANGELOG
View file @
cec97309
...
...
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- code for assign coordinates to subdomain
- code for creating vectors for each tail of lipid in subdomain
- code for creating surface for heads of lipids in subdomain
- code for calculating the angle between surface and vectors for every step, sudomain and resid
- clean main.py
### Changed
- change output in def atomid_data() to include resid
...
...
main.py
View file @
cec97309
import
tooba_f
as
tbf
#P1=(0,1,0)
#P2=(1,1,0)
#print(tbf.angle_between3D(P1,P2))
###################################################
#NOTICE: resids of head in each subdomain may differ in tail case
# keep all atoms of group in the first occurent subdomain
# in case of tail is the one closest to the head, hence
# the code is a good approximation
###################################################
TRAJ
=
'traj.trr'
NUM_FR
=
1
GRO
=
'initial.gro'
HEAD
=
True
HD_GROUP
=
{
'MMA'
:[
'C1'
,
'C2'
]}
TAIL
=
True
TL_GROUP
=
{
'MMA'
:[
'C3'
,
'C4'
,
'C5'
]}
###################################################
#Read .trr file
data_all
=
tbf
.
fr_export
(
trajfile
=
'traj.trr'
,
num_frames
=
1
)
data_all
=
tbf
.
fr_export
(
trajfile
=
TRAJ
,
num_frames
=
NUM_FR
)
#Read .gro file
_
,
data_num
,
_
,
res_num
,
res_type
,
atom_type
,
atom_num
,
_
=
tbf
.
read_gro
(
'initial.gro'
)
_
,
data_num
,
_
,
res_num
,
res_type
,
atom_type
,
atom_num
,
_
=
tbf
.
read_gro
(
GRO
)
#Create subdomains coordinates
box_p
=
tbf
.
domain_decomposition
(
data
=
data_all
,
dx
=
2
,
dy
=
2
,
dz
=
2
)
###################################################
HEAD
=
False
if
HEAD
==
True
:
#Find atom type index in lists created above
group_ndx
=
tbf
.
atomid_data
(
res_num
,
atom_type
,
atom_num
,
group
=
{
'MMA'
:[
'C1'
,
'C2'
]}
)
group_ndx
=
tbf
.
atomid_data
(
res_num
,
atom_type
,
atom_num
,
group
=
HD_GROUP
)
#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]}}}}
...
...
@@ -24,12 +32,10 @@ if HEAD==True:
coord_norm
,
_
=
tbf
.
sub_coord
(
box
=
box_res
,
data
=
data_all
,
res_num
=
res_num
)
#Creates dictionary with c, normal per subdomain for each frame
surf
=
tbf
.
coord2norm
(
coord_norm
,
img
=
True
)
###################################################
TAIL
=
True
if
TAIL
==
True
:
#Find atom type index in lists created above
group_ndx
=
tbf
.
atomid_data
(
res_num
,
atom_type
,
atom_num
,
group
=
{
'MMA'
:[
'C3'
,
'C4'
,
'C5'
]}
)
group_ndx
=
tbf
.
atomid_data
(
res_num
,
atom_type
,
atom_num
,
group
=
TL_GROUP
)
#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]}}}}
...
...
@@ -37,3 +43,5 @@ if TAIL==True:
#Creates dictionary with coordinates per subdomain for each frame
_
,
coord_vector
=
tbf
.
sub_coord
(
box
=
box_res
,
data
=
data_all
,
res_num
=
res_num
)
vector
=
tbf
.
coord2vector
(
coord_vector
)
###################################################
tbf
.
SurfVector_angle
(
surf
,
vector
)
\ No newline at end of file
tooba_f.py
View file @
cec97309
...
...
@@ -404,10 +404,9 @@ def coord2vector(coord_vector):
Use the coord_vector from 'def sub_coord' and replaces XYZ coordinates
with vector of best fit line
parameters: coord = {step:{subdomain:array[[X1,Y1,Z1] ... [Xn,Yn,Zn]]}}
img = True or False
parameters: coord = {step:{subdomain:{resid:[[X1,Y1,Z1] ... [Xn,Yn,Zn]]}}
output: dictionary = {step:{subdomain:
[x, y, z]
}
output: dictionary = {step:{subdomain:
{resid:[x, y, z]}
}
"""
vector
=
{}
for
step
in
coord_vector
.
keys
():
...
...
@@ -418,3 +417,25 @@ def coord2vector(coord_vector):
vv
=
points2vector
(
np
.
array
(
coord_vector
[
step
][
subdomain
][
resid
]))
vector
[
step
][
subdomain
][
resid
]
=
vv
return
vector
def
SurfVector_angle
(
surf
,
vector
):
"""
Use the surf and vector from 'def coord2norm' and 'def coord2vector'
and calculate the angle between them for every step, sudomain and resid
parameters: surf = {step:{subdomain:{c:int, normal:array[]}}}
vector = {step:{subdomain:{resid:[x, y, z]}}
output: angle = {step:{subdomain:{resid:angle}}
"""
angle
=
{}
for
step
in
surf
.
keys
():
angle
[
step
]
=
{}
for
sudomain
in
surf
[
step
]
.
keys
():
angle
[
step
][
sudomain
]
=
{}
for
resid
in
vector
[
step
][
sudomain
]
.
keys
():
P1
=
tuple
(
surf
[
step
][
sudomain
][
'normal'
])
P2
=
tuple
(
vector
[
step
][
sudomain
][
resid
])
#print(tbf.angle_between3D(P1,P2))
angle
[
step
][
sudomain
][
resid
]
=
angle_between3D
(
P1
,
P2
)
return
angle
\ No newline at end of file
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