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
1272fa88
Commit
1272fa88
authored
May 20, 2020
by
Stelios Karozis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New functions+debuging
parent
4d277115
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
222 additions
and
43 deletions
+222
-43
.gitignore
.gitignore
+3
-1
CHANGELOG
CHANGELOG
+12
-0
main.py
main.py
+51
-21
tooba_f.py
tooba_f.py
+156
-21
No files found.
.gitignore
View file @
1272fa88
...
@@ -9,3 +9,5 @@ __pycache__/
...
@@ -9,3 +9,5 @@ __pycache__/
*.trr
*.trr
*.gro
*.gro
*.code-workspace
*.code-workspace
*.itp
system/
\ No newline at end of file
CHANGELOG
View file @
1272fa88
...
@@ -6,6 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
...
@@ -6,6 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [Unreleased]
## [0.0.5] - 2020-05-20
### Added
- Add progress bar per function
- Save preprocessing arrays to pickles and read them if exist for speed up whole process
- new function to calculate surface per subdomain (different input)
### Changed
- debug atomid_data function
### Removed
- None
## [0.0.4] - 2020-05-19
## [0.0.4] - 2020-05-19
### Added
### Added
- code for print data in json and pickle format
- code for print data in json and pickle format
...
...
main.py
View file @
1272fa88
import
os
import
tooba_f
as
tbf
import
tooba_f
as
tbf
###################################################
###################################################
#NOTICE: resids of head in each subdomain may differ in tail case
#NOTICE: resids of head in each subdomain may differ in tail case
...
@@ -5,46 +6,75 @@ import tooba_f as tbf
...
@@ -5,46 +6,75 @@ import tooba_f as tbf
# in case of tail is the one closest to the head, hence
# in case of tail is the one closest to the head, hence
# the code is a good approximation
# the code is a good approximation
###################################################
###################################################
TRAJ
=
'traj.trr'
TRAJ
=
'
system/eq_
traj.trr'
NUM_FR
=
1
NUM_FR
=
1
GRO
=
'
initi
al.gro'
GRO
=
'
system/eq_fin
al.gro'
HEAD
=
True
HEAD
=
True
HD_GROUP
=
{
'
MMA'
:[
'C1'
,
'C2
'
]}
HD_GROUP
=
{
'
NS'
:[
'C6'
,
'Na'
,
'P4'
,
'P3'
,
'C7'
],
'CHOL'
:[
'ROH'
],
'FFA'
:[
'AC
'
]}
TAIL
=
False
TAIL
=
False
TL_GROUP
=
{
'
MMA'
:[
'C3'
,
'C4'
,
'C5
'
]}
TL_GROUP
=
{
'
NS'
:[
'C3'
,
'C4'
,
'C5'
,
'C8'
,
'C9'
,
'C10'
],
'CHOL'
:[
'R1'
,
'R2'
,
'R3'
,
'R4'
,
'R5'
],
'FFA'
:[
'C1'
,
'C2'
,
'C3'
,
'C4
'
]}
DISCET
=
[
1
,
1
,
1
]
DISCET
=
[
3
,
3
,
3
]
RES_NAME
=
'time_domain_c-normal-cg'
RES_NAME
=
'time_domain_c-normal-cg'
###################################################
###################################################
#Read .trr file
###################################################
data_all
=
tbf
.
fr_export
(
trajfile
=
TRAJ
,
num_frames
=
NUM_FR
)
print
(
' '
)
print
(
'================'
)
print
(
'Starting process'
)
print
(
'================'
)
###################################################
###################################################
#Read .gro file
#Read .gro file
_
,
data_num
,
_
,
res_num
,
res_type
,
atom_type
,
atom_num
,
_
=
tbf
.
read_gro
(
GRO
)
_
,
data_num
,
_
,
res_num
,
res_type
,
atom_type
,
atom_num
,
_
=
tbf
.
read_gro
(
GRO
)
#Create subdomains coordinates
print
(
' '
)
box_p
=
tbf
.
domain_decomposition
(
data
=
data_all
,
dx
=
DISCET
[
0
],
dy
=
DISCET
[
1
],
dz
=
DISCET
[
2
])
###################################################
if
os
.
path
.
isfile
(
'./data.pkl'
):
print
(
'WARNING: Preprocessing files exist.'
)
print
(
' Erase data.pkl if the system is new.'
)
print
(
'--------------------------------------------'
)
data_all
=
tbf
.
frompickle
(
'./data.pkl'
)
else
:
#Read .trr file
data_all
=
tbf
.
fr_export
(
trajfile
=
TRAJ
,
num_frames
=
NUM_FR
)
tbf
.
topickle
(
fl
=
data_all
,
sv_name
=
'data'
)
###################################################
###################################################
if
HEAD
==
True
:
if
HEAD
==
True
:
if
os
.
path
.
isfile
(
'./ndx_HEAD.pkl'
):
print
(
'WARNING: Preprocessing files exist.'
)
print
(
' Erase ndx_HEAD.pkl if the system is new.'
)
print
(
'--------------------------------------------'
)
group_ndx
=
tbf
.
frompickle
(
'./ndx_HEAD.pkl'
)
else
:
#Find atom type index in lists created above
#Find atom type index in lists created above
group_ndx
=
tbf
.
atomid_data
(
res_num
,
atom_type
,
atom_num
,
group
=
HD_GROUP
)
group_ndx
=
tbf
.
atomid_data
(
res_num
,
res_type
,
atom_type
,
atom_num
,
group
=
HD_GROUP
)
tbf
.
topickle
(
fl
=
group_ndx
,
sv_name
=
'ndx_HEAD'
)
###################################################
if
os
.
path
.
isfile
(
'./box.pkl'
):
print
(
'WARNING: Preprocessing files exist.'
)
print
(
' Erase box.pkl if the system is new'
)
print
(
' or new grid is applied !'
)
print
(
'--------------------------------------------'
)
box_res
=
tbf
.
frompickle
(
'./box.pkl'
)
else
:
#Create subdomains coordinates
box_p
=
tbf
.
domain_decomposition
(
data
=
data_all
,
dx
=
DISCET
[
0
],
dy
=
DISCET
[
1
],
dz
=
DISCET
[
2
])
#Assign desired atoms (from above function) to subdomains
#Assign desired atoms (from above function) to subdomains
##result1: {step:{res:{atom_type:{atom_num:(subX,subYsubZ)}}}}
##result1: {step:{res:{atom_type:{atom_num:(subX,subYsubZ)}}}}
##result2: {step:{res:{atom_type:{(subX,subYsubZ):[atom_num]}}}}
##result2: {step:{res:{atom_type:{(subX,subYsubZ):[atom_num]}}}}
_
,
box_res
=
tbf
.
atom2grid
(
data_all
,
box_p
,
group_ndx
)
_
,
box_res
=
tbf
.
atom2grid
(
data_all
,
box_p
,
group_ndx
)
tbf
.
topickle
(
fl
=
box_res
,
sv_name
=
'box'
)
###################################################
###################################################
if
HEAD
==
True
:
#Creates dictionary with coordinates per subdomain for each frame
#Creates dictionary with coordinates per subdomain for each frame
coord_norm
,
_
=
tbf
.
sub_coord
(
box
=
box_res
,
data
=
data_all
,
res_num
=
res_num
)
coord_norm
,
coord_vector
=
tbf
.
sub_coord
(
box
=
box_res
,
data
=
data_all
,
res_num
=
res_num
)
#Creates dictionary with c, normal per subdomain for each frame
#Creates dictionary with c, normal per subdomain for each frame
surf
=
tbf
.
coord2norm
(
coord_norm
,
img
=
True
)
surf
=
tbf
.
coord2norm2cg
(
coord_vector
,
img
=
True
)
print
(
surf
)
exit
()
tbf
.
topickle
(
fl
=
surf
,
sv_name
=
RES_NAME
)
tbf
.
topickle
(
fl
=
surf
,
sv_name
=
RES_NAME
)
tbf
.
tojson
(
fl
=
surf
,
sv_name
=
RES_NAME
)
tbf
.
tojson
(
fl
=
surf
,
sv_name
=
RES_NAME
)
###################################################
###################################################
if
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
=
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]}}}}
_
,
box_res
=
tbf
.
atom2grid
(
data_all
,
box_p
,
group_ndx
)
#Creates dictionary with coordinates per subdomain for each frame
#Creates dictionary with coordinates per subdomain for each frame
_
,
coord_vector
=
tbf
.
sub_coord
(
box
=
box_res
,
data
=
data_all
,
res_num
=
res_num
)
_
,
coord_vector
=
tbf
.
sub_coord
(
box
=
box_res
,
data
=
data_all
,
res_num
=
res_num
)
vector
=
tbf
.
coord2vector
(
coord_vector
)
vector
=
tbf
.
coord2vector
(
coord_vector
)
...
...
tooba_f.py
View file @
1272fa88
This diff is collapsed.
Click to expand it.
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