Skip to main content

parse_velocity_section

Function parse_velocity_section 

Source
pub fn parse_velocity_section<'a, I>(
    lines: &mut Peekable<I>,
    header: &FrameHeader,
    atom_data: &mut [AtomDatum],
) -> Result<bool, ParseError>
where I: Iterator<Item = &'a str>,
Expand description

Attempts to parse an optional velocity section following coordinate blocks.

In .convel files, after all coordinate blocks there is a blank separator line followed by per-component velocity blocks with the same structure as coordinate blocks (symbol line, “Velocities of Component N” line, then atom lines with vx vy vz fixed atomID).

This function peeks at the next line. If it is blank (or contains only whitespace), it consumes the blank line and parses velocity data into the existing atom_data. If the next line is not blank (or is absent), no velocities are parsed.

Returns Ok(true) if velocities were found and parsed, Ok(false) otherwise.