stfc / janus

collection of scripts to train and generate data for machine learnt interatomic potentials
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

File reader reads energies, pressure and volume from lammps log #51

Open dave452 opened 1 year ago

dave452 commented 1 year ago

Changed the lammps log file reader function read_lammps_log to read energies, pressures and volume data from the lammps log file. It now outputs a dictionary containing all the data present. Code elsewhere was changed to reflect the new change.

A function to plot the energies, pressure and volume was added to visulisation.

Before finishing pull request will likely need to change some of the test functions as these also use the .

ElliottKasoar commented 1 year ago

One thing we might want to consider if whether we want it to always return all the data. If we're starting to look at log files with up to ~100,000 steps, increasing the number of values we read and return by a factor of a few could slow it down quite a bit and take up a lot more memory, though the option is definitely a useful one to have.

dave452 commented 1 year ago

It would probably be easy enough to add an input variable containing the headers you are interested in reading. Would that be better?

ElliottKasoar commented 1 year ago

Yeah I think that probably makes sense. Maybe keep temperature as the default (which maybe has the bonus of not breaking unit tests), but allow a list to be passed?

Some way to automatically return all of them (which will vary) may be useful too, if possible.

ElliottKasoar commented 1 year ago

If I run something like vis.plot_lammps_data(lammps_directory=lammps_directory, log_file=log_file, output_headers=["TotEng"]), I get:

IndexError: Cannot access entries 0, [4] from line number 27179: 'Last command: run 50000

It works fine for 'Temp' instead of 'TotEng', and before failing to complete the desired number of steps either way.

It may well only be an issue for incomplete runs, but I think these are still useful to be able to plot.