Hello, I’m using MatLab to read the LAMMPS dump file to do post-processing:
I used similar code in this link: LAMMPS/readdump_all.m at a92e8c271bcb7add8245f5a32f2920fbe35bacc9 · CFDEMproject/LAMMPS · GitHub
name = 'dump.188000'
try
dump = fopen(name,'r');
catch
error('Dumpfile not found!');
end
i=1;
while feof(dump) == 0
id = fgetl(dump);
if (strcmpi(id,'ITEM: TIMESTEP'))
timestep(i) = str2num(fgetl(dump));
else
if (strcmpi(id,'ITEM: NUMBER OF ATOMS'))
Natoms(i) = str2num(fgetl(dump));
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));
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
disp("-------------------");
disp("----ALL DONE!!!----");
disp("-------------------");
I had an error: Unable to perform assignment because the size of the left side is 1-by-6 and the
size of the right side is 0-by-0.
Error in rubberdumperead (line 34)
atom_data(j,:,i) = str2num(fgetl(dump));
I’d appreciate any help!