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
c700a0a7
Commit
c700a0a7
authored
May 04, 2020
by
Stelios Karozis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Begin domain decomposition function
parent
5bdfa21b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
9 deletions
+72
-9
CHANGELOG
CHANGELOG
+11
-0
main.py
main.py
+3
-2
tooba_f.py
tooba_f.py
+58
-7
No files found.
CHANGELOG
View file @
c700a0a7
...
@@ -6,6 +6,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
...
@@ -6,6 +6,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [Unreleased]
## [0.0.2] - 2020-05-04
### Added
- debug trr frames export
- initial code fro domain decomposition function
### Changed
- None
### Removed
- None
## [0.0.1] - 2020-04-27
## [0.0.1] - 2020-04-27
### Added
### Added
- add gitignore
- add gitignore
...
...
main.py
View file @
c700a0a7
...
@@ -5,5 +5,6 @@ import tooba_f as tbf
...
@@ -5,5 +5,6 @@ import tooba_f as tbf
#print(tbf.angle_between3D(P1,P2))
#print(tbf.angle_between3D(P1,P2))
#tbf.last_fr_export(trajfile='traj.trr')
data_all
=
tbf
.
fr_export
(
trajfile
=
'traj.trr'
,
num_frames
=
10
)
tbf
.
read_gro
(
'initial.gro'
)
#system,data_num,box_size,res_num,res_type,atom_type,atom_num,rest_dt = tbf.read_gro('initial.gro')
\ No newline at end of file
tbf
.
domain_decomposition
(
data
=
data_all
,
dx
=-
1
,
dy
=-
1
,
dz
=-
1
)
\ No newline at end of file
tooba_f.py
View file @
c700a0a7
...
@@ -72,6 +72,11 @@ def plot_surf(data, normal, c):
...
@@ -72,6 +72,11 @@ def plot_surf(data, normal, c):
plt
.
show
()
plt
.
show
()
def
count_frames
(
trajfile
=
'traj.trr'
):
def
count_frames
(
trajfile
=
'traj.trr'
):
"""
Count total frames of .trr file
parameters: trajfile = [.trr]
"""
cnt_fr
=
0
cnt_fr
=
0
with
open
(
trajfile
,
'rb'
)
as
inputfile
:
with
open
(
trajfile
,
'rb'
)
as
inputfile
:
for
i
in
range
(
1000
):
for
i
in
range
(
1000
):
...
@@ -85,20 +90,45 @@ def count_frames(trajfile='traj.trr'):
...
@@ -85,20 +90,45 @@ def count_frames(trajfile='traj.trr'):
return
cnt_fr
return
cnt_fr
def
fr_export
(
trajfile
=
'traj.trr'
,
num_frames
=
1
):
def
fr_export
(
trajfile
=
'traj.trr'
,
num_frames
=
1
):
"""
Export frames from gromacs .trr file.
parameters: trajfile = [.trr]
num_frames = [number of frames to keep
counting from the end of file]
"""
cnt_fr
=
count_frames
(
trajfile
)
cnt_fr
=
count_frames
(
trajfile
)
data_all
=
{}
with
open
(
trajfile
,
'rb'
)
as
inputfile
:
with
open
(
trajfile
,
'rb'
)
as
inputfile
:
for
i
in
range
(
cnt_fr
-
num_frames
):
for
i
in
range
(
cnt_fr
-
num_frames
):
header
=
read_trr_header
(
inputfile
)
header
=
read_trr_header
(
inputfile
)
#print('Step: {step}, time: {time}'.format(**header))
#print('Step: {step}, time: {time}'.format(**header))
skip_trr_data
(
inputfile
,
header
)
skip_trr_data
(
inputfile
,
header
)
header
=
read_trr_header
(
inputfile
)
for
i
in
range
(
cnt_fr
-
num_frames
,
cnt_fr
):
print
(
'Step: {step}, time: {time}'
.
format
(
**
header
))
header
=
read_trr_header
(
inputfile
)
data
=
read_trr_data
(
inputfile
,
header
)
print
(
'Step: {step}, time: {time}'
.
format
(
**
header
))
print
(
data
.
keys
())
data
=
read_trr_data
(
inputfile
,
header
)
print
(
data
[
'box'
])
#print(data.keys())
print
(
data
[
'x'
][
0
])
#print(data['box'])
#print(data['x'][0])
step
=
'{step}'
.
format
(
**
header
)
data_all
[
step
]
=
data
return
data_all
def
read_gro
(
gro
):
def
read_gro
(
gro
):
"""
Read .gro file and exports
1. system name
2. data number
3. box size
4. residue number
5. residue type
6. atom type
7. atom number
8. free format data (x,y,z,v,u,w)
parameters: gro = [.gro]
"""
cnt
=
0
cnt
=
0
data_num
=
0
data_num
=
0
res_num
=
[]
res_num
=
[]
...
@@ -123,4 +153,25 @@ def read_gro(gro):
...
@@ -123,4 +153,25 @@ def read_gro(gro):
if
cnt
>
data_num
:
if
cnt
>
data_num
:
box_size
=
line
[:
50
]
box_size
=
line
[:
50
]
#print(system,data_num,box_size)
#print(system,data_num,box_size)
return
system
,
data_num
,
box_size
,
res_num
,
res_type
,
atom_type
,
atom_num
,
rest_dt
return
system
,
data_num
,
box_size
,
res_num
,
res_type
,
atom_type
,
atom_num
,
rest_dt
\ No newline at end of file
def
domain_decomposition
(
data
,
dx
,
dy
,
dz
):
"""
Identify residues that rely inside a subdomain
of a rectangular box
"""
print
(
'xs ys zs x y z'
)
for
step
in
data
.
keys
():
#print(data[step]['box'])
#data[step]['box'][row][element]
xs
=
data
[
step
][
'box'
][
0
][
0
]
ys
=
data
[
step
][
'box'
][
1
][
1
]
zs
=
data
[
step
][
'box'
][
2
][
2
]
#data[step]['x'][atom_num][x(0),y(1),z(3)]
x
=
data
[
step
][
'x'
][
0
][
0
]
y
=
data
[
step
][
'x'
][
0
][
1
]
z
=
data
[
step
][
'x'
][
0
][
2
]
print
(
xs
,
ys
,
zs
,
x
,
y
,
z
)
#Todo: identify points inside box that belong to same residue
#return
\ 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