git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@3982 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2010-04-13 14:37:44 +00:00
parent f68adcfe2b
commit 4ccbe81e93
2 changed files with 40 additions and 24 deletions

View File

@ -29,21 +29,26 @@ end
i=1; i=1;
while feof(dump) == 0 while feof(dump) == 0
id = fgetl(dump); id = fgetl(dump);
switch id if (strcmpi(id,'ITEM: TIMESTEP'))
case 'ITEM: TIMESTEP'
timestep(i) = str2num(fgetl(dump)); timestep(i) = str2num(fgetl(dump));
case 'ITEM: NUMBER OF ATOMS' else
if (strcmpi(id,'ITEM: NUMBER OF ATOMS'))
Natoms(i) = str2num(fgetl(dump)); Natoms(i) = str2num(fgetl(dump));
case 'ITEM: BOX BOUNDS' else
if (strcmpi(id,'ITEM: BOX BOUNDS'))
x_bound(i,:) = str2num(fgetl(dump)); x_bound(i,:) = str2num(fgetl(dump));
y_bound(i,:) = str2num(fgetl(dump)); y_bound(i,:) = str2num(fgetl(dump));
z_bound(i,:) = str2num(fgetl(dump)); z_bound(i,:) = str2num(fgetl(dump));
case 'ITEM: ATOMS' else
if (strcmpi(id(1:11),'ITEM: ATOMS'))
for j = 1 : 1: Natoms for j = 1 : 1: Natoms
atom_data(j,:,i) = str2num(fgetl(dump)); atom_data(j,:,i) = str2num(fgetl(dump));
end end
i=i+1; i=i+1;
end end
end
end
end
end end
%----------Outputs------------- %----------Outputs-------------
%OUTPUTS IN SAME VARIABLE STRUCTURE %OUTPUTS IN SAME VARIABLE STRUCTURE

View File

@ -46,25 +46,30 @@ else
end end
while done == 0 & last_status == 0 while done == 0 & last_status == 0
id = fgetl(dump); id = fgetl(dump);
switch id if (strcmpi(id,'ITEM: TIMESTEP'))
case 'ITEM: TIMESTEP'
if t == 0 if t == 0
timestep(i) = str2num(fgetl(dump)); timestep(i) = str2num(fgetl(dump));
t=1; t=1;
end end
case 'ITEM: NUMBER OF ATOMS' else
if (strcmpi(id,'ITEM: NUMBER OF ATOMS'))
Natoms = str2num(fgetl(dump)); Natoms = str2num(fgetl(dump));
case 'ITEM: BOX BOUNDS' else
if (strcmpi(id,'ITEM: BOX BOUNDS'))
x_bound(1,:) = str2num(fgetl(dump)); x_bound(1,:) = str2num(fgetl(dump));
y_bound(1,:) = str2num(fgetl(dump)); y_bound(1,:) = str2num(fgetl(dump));
z_bound(1,:) = str2num(fgetl(dump)); z_bound(1,:) = str2num(fgetl(dump));
case 'ITEM: ATOMS' else
if (strcmpi(id(1:11),'ITEM: ATOMS'))
atom_data = zeros(Natoms,ncol);%Allocate memory for atom data atom_data = zeros(Natoms,ncol);%Allocate memory for atom data
for j = 1 : 1: Natoms for j = 1 : 1: Natoms
atom_data(j,:) = str2num(fgetl(dump)); atom_data(j,:) = str2num(fgetl(dump));
end end
done = 1; done = 1;
p = ftell(dump); p = ftell(dump);
end
end
end
end end
end end
@ -88,20 +93,26 @@ if last_status == 1
while ~feof(dump) while ~feof(dump)
id = fgetl(dump); id = fgetl(dump);
switch id if (strcmpi(id,'ITEM: NUMBER OF ATOMS'))
case 'ITEM: NUMBER OF ATOMS' Natoms = str2num(fgetl(dump));
Natoms = str2num(fgetl(dump)); else
case 'ITEM: BOX BOUNDS' if (strcmpi(id,'ITEM: BOX BOUNDS'))
x_bound(1,:) = str2num(fgetl(dump)); x_bound(1,:) = str2num(fgetl(dump));
y_bound(1,:) = str2num(fgetl(dump)); y_bound(1,:) = str2num(fgetl(dump));
z_bound(1,:) = str2num(fgetl(dump)); z_bound(1,:) = str2num(fgetl(dump));
case 'ITEM: ATOMS' else
atom_data = zeros(Natoms,ncol);%Allocate memory for atom data if (strcmpi(id(1:11),'ITEM: ATOMS'))
for j = 1 : 1: Natoms atom_data = zeros(Natoms,ncol);%Allocate memory for atom data
atom_data(j,:) = str2num(fgetl(dump)); for j = 1 : 1: Natoms
end atom_data(j,:) = str2num(fgetl(dump));
end end
end
end
end
end end
end end
%----------Outputs------------- %----------Outputs-------------