If it is not too late here is the python code for extracting coordinate files from molecular dynamics simulation containing 32 atoms:
the program opens log file mpirunlogtrim.txt
and outputs coordinates to mpirunlogtrim.xyz frame by frame readable in VMD
%----------------------------------------------
from numpy import *
import numpy as np
file = open('./mpirunlogtrim.txt');
elems=0;
fctr=0;
elctr=0;
data = file.readlines();
file.close();
elems=32;
elem=[]*elems;
- read elements list
for n in range(0,elems):
elem[n]=data[n+2].rsplit()[1];
print elem[n]
incr=0;
filew=open('./mpirunlogtrim.xyz','w');
readnext=1;
pos=2;
while readnext:
filew.write(str(elems)+'\n');
filew.write('Dynamics at 500 K'+'\n');
for n in range(0,elems):
list_of_el=list(data[n+pos].rsplit());
filew.write(.join(format(el,'<15') for el in list_of_el[1:5])+'\n');
incr+=1;
pos+=elems+31;
if pos+1>len(data):
readnext=0;
filew.close();
%---------------------------------------------------------
|