Skip to content

[Feature Request] Append to model_devi.out if restart #623

@njzjz

Description

@njzjz

Summary

If LAMMPS restarts, model_devi.out should be appended to instead of creating a new file.

Detailed Description

How to implement:

  1. set restartinfo to 1 (default)
    See: https://github.com/lammps/lammps/blob/9da49d9c6f521eed62ca0752297c9057d34d39db/src/pair.cpp#L61
  2. add read_restart to pair, where open the file using std::ofstream::app mode
    See:
    https://github.com/lammps/lammps/blob/9da49d9c6f521eed62ca0752297c9057d34d39db/src/pair.cpp#L725-L729
    http://www.cplusplus.com/reference/fstream/ofstream/open/
  3. add a condition to skip opening a new file and adding headers if restart
    See:
    if (numb_models > 1 && out_freq > 0){
    fp.open (out_file);
    fp << scientific;
    fp << "#"
    << setw(12-1) << "step"
    << setw(18+1) << "max_devi_v"
    << setw(18+1) << "min_devi_v"
    << setw(18+1) << "avg_devi_v"
    << setw(18+1) << "max_devi_f"
    << setw(18+1) << "min_devi_f"
    << setw(18+1) << "avg_devi_f"
    << endl;
    }

Potential problems: Since we don't save restart files every timestep, there may be some duplicated data before and after restart.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions