- #1
gluons
- 15
- 0
I am writing a code to calculate and to operations with a large set of matrix elements, indexed by four numbers.
I am also writing these subroutines within a much larger code structure, so I do not have total freedom to modify the objects I am using.
I am trying something like this, which compiles but crashes. I am not sure if it would do what I want though, even if it didn't crash.
What is the best way to write operations like this? How can I most efficiently store the arrays and recall them?
inquire(iolength=recl) overlap
open(10,file='OVERLAPS.OUT',action='WRITE',form='UNFORMATTED',access='DIRECT',recl=recl)
do ikloc=1,nkptnrloc
ik=mpi_grid_map(nkpt,dim_k,loc=ikloc)
write(10,rec=ik) overlap(:,:,:,ikloc)
enddo
close(10)
inquire(iolength=recl) overlap
open(10,file='OVERLAPS.OUT',action='WRITE',form='UNFORMATTED',access='DIRECT',recl=recl)
do ikloc=1,nkptnrloc
ik=mpi_grid_map(nkpt,dim_k,loc=ikloc)
write(10,rec=ik) overlap(:,:,:,ikloc)
enddo
close(10)
I am also writing these subroutines within a much larger code structure, so I do not have total freedom to modify the objects I am using.
I am trying something like this, which compiles but crashes. I am not sure if it would do what I want though, even if it didn't crash.
What is the best way to write operations like this? How can I most efficiently store the arrays and recall them?
inquire(iolength=recl) overlap
open(10,file='OVERLAPS.OUT',action='WRITE',form='UNFORMATTED',access='DIRECT',recl=recl)
do ikloc=1,nkptnrloc
ik=mpi_grid_map(nkpt,dim_k,loc=ikloc)
write(10,rec=ik) overlap(:,:,:,ikloc)
enddo
close(10)
inquire(iolength=recl) overlap
open(10,file='OVERLAPS.OUT',action='WRITE',form='UNFORMATTED',access='DIRECT',recl=recl)
do ikloc=1,nkptnrloc
ik=mpi_grid_map(nkpt,dim_k,loc=ikloc)
write(10,rec=ik) overlap(:,:,:,ikloc)
enddo
close(10)