Skip to content

Commit

Permalink
Add bpall file
Browse files Browse the repository at this point in the history
  • Loading branch information
naotohori committed Sep 12, 2021
1 parent d1cfb16 commit 90ab5e2
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 16 deletions.
2 changes: 1 addition & 1 deletion input.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type = "DCD"
fasta = "./beta-globin.fasta"

[files.out]
types = ["bp", "bpe"]
types = ["bp", "bpe", "bpall"]
prefix = "./test"

[condition]
Expand Down
21 changes: 18 additions & 3 deletions src/energy_bp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ subroutine energy_bp(Ebp)
use const_phys, only : ZERO_JUDGE
use var_state, only : xyz, kT
use var_potential
use var_io, only : flg_out_bp, flg_out_bpe, hdl_bp, hdl_bpe, KIND_OUT_BP, KIND_OUT_BPE
use var_io, only : flg_out_bp, flg_out_bpall, flg_out_bpe, hdl_bp, hdl_bpall, hdl_bpe, KIND_OUT_BP, KIND_OUT_BPE

implicit none

Expand Down Expand Up @@ -64,15 +64,30 @@ subroutine energy_bp(Ebp)
if (e_bp(ibp) < - nhb * kT) then
imp = bp_mp(1, ibp)
jmp = bp_mp(2, ibp)
!write(hdl_bp) int(imp,kind=KIND_OUT_BP), int(jmp,kind=KIND_OUT_BP)
write(hdl_bp) int(imp,kind=KIND_OUT_BP), int(jmp,kind=KIND_OUT_BP), real(e_bp(ibp), kind=KIND_OUT_BPE)
endif
enddo

!write(hdl_bp) int(0,kind=KIND_OUT_BP)
write(hdl_bp) int(0,kind=KIND_OUT_BP), int(0,kind=KIND_OUT_BP), real(0.0, kind=KIND_OUT_BPE)
endif

if (flg_out_bpall) then

do ibp = 1, nbp

nhb = bp_mp(3, ibp)

if (e_bp(ibp) < -ZERO_JUDGE) then ! To output all
imp = bp_mp(1, ibp)
jmp = bp_mp(2, ibp)
write(hdl_bpall) int(imp,kind=KIND_OUT_BP), int(jmp,kind=KIND_OUT_BP), real(e_bp(ibp), kind=KIND_OUT_BPE)
endif
enddo

write(hdl_bpall) int(0,kind=KIND_OUT_BP), int(0,kind=KIND_OUT_BP), real(0.0, kind=KIND_OUT_BPE)
endif


if (flg_out_bpe) then

do ibp = 1, nbp
Expand Down
2 changes: 1 addition & 1 deletion src/force_bp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ subroutine force_bp()
use const_phys, only : ZERO_JUDGE
use var_state, only : xyz, kT, forces
use var_potential
use var_io, only : flg_out_bp, flg_out_bpe, hdl_bp, hdl_bpe, KIND_OUT_BP
use var_io, only : flg_out_bp, flg_out_bpe, KIND_OUT_BP

implicit none

Expand Down
20 changes: 15 additions & 5 deletions src/main.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ program sis
use const_idx, only : ENE, SEQT, JOBT, seqt2char
use var_top, only : nmp, nchains, nmp_chain, seq, imp_chain, pbc_box, pbc_box_half, flg_pbc, ichain_mp, nrepeat
use var_state, only : xyz, tempK, kT, job
use var_io, only : flg_out_bp, flg_out_bpe, hdl_out, hdl_bp, hdl_bpe, KIND_OUT_BP, KIND_OUT_BPE, &
cfile_ff, cfile_dcd_in, cfile_prefix, cfile_out, cfile_bp, cfile_fasta_in
use var_io, only : flg_out_bp, flg_out_bpall, flg_out_bpe, hdl_out, hdl_bp, hdl_bpall, hdl_bpe, KIND_OUT_BP, KIND_OUT_BPE, &
cfile_ff, cfile_dcd_in, cfile_prefix, cfile_out, cfile_fasta_in
!$ use omp_lib

implicit none

character(CHAR_FILE_PATH) cfile_inp
character(CHAR_FILE_PATH) :: cfile_inp, cfile_bp

integer :: i, j, k, imp
integer :: nthreads
Expand Down Expand Up @@ -63,8 +63,11 @@ program sis
stop (2)
end if

write(*,*) 'Read force-field file: '//cfile_ff
call read_force_field(cfile_ff)
!! Load force field
write(*,*) 'Read force-field file: '//trim(cfile_ff)
call read_force_field(trim(cfile_ff))

!! Output files
cfile_out = trim(cfile_prefix) // '.out'

if (flg_out_bp) then
Expand All @@ -74,6 +77,13 @@ program sis
write(hdl_bp) int(KIND_OUT_BPE,kind=4)
endif

if (flg_out_bpall) then
cfile_bp = trim(cfile_prefix) // '.bpall'
open(hdl_bpall, file=cfile_bp, status='replace', action='write', form='unformatted',access='stream')
write(hdl_bpall) int(KIND_OUT_BP,kind=4)
write(hdl_bpall) int(KIND_OUT_BPE,kind=4)
endif

if (flg_out_bpe) then
cfile_bp = trim(cfile_prefix) // '.bpe'
open(hdl_bpe, file=cfile_bp, status='replace', action='write', form='formatted')
Expand Down
3 changes: 3 additions & 0 deletions src/read_fasta.F90
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,8 @@ subroutine read_fasta()
endif

enddo

close(hdl)
iopen_hdl = iopen_hdl - 1

end subroutine read_fasta
6 changes: 3 additions & 3 deletions src/read_force_field.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ subroutine read_force_field(cfilepath)

integer :: hdl

iopen_hdl = iopen_hdl + 1
hdl = iopen_hdl

bond_k = INVALID_VALUE
bond_r0 = INVALID_VALUE
angl_k = INVALID_VALUE
Expand All @@ -34,6 +31,9 @@ subroutine read_force_field(cfilepath)
Ubp_dihd_phi2 = INVALID_VALUE
Ubp_min_loop = -1

iopen_hdl = iopen_hdl + 1
hdl = iopen_hdl

open(hdl, file=cfilepath, status='old', action='read', iostat=istat)

do
Expand Down
7 changes: 6 additions & 1 deletion src/read_input.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ subroutine read_input(cfilepath, stat)
use const_phys
use const_idx
use var_io, only : iopen_hdl, &
flg_out_bp, flg_out_bpe, &
flg_out_bp, flg_out_bpe, flg_out_bpall, &
cfile_ff, cfile_dcd_in, &
cfile_prefix, cfile_pdb_ini, cfile_fasta_in
use var_state, only : job, tempK
Expand Down Expand Up @@ -59,6 +59,9 @@ subroutine read_input(cfilepath, stat)
else if (cline == 'CHECK_FORCE') then
job = JOBT%CHECK_FORCE

else if (cline == 'MD') then
job = JOBT%MD

else
write(*,*) 'Unknown job type: '//trim(cline)
stat = .False.
Expand Down Expand Up @@ -110,6 +113,8 @@ subroutine read_input(cfilepath, stat)

if (cline == "bp") then
flg_out_bp = .True.
else if (cline == "bpall") then
flg_out_bpall = .True.
else if (cline == "bpe") then
flg_out_bpe = .True.
else
Expand Down
3 changes: 3 additions & 0 deletions src/read_pdb.F90
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,7 @@ subroutine read_pdb(cfilepath, nmp, xyz)
!nmp = imp
!nres = ires

close(hdl)
iopen_hdl = iopen_hdl - 1

end subroutine read_pdb
5 changes: 3 additions & 2 deletions src/var_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ module var_io
use const

logical, save :: flg_out_bp = .False.
logical, save :: flg_out_bpall = .False.
logical, save :: flg_out_bpe = .False.
integer, parameter :: KIND_OUT_BP = 2 ! Defines the format of bp output file.
integer, parameter :: KIND_OUT_BPE = 4 ! Defines the format of bp output file.

integer, parameter :: hdl_dcd = 20
integer, parameter :: hdl_out = 21
integer, parameter :: hdl_bp = 22
integer, parameter :: hdl_bpe = 23
integer, parameter :: hdl_bpall = 23
integer, parameter :: hdl_bpe = 24

integer, save :: iopen_hdl = 30

character(CHAR_FILE_PATH), save :: cfile_out
character(CHAR_FILE_PATH), save :: cfile_bp
character(len=:), allocatable, save :: cfile_ff, cfile_prefix, cfile_dcd_in, cfile_pdb_ini, cfile_fasta_in

end module var_io

0 comments on commit 90ab5e2

Please sign in to comment.