Skip to main content
edited body
Source Link
xslittlegrass
  • 28k
  • 9
  • 105
  • 190

Here is an example using your log file. Your file is very well structured, at each "TIMESEP" log, the data always starts from the 10th line. Using that information, you can easily split each time step into a group, and read the data from each group.

data = ReadList["atom.lammpstrj", "String"]; data2 = Split[data, #2 =!= "ITEM: TIMESTEP" &][[All, 10 ;; -1]]; data3 = ReadList[StringToStream[StringRiffle[#, "\n"]], {Number, Number, Number, Number, Number}] & /@ data2; 

Now you can use something like data3[[All, All,{13,24,35}]] to get the column you want.

Hope that can get you started.

Here is an example using your log file. Your file is very well structured, at each "TIMESEP" log, the data always starts from the 10th line. Using that information, you can easily split each time step into a group, and read the data from each group.

data = ReadList["atom.lammpstrj", "String"]; data2 = Split[data, #2 =!= "ITEM: TIMESTEP" &][[All, 10 ;; -1]]; data3 = ReadList[StringToStream[StringRiffle[#, "\n"]], {Number, Number, Number, Number, Number}] & /@ data2; 

Now you can use something like data3[[All, All,{1,2,3}]] to get the column you want.

Hope that can get you started.

Here is an example using your log file. Your file is very well structured, at each "TIMESEP" log, the data always starts from the 10th line. Using that information, you can easily split each time step into a group, and read the data from each group.

data = ReadList["atom.lammpstrj", "String"]; data2 = Split[data, #2 =!= "ITEM: TIMESTEP" &][[All, 10 ;; -1]]; data3 = ReadList[StringToStream[StringRiffle[#, "\n"]], {Number, Number, Number, Number, Number}] & /@ data2; 

Now you can use something like data3[[All, All,{3,4,5}]] to get the column you want.

Hope that can get you started.

Source Link
xslittlegrass
  • 28k
  • 9
  • 105
  • 190

Here is an example using your log file. Your file is very well structured, at each "TIMESEP" log, the data always starts from the 10th line. Using that information, you can easily split each time step into a group, and read the data from each group.

data = ReadList["atom.lammpstrj", "String"]; data2 = Split[data, #2 =!= "ITEM: TIMESTEP" &][[All, 10 ;; -1]]; data3 = ReadList[StringToStream[StringRiffle[#, "\n"]], {Number, Number, Number, Number, Number}] & /@ data2; 

Now you can use something like data3[[All, All,{1,2,3}]] to get the column you want.

Hope that can get you started.