Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102860489
gbms_Cabpj_input.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Feb 24, 22:59
Size
2 KB
Mime Type
text/x-python
Expires
Wed, Feb 26, 22:59 (2 d)
Engine
blob
Format
Raw Data
Handle
24444132
Attached To
rCOSOLVER COSOlver
gbms_Cabpj_input.py
View Options
#!/usr/bin/env python
# generates *.h5 files as input for molix
import
os
import
sys
import
h5py
as
h5
# Define directories
cwd
=
os
.
getcwd
()
cwd
=
'/misc/bjfrei/cosolver_marconi'
# Where to find the cosolver *.h5 files
cosolver_dir
=
os
.
path
.
join
(
cwd
,
'dk.coulomb.ab.P32J16'
)
# Define size of matrices (all matrices are assumed to have the same size)
Pmaxi
=
32
Jmaxi
=
16
Pmaxe
=
32
Jmaxe
=
16
# Define h5 files to gather
eicolls_file
=
os
.
path
.
join
(
cwd
,
cosolver_dir
,
'ei.h5'
)
iecolls_file
=
os
.
path
.
join
(
cwd
,
cosolver_dir
,
'ie.h5'
)
selfcolls_file
=
os
.
path
.
join
(
cwd
,
cosolver_dir
,
'self.h5'
)
# Define output filename
outputfilename
=
os
.
path
.
join
(
cosolver_dir
,
'coulomb.P32J16.h5'
)
# Open the h5 files in read mode
eih5
=
h5
.
File
(
eicolls_file
,
'r'
)
ieh5
=
h5
.
File
(
iecolls_file
,
'r'
)
selfh5
=
h5
.
File
(
selfcolls_file
,
'r'
)
# Create ouput file
outh5
=
h5
.
File
(
outputfilename
,
'w'
)
# Flush ei/ie/self collisions to output h5 file
dst_CeipjF
=
outh5
.
create_dataset
(
"/00000/Ceipj/CeipjF"
,
data
=
eih5
[
'/Ceipj/CeipjF'
])
dst_CeipjF
.
attrs
[
'Pmaxe'
]
=
Pmaxe
dst_CeipjF
.
attrs
[
'Jmaxe'
]
=
Jmaxe
dst_CeipjT
=
outh5
.
create_dataset
(
"/00000/Ceipj/CeipjT"
,
data
=
eih5
[
'/Ceipj/CeipjT'
])
dst_CeipjT
.
attrs
[
'Jmaxe'
]
=
Jmaxe
dst_CeipjT
.
attrs
[
'Pmaxe'
]
=
Pmaxe
outh5
.
create_dataset
(
"/00000/Ceipj/fort.f90"
,
data
=
eih5
[
'/files/fort.f90'
])
dst_CiepjF
=
outh5
.
create_dataset
(
"/00000/Ciepj/CiepjF"
,
data
=
ieh5
[
'/Ciepj/CiepjF'
])
dst_CiepjF
.
attrs
[
'Pmaxi'
]
=
Pmaxi
dst_CiepjF
.
attrs
[
'Jmaxi'
]
=
Jmaxi
dst_CiepjT
=
outh5
.
create_dataset
(
"/00000/Ciepj/CiepjT"
,
data
=
ieh5
[
'/Ciepj/CiepjT'
])
dst_CiepjT
.
attrs
[
'Pmaxi'
]
=
Pmaxi
dst_CiepjT
.
attrs
[
'Jmaxi'
]
=
Jmaxi
outh5
.
create_dataset
(
"/00000/Ciepj/fort.f90"
,
data
=
ieh5
[
'/files/fort.f90'
])
dst_Cii
=
outh5
.
create_dataset
(
"/00000/Ciipj"
,
data
=
selfh5
[
'/Caapj/Ciipj'
])
dst_Cii
.
attrs
[
'Pmaxi'
]
=
Pmaxi
dst_Cii
.
attrs
[
'Jmaxi'
]
=
Jmaxi
dst_Cee
=
outh5
.
create_dataset
(
"/00000/Ceepj"
,
data
=
selfh5
[
'/Caapj/Ciipj'
])
dst_Cee
.
attrs
[
'Pmaxe'
]
=
Pmaxe
dst_Cee
.
attrs
[
'Jmaxe'
]
=
Jmaxe
outh5
.
create_dataset
(
"/00000/Caapj/fort.f90"
,
data
=
selfh5
[
'/files/fort.f90'
])
# outh5.create_dataset("/dims_i", data = [Pmaxi, Jmaxi])
# outh5.create_dataset("/dims_e", data = [Pmaxe, Jmaxe])
# Set to 0 for DK collision operators
outh5
.
create_dataset
(
"/coordkperp"
,
data
=
[
0
])
# Close file
outh5
.
close
()
Event Timeline
Log In to Comment