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;
while feof(dump) == 0
id = fgetl(dump);
switch id
case 'ITEM: TIMESTEP'
if (strcmpi(id,'ITEM: TIMESTEP'))
timestep(i) = str2num(fgetl(dump));
case 'ITEM: NUMBER OF ATOMS'
else
if (strcmpi(id,'ITEM: NUMBER OF ATOMS'))
Natoms(i) = str2num(fgetl(dump));
case 'ITEM: BOX BOUNDS'
else
if (strcmpi(id,'ITEM: BOX BOUNDS'))
x_bound(i,:) = str2num(fgetl(dump));
y_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
atom_data(j,:,i) = str2num(fgetl(dump));
end
i=i+1;
end
end
end
end
end
end
%----------Outputs-------------
%OUTPUTS IN SAME VARIABLE STRUCTURE

View File

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