예제 #1
0
header = dcd.get_header()
#header.istart = header.nstep_save * (frame_begin - 1)
#header.istart = header.istart + header.nstep_save * frame_begin
#header.nset = int(frame_num / frame_stride)
#header.nset = int((frame_end-frame_begin)/frame_stride) + 1
#header.nstep = header.nstep_save * (frame_num - 1)
#header.nstep_save = header.nstep_save * frame_stride

# Open DCD and read the header
dcd_out = DcdFile(sys.argv[-1])
dcd_out.open_to_write()
dcd_out.set_header(header)
dcd_out.write_header()

# Open TS and read the header
ts = TsFile(sys.argv[2])
ts.open_to_read()
ts.read_header()

# read and write
#imodel = 0
#i_org = 0
while dcd.has_more_data():
    if not ts.has_more_data():
        print('Not enough data in .ts file (1)')
        sys.exit(2)

    tsdata, lines = ts.read_onestep()

    # skip step=1
    if tsdata[0][ts.head_col.step] == 1:
예제 #2
0
if __name__ == '__main__':
    if len(sys.argv) < 5:
        print('Usage: %SCRIPT [input Dir] [name] [final ID] [output DIR]')
        print('       ID shoule be from 0 to final ID.')
        sys.exit(2)

    dir_in = sys.argv[1]
    name = sys.argv[2]
    id_end = int(sys.argv[3])
    dir_out = sys.argv[-1]

    out_ts_files = []
    out_dcd_files = []
    #Prepare output files
    for id_rep in range(1, id_end + 1):
        ts = TsFile('%s/%s_%04i.ts' % (dir_out, name, id_rep))
        ts.open_to_write()
        out_ts_files.append(ts)

        dcd = DcdFile('%s/%s_%04i.dcd' % (dir_out, name, id_rep))
        dcd.open_to_write()
        out_dcd_files.append(dcd)

    in_ts_files = []
    in_dcd_files = []
    #Open input files
    for id_rep in range(1, id_end + 1):
        idx = id_rep - 1

        ts = TsFile('%s/%s_%04i.ts' % (dir_in, name, id_rep))
        ts.open_to_read()
        print('Usage: %SCRIPT [input Dir] [name] [final ID] [output DIR]')
        print('       ID shoule be from 0 to final ID.')
        sys.exit(2)

    dir_in = sys.argv[1]
    name = sys.argv[2]
    id_end = int(sys.argv[3])
    dir_out = sys.argv[-1]

    #Open input files
    in_ts_files = []
    in_dcd_files = []
    for id_rep in range(1, id_end + 1):
        idx = id_rep - 1

        ts = TsFile('%s/%s_%04i.ts' % (dir_in, name, id_rep))
        ts.open_to_read()
        ts.read_header()
        in_ts_files.append(ts)

        dcd = DcdFile('%s/%s_%04i.dcd' % (dir_in, name, id_rep))
        dcd.open_to_read()
        dcd.read_header()
        in_dcd_files.append(dcd)

    # Loop for output label
    for id_lab in range(1, id_end + 1):
        #Prepare output files
        tsout = TsFile('%s/%s_%04i.ts' % (dir_out, name, id_lab))
        tsout.open_to_write()
if __name__ == '__main__':
    if len(sys.argv) < 5:
        print('Usage: %SCRIPT [input Dir] [name] [final ID] [output DIR]')
        print('       ID shoule be from 1 to final ID.')
        sys.exit(2)

    dir_in = sys.argv[1]
    name = sys.argv[2]
    id_end = int(sys.argv[3])
    dir_out = sys.argv[-1]

    #Open input files
    in_ts_files = []
    in_dcd_files = []
    for id_rep in range(1, id_end + 1):
        ts = TsFile('%s/%s_%04i.ts' % (dir_in, name, id_rep))
        ts.open_to_read()
        #ts.read_header()   ## Commented out since the header will be read later
        in_ts_files.append(ts)

        dcd = DcdFile('%s/%s_%04i.dcd' % (dir_in, name, id_rep))
        dcd.open_to_read()
        #dcd.read_header()  ## Commented out since the header will be read later
        in_dcd_files.append(dcd)

    id_finish = 0
    while id_finish < id_end:

        id_begin_now = id_finish + 1
        id_end_now = id_finish + NUM_OUTFILE_OPEN
        if id_end_now > id_end:
예제 #5
0
import sys
from cafysis.file_io.dcd import DcdFile
from cafysis.file_io.ts import TsFile

if __name__ == '__main__':
    if len(sys.argv) < 5:
        print('Usage: % SCRIPT [name] [Dir 1] [Dir 2] ([Dir 3] ...) [output dir]')
        sys.exit(2)
    
    name = sys.argv[1]
    dirs = sys.argv[2:-1]
    dir_out = sys.argv[-1]

    # Prepare output files
    out_ts = TsFile( '%s/%s.ts' % (dir_out, name) )
    out_ts.open_to_write()

    out_dcd = DcdFile( '%s/%s.dcd' % (dir_out, name) )
    out_dcd.open_to_write()

    nstep_total_ts = 0
    nstep_total_dcd = 0
    for (i_dir, d) in enumerate(dirs):
        in_ts = TsFile( '%s/%s.ts' % (d, name) )
        in_ts.open_to_read()
        in_ts.read_header()
    
        in_dcd = DcdFile( '%s/%s.dcd' % (d, name) )
        in_dcd.open_to_read()
        in_dcd.read_header()
예제 #6
0
    nframe_skip = int(sys.argv[2])
    nframe_end = int(sys.argv[3])
    E_CUTOFF = float(sys.argv[4])
    print("# calculated by ts_calc_cv.py")
    print("# Search query: {:s}".format(sys.argv[1]))
    print("# nframe_skip: {:d}".format(nframe_skip))
    print("# nframe_end: {:d}".format(nframe_end))
    print("# E_CUTOFF: {:f}".format(E_CUTOFF))

    Ts = []
    e_sq = {}
    e = {}
    n = {}

    for tsfile in glob.glob(sys.argv[1]):
        ts = TsFile(tsfile)
        ts.open_to_read()
        ts.read_header()

        iframe = 0
        while ts.has_more_data():

            tsdata, tslines = ts.read_onestep()
            iframe += 1
            if iframe <= nframe_skip:
                continue
            if iframe > nframe_end:
                break

            T = float(tsdata[0][ts.head_col.temp])
            etot = float(tsdata[0][ts.head_col.e_tot])