forte2.system.geom_utils ======================== .. py:module:: forte2.system.geom_utils Module Contents --------------- .. py:function:: parse_geometry(geom, unit) Parse a geometry string (XYZ or Z-matrix) into a list of atoms. :Parameters: **geom** : str Geometry string in XYZ or Z-matrix format. **unit** : str Coordinate unit, "bohr" or "angstrom". :Returns: **atoms** : list[tuple(int, NDArray)] List of (Z, coords) tuples in Bohr. .. !! processed by numpydoc !! .. py:function:: parse_xyz(lines, unit) Parse an XYZ string into a list of atoms. :Parameters: **lines** : list[str] The lines containing the XYZ atom symbols and coordinates. **unit** : str The unit of the coordinates, either "bohr" or "angstrom". :Returns: **atoms** : list[tuple(int, NDArray)] A list of tuples, each containing the atomic number and a numpy array of coordinates. :Raises: ValueError If a line in the XYZ string does not match the expected format or has an incorrect number of coordinates. .. rubric:: Examples >>> xyz = "Li 0.0 0.0 0.0\nN -10 0 0\n" >>> parse_xyz(xyz, "bohr") [(3, array([0., 0., 0.])), (7, array([-10., 0., 0.]))] >>> xyz = "Li 0.0 0.0\nN -10 0\n" >>> parse_xyz(xyz, "angstrom") Traceback (most recent call last): ... ValueError: Invalid line in XYZ file: Li 0.0 0.0. Expected 3 coordinates, found 2. .. !! processed by numpydoc !! .. py:function:: parse_zmatrix(lines, unit) Parse a Z-matrix string into a list of atoms. :Parameters: **lines** : list[str] The lines containing the Z-matrix atom symbols and coordinates. **unit** : str The unit of the coordinates, either "bohr" or "angstrom". :Returns: **atoms** : list[tuple(int, NDArray)] A list of tuples, each containing the atomic number and a numpy array of coordinates. :Raises: ValueError If a line in the Z-matrix string does not match the expected format. .. rubric:: Examples Unit bohr: H O 1 0.9 O 2 1.4 1 105.0 H 3 0.9 2 105.0 1 120.0 Should return: [[ 0. 0. 0. ] [ 1.70075351 0. 0. ] [ 2.38548947 0. -2.55546938] [ 3.29283067 1.42270804 -2.76806356]] .. !! processed by numpydoc !! .. py:class:: GeometryHelper Helper class to process geometry data. .. !! processed by numpydoc !! .. py:attribute:: atoms :type: list[tuple[int, numpy.ndarray]] .. py:attribute:: tol :type: float :value: 0.0001 .. py:attribute:: symmetry :type: bool :value: False