Skip to main content

parse_velocity_section

Function parse_velocity_section 

Source
pub fn parse_velocity_section<'a>(
    lines: &mut impl LineStream<'a>,
    header: &FrameHeader,
    atom_data: &mut [AtomDatum],
    column: &mut Vec<f64>,
) -> Result<bool, ParseError>
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 writes each velocity into column (row-major n * 3 f64s, one allocation). If the next line is not blank (or is absent), no velocities are parsed and column is left untouched.

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