vibeqc.write_xyz_trajectory¶
- vibeqc.write_xyz_trajectory(path, frames, comments=None, *, append=False)[source]¶
Write a sequence of
Moleculeframes as a multi-XYZ trajectory file.- Parameters:
frames (Iterable[vibeqc._vibeqc_core.Molecule]) – Iterable of
Moleculeobjects, one per trajectory frame. All frames should share the same atom count and ordering — most viewers (moltui, ASE, OVITO) assume this so atom-by-atom interpolation makes sense. We don’t enforce it here (you can write a chemistry-changing trajectory like a bond-cleavage if you really want), but a UserWarning is emitted if frame N has a different atom count than frame 1.comments (Sequence[str] | None) – Optional per-frame comment strings (one per frame). The XYZ format puts comments on line 2 of each frame; viewers often display them as labels. Default: numeric
"frame N".append (bool) – If
True, open in append mode so the new frames extend an existing trajectory file. Default: overwrite.
- Returns:
The number of frames written.
- Return type:
Examples
Geometry-opt animation:
opts = [] # collect mols for it in range(50): mol = step(mol, gradient_at(mol)) opts.append(mol) vq.write_xyz_trajectory("opt.xyz", opts)
Normal-mode movie (helper below produces the frames for you):
frames = vq.normal_mode_trajectory(mol, hess, mode_index=8) vq.write_xyz_trajectory("h2o-asym-stretch.xyz", frames)