Ejemplo n.º 1
0
def fs_confs_dict(cnf_save_fs, cnf_save_locs_lst, ini_cnf_save_fs,
                  ini_cnf_save_locs_lst):
    """ Assess which structures from the cnf_save_fs currently exist
        within the ini_cnf_save_fs. Generate a dictionary to connect
        the two
    """

    match_dct = {}
    for ini_locs in ini_cnf_save_locs_lst:

        match_dct[ini_locs] = None
        # Loop over structs in cnf_save, see if they match the current struct
        inigeo = ini_cnf_save_fs[-1].file.geometry.read(ini_locs)
        inizma = automol.geom.zmatrix(inigeo)
        # inizma =  ini_cnf_save_fs[-1].file.zmatrix.read(ini_locs)
        ini_cnf_save_path = ini_cnf_save_fs[-1].path(ini_locs)
        ioprinter.checking('structures', ini_cnf_save_path)
        for locs in cnf_save_locs_lst:
            geo = cnf_save_fs[-1].file.geometry.read(locs)
            zma = automol.geom.zmatrix(geo)
            if automol.zmat.almost_equal(inizma,
                                         zma,
                                         dist_rtol=0.1,
                                         ang_atol=.4):
                cnf_save_path = cnf_save_fs[-1].path(locs)
                ioprinter.info_message(
                    '- Similar structure found at {}'.format(cnf_save_path))
                match_dct[ini_locs] = locs
                break

    return match_dct
Ejemplo n.º 2
0
def saddle_point_checker(imags):
    """ run things for checking Hessian
    """

    big_imag, kick_imag = 0, 0

    ioprinter.checking('the imaginary frequencies of the saddle point...')
    if len(imags) < 1:
        ioprinter.warning_message('No imaginary modes for geometry')
        status = 'fail'
    else:
        if len(imags) > 1:
            ioprinter.warning_message('More than one imaginary mode for geometry')
        for idx, imag in enumerate(imags):
            if imag <= 50.0:
                ioprinter.warning_message('Mode {} {} cm-1 is low,'.format(str(idx+1), imag))
            elif 50.0 < imag <= 200.0:
                lowstr = 'Mode {} {} cm-1 is low,'.format(str(idx+1), imag)
                ioprinter.warning_message(lowstr + 'need a kickoff procedure to remove')
                kick_imag += 1
            else:
                ioprinter.debug_message('Mode {} {} cm-1 likely fine,'.format(str(idx+1), imag))
                big_imag += 1

        if big_imag > 1:
            ioprinter.warning_message('WARNING: More than one imaginary mode for geometry')
            if kick_imag >= 1:
                ioprinter.debug_message('Will kickoff to get saddle point')
                status = 'kickoff'
        elif big_imag == 1:
            status = 'success'

    return status
Ejemplo n.º 3
0
def saddle_point_checker(imags):
    """ run things for checking Hessian
    """

    big_imag, kick_imag = 0, 0

    ioprinter.checking('the imaginary frequencies of the saddle point...')
    if len(imags) < 1:
        ioprinter.warning_message('No imaginary modes for geometry')
        status = 'fail'
    else:
        if len(imags) > 1:
            ioprinter.warning_message(
                'More than one imaginary mode for geometry')
            status = 'fail'
        for idx, imag in enumerate(imags):
            if imag <= 50.0:
                ioprinter.warning_message(
                    f'Mode {str(idx+1)} {imag} cm-1 is low,')
            elif 50.0 < imag <= 200.0:
                lowstr = f'Mode {str(idx+1)} {imag} cm-1 is low,'
                ioprinter.debug_message(
                    lowstr + ' check mode and see if it should be corrected')
                big_imag += 1
                # Adding to the kick counter kills code for good TSs
                # Some addditions of big species have low mode of this
                # ioprinter.warning_message(
                #     lowstr + 'need a kickoff procedure to remove')
                # kick_imag += 1
            else:
                ioprinter.debug_message(
                    f'Mode {str(idx+1)} {imag} cm-1 likely fine')
                big_imag += 1

        if big_imag > 1:
            ioprinter.warning_message(
                'More than one imaginary mode for geometry')
            if kick_imag >= 1:
                ioprinter.debug_message('Will kickoff to get saddle point')
                status = 'kickoff'
            else:
                status = 'failure'
        elif big_imag == 1:
            status = 'success'
        elif big_imag == 0:
            status = 'failure'
            ioprinter.warning_message('Did not find any appropriate modes')

    return status
Ejemplo n.º 4
0
def _check_freqs(imags):
    """ Check the magnitude of the imaginary modes.
    """

    big_imag, kick_imag = 0, 0

    ioprinter.checking('the imaginary frequencies of the saddle point...')
    if len(imags) < 1:
        ioprinter.warning_message('No imaginary modes for geometry')
        status = 'fail'
    else:
        if len(imags) > 1:
            ioprinter.warning_message(
                'More than one imaginary mode for geometry')
            status = 'fail'
        for idx, imag in enumerate(imags):
            if imag <= 50.0:
                ioprinter.warning_message(f'Mode {idx+1} {imag} cm-1 is low,')
            elif 50.0 < imag <= 200.0:
                lowstr = f'Mode {idx+1} {imag} cm-1 is low,'
                ioprinter.debug_message(
                    lowstr + ' check mode and see if it should be corrected')
                big_imag += 1
                # Adding to the kick counter kills code for good TSs
                # Some addditions of big species have low mode of this
                # ioprinter.warning_message(
                #     lowstr + 'need a kickoff procedure to remove')
                # kick_imag += 1
            else:
                ioprinter.debug_message(
                    f'Mode {idx+1} {imag} cm-1 is likely fine,')
                big_imag += 1

        if big_imag > 1:
            ioprinter.warning_message(
                'More than one imaginary mode for geometry')
            if kick_imag >= 1:
                ioprinter.debug_message('Will kickoff to get saddle point')
                status = 'kick'
            else:
                status = False
        elif big_imag == 1:
            status = True
        elif big_imag == 0:
            status = False

    return status
Ejemplo n.º 5
0
def unique_fs_confs(cnf_save_fs, cnf_save_locs_lst, ini_cnf_save_fs,
                    ini_cnf_save_locs_lst):
    """ Assess which structures from the cnf_save_fs currently exist
        within the ini_cnf_save_fs. Generate a lst of unique structures
        in the ini_cnf_save_fs.
    """

    uni_ini_cnf_save_locs = []
    for ini_locs in ini_cnf_save_locs_lst:

        # Initialize variable to see if initial struct is found
        found = False

        # Loop over structs in cnf_save, see if they match the current struct
        inigeo = ini_cnf_save_fs[-1].file.geometry.read(ini_locs)
        inizma = automol.geom.zmatrix(inigeo)
        # inizma =  ini_cnf_save_fs[-1].file.zmatrix.read(ini_locs)
        ini_cnf_save_path = ini_cnf_save_fs[-1].path(ini_locs)
        ioprinter.checking('structures', ini_cnf_save_path)
        for locs in cnf_save_locs_lst:
            geo = cnf_save_fs[-1].file.geometry.read(locs)
            zma = automol.geom.zmatrix(geo)
            # zma =  cnf_save_fs[-1].file.zmatrix.read(locs)
            if automol.zmat.almost_equal(inizma,
                                         zma,
                                         dist_rtol=0.1,
                                         ang_atol=.4):
                cnf_save_path = cnf_save_fs[-1].path(locs)
                ioprinter.info_message(
                    '- Similar structure found at {}'.format(cnf_save_path))
                found = True
                break

        # If no match was found, add to unique locs lst
        if not found:
            uni_ini_cnf_save_locs.append(ini_locs)

    return uni_ini_cnf_save_locs
Ejemplo n.º 6
0
def unique_fs_ring_confs(cnf_save_fs, cnf_locs_lst, ini_cnf_save_fs,
                         ini_cnf_locs_lst):
    """ Assess which structures from the cnf_save_fs currently exist
        within the ini_cnf_save_fs. Generate a lst of unique structures
        in the ini_cnf_save_fs.
    """
    uni_ini_rng_locs = []
    uni_ini_cnf_locs = []
    rng_dct = {}

    for ini_locs in ini_cnf_locs_lst:
        ini_rid, _ = ini_locs
        if ini_rid in [locs[0] for locs in uni_ini_rng_locs]:
            uni_ini_rng_locs.append(ini_locs)
            continue
        inigeo = ini_cnf_save_fs[-1].file.geometry.read(ini_locs)
        ini_cnf_save_path = ini_cnf_save_fs[-1].path(ini_locs)
        inizma = automol.geom.zmatrix(inigeo)
        ioprinter.checking('structures', ini_cnf_save_path)

        # Check to see if a similar ring pucker is in the runlvl filesystem
        found_rid = None
        if ini_rid in rng_dct:
            found_rid = rng_dct[ini_rid]
        else:
            frag_ini_geo = automol.geom.fragment_ring_geo(inigeo)
            if frag_ini_geo is not None:
                frag_ini_zma = automol.geom.zmatrix(frag_ini_geo)
            skip_trid = []
            for tlocs in cnf_save_fs[-1].existing():
                trid, _ = tlocs
                if frag_ini_geo is None:
                    found_rid = trid
                    rng_dct[ini_rid] = trid
                    break
                if trid in skip_trid:
                    continue
                geo = cnf_save_fs[-1].file.geometry.read(tlocs)
                frag_geo = automol.geom.fragment_ring_geo(geo)
                frag_zma = automol.geom.zmatrix(frag_geo)
                if automol.zmat.almost_equal(frag_ini_zma,
                                             frag_zma,
                                             dist_rtol=0.1,
                                             ang_atol=.4):
                    rng_dct[ini_rid] = trid
                    found_rid = trid
                    break
                skip_trid.append(trid)
        # If no similar runlvl ring pucker, then add it to unique rings
        if found_rid is None:
            uni_ini_rng_locs.append(ini_locs)
            continue

        # If similar ring is found,
        # check actual conformers under that ring orientation
        found = False
        for locs in cnf_locs_lst:
            rid, _ = locs
            if rid != found_rid:
                continue
            cnf_save_path = cnf_save_fs[-1].path(locs)
            geo = cnf_save_fs[-1].file.geometry.read(locs)
            zma = automol.geom.zmatrix(geo)
            if automol.zmat.almost_equal(inizma,
                                         zma,
                                         dist_rtol=0.1,
                                         ang_atol=.4):
                ioprinter.info_message(
                    '- Similar structure found at {}'.format(cnf_save_path))
                found = True
                break

        # If no match was found, add to unique locs lst
        if not found:
            uni_ini_cnf_locs.append((ini_locs, found_rid))

    return uni_ini_rng_locs, uni_ini_cnf_locs