ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
stru_frame_io Namespace Reference

Functions

bool extract_last_frame (const std::string &cumulative_path, const std::string &frame_path)
 Extract the last MD frame from a fixed-name cumulative STRU file.
bool extract_frame_by_step (const std::string &cumulative_path, int step, const std::string &frame_path)
 Extract the MD frame whose marker matches a specific one-based step.
int last_frame_step (const std::string &cumulative_path)
 Read the one-based step number of the last frame of a cumulative STRU.

Function Documentation

◆ extract_frame_by_step()

bool stru_frame_io::extract_frame_by_step ( const std::string & cumulative_path,
int step,
const std::string & frame_path )

Extract the MD frame whose marker matches a specific one-based step.

Parameters
cumulative_pathpath of the mode-1 "STRU" file holding one frame per output step, each introduced by a "# MD step N" comment line
stepone-based step number to match against the marker
frame_pathpath of the single-frame file to (over)write with the matching frame; the caller passes this path to the structure readers
Returns
true when a frame with marker "# MD step {step}" was found and written; false otherwise (including when the file is missing)

Unlike extract_last_frame, this walks the cumulative STRU in full and rejects unrelated frames so a MD restart never mixes geometry from one step with Restart_md.txt metadata from another step. The target frame is copied verbatim, without its "# MD step N" comment line, into frame_path.

Here is the caller graph for this function:

◆ extract_last_frame()

bool stru_frame_io::extract_last_frame ( const std::string & cumulative_path,
const std::string & frame_path )

Extract the last MD frame from a fixed-name cumulative STRU file.

Parameters
cumulative_pathpath of the mode-1 "STRU" file holding one frame per output step, each introduced by a "# MD step N" comment line
frame_pathpath of the single-frame file to (over)write with the last frame; the caller passes this path to the structure readers
Returns
true when at least one frame was found and written

The last frame is copied verbatim, without its "# MD step N" comment line, into frame_path. The side file is rewritten on every call so repeated restarts always see the most recent frame.

Here is the caller graph for this function:

◆ last_frame_step()

int stru_frame_io::last_frame_step ( const std::string & cumulative_path)

Read the one-based step number of the last frame of a cumulative STRU.

Parameters
cumulative_pathpath of the mode-1 "STRU" file
Returns
the step number carried by the last "# MD step N" marker, or 0 when the file is missing or carries no frame marker
Here is the caller graph for this function: