Skip to content

fms90.py🔗

aimsprop.fms90 🔗

Functions🔗

parse_fms90(filepath: Path, scheme: str, cutoff_time: float = None, cutoff_saddle: float = 0.0001, initial_I: int = None) -> Bundle 🔗

Parse an FMS90 results directory into a Bundle.

This uses information in positions..xyz, Amps., S.dat, FMS.out and Spawn.log to populate a density matrix by mulliken or saddle point rules.

Parameters:

Name Type Description Default
filepath Path

the path to the FMS run directory

required
scheme str

'mulliken' or 'saddle' to indicate the approximation used for property evaluation.

required
cutoff_time float

cutoff time to stop reading bundle info after (None reads all times).

None
cutoff_saddle float

cutoff for centroid TBF pair in the saddle point approach.

0.0001
initial_I int

initial electronic state, used only if there is no Spawn.log (e.g., if no spawning has happened yet) to place electronic label.

None

Returns:

Type Description
Bundle

Bundle: The Bundle object.

Source code in aimsprop/fms90.py
def parse_fms90(
    filepath: Path,
    scheme: str,
    cutoff_time: float = None,
    cutoff_saddle: float = 1.0e-4,
    initial_I: int = None,
) -> bundle.Bundle:
    """Parse an FMS90 results directory into a Bundle.

    This uses information in positions.*.xyz, Amps.*, S.dat, FMS.out and Spawn.log to
    populate a density matrix by mulliken or saddle point rules.

    Arguments:
        filepath: the path to the FMS run directory
        scheme: 'mulliken' or 'saddle' to indicate the approximation
            used for property evaluation.
        cutoff_time: cutoff time to stop reading bundle info after
            (None reads all times).
        cutoff_saddle: cutoff for centroid TBF pair in the saddle
            point approach.
        initial_I: initial electronic state, used only if there is
            no Spawn.log (e.g., if no spawning has happened yet) to place
            electronic label.
    Returns:
        Bundle: The Bundle object.
    """

    # Read in FMS output files: positions*, Amp.*, S.dat and Spawn.log
    N2s, xyz2s = _parse_positions(filepath, cutoff_time)

    C2s = _parse_Cs(filepath, cutoff_time)

    Ss = _parse_Ss(filepath, cutoff_time)

    states = _parse_spawnlog(filepath, initial_I)

    widths = _parse_widths(filepath)
    if widths == []:  # this code is beautiful.
        widths = atom_data.from_Ns_to_widths(
            N2s[list(N2s.keys())[0]][list(N2s[list(N2s.keys())[0]].keys())[0]]
        )

    if len(C2s) != len(N2s):
        raise RuntimeError("xyz and C files not same number of TBF")

    # Swap to put time on slow axis (C3s[t][I] instead of C2s[I][t])
    C3s, xyz3s, N3s = [_swap_dic_axis(x) for x in [C2s, xyz2s, N2s]]

    if scheme == "mulliken":
        frames = _create_frames_mulliken(Ss, C3s, xyz3s, N3s, states, widths)
    elif scheme == "saddle":
        frames = _create_frames_saddle(
            Ss, C3s, xyz3s, N3s, states, cutoff_saddle, widths
        )
    else:
        raise RuntimeError(f"Invalid scheme: {scheme}")

    processed_bundle = bundle.Bundle(frames)

    return processed_bundle