Commit 5bdfa21b authored by Stelios Karozis's avatar Stelios Karozis

Debugging read_gro

parent 377a23f2
......@@ -6,4 +6,4 @@ import tooba_f as tbf
#tbf.last_fr_export(trajfile='traj.trr')
tbf.read_gro_types('initial.gro')
\ No newline at end of file
tbf.read_gro('initial.gro')
\ No newline at end of file
......@@ -98,24 +98,29 @@ def fr_export(trajfile='traj.trr', num_frames=1):
print(data['box'])
print(data['x'][0])
def read_gro_types(gro):
def read_gro(gro):
cnt=0
data_num=0
res_num = []
res_type = []
atom_type = []
atom_num = []
rest_dt = []
with open(gro, 'r') as F:
for line in F:
cnt=cnt+1
print(cnt)
if cnt>2:
res_num = line[:5]
res_type = line[5:10]
atom_type = line[10:15]
atom_num = line[15:20]
rest_dt = line[20:]
print(res_num,res_type,atom_type,atom_num,rest_dt)
res_num.append(line[:5])
res_type.append(line[5:10])
atom_type.append(line[10:15])
atom_num.append(line[15:20])
rest_dt.append(line[20:])
elif cnt==1:
system=line[:10]
elif cnt==2:
data_num=int(line[:7])
if cnt>data_num:
box_size=line[:50]
print(system,data_num,box_size)
\ No newline at end of file
#print(system,data_num,box_size)
return system,data_num,box_size,res_num,res_type,atom_type,atom_num,rest_dt
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment