Skip to content
Snippets Groups Projects
Commit f3e620cc authored by moritz.buchhorn's avatar moritz.buchhorn
Browse files

Add Trajectory constructor from orca output file

parent 7c0b7189
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ import numpy as np
import plotly.graph_objects as go
import atom_properties as atomp
from itertools import accumulate
import qc_parser as qcp
class XYZ:
sphere_mode = "ball"
......@@ -244,10 +245,24 @@ class XYZ:
class Trajectory:
def __init__(self, coordinates: list[XYZ]):
self.coordinates = coordinates
@classmethod
def from_orca_output(cls, output_file: str):
"""
Creates a Trajectory object from an ORCA output file.
Args:
output_file (str): The path to the ORCA output file.
Returns:
Trajectory: A Trajectory object.
"""
parsed = qcp.read_qc_file(output_file)
return cls([XYZ(frame) for frame in parsed["coordinates"]])
def get_molecular_viewer(self, resolution: int = 64, rel_cutoff: float = 0.5) -> go.Figure:
"""
Returns a plotly figure with the molecular structure of the trajectory.
Returns a plotly figure with the molecular structure of the trajectory. The figure comes with a slider that allows to switch between frames.
Args:
resolution (int, optional): The number of points to be generated. Defaults to 64.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment