Esempio n. 1
0
def format_options_for_input():
    """Function to return a string of commands to replicate the
    current state of user-modified options. Used to capture C++
    options information for distributed (sow/reap) input files.

    .. caution:: Some features are not yet implemented. Buy a developer a coffee.

       - Does not cover local (as opposed to global) options.

       - Does not work with array-type options.

    """
    commands = ''
    commands += """\npsi4.set_memory(%s)\n\n""" % (psi4.get_memory())
    for chgdopt in psi4.get_global_option_list():
        if psi4.has_global_option_changed(chgdopt):
            chgdoptval = psi4.get_global_option(chgdopt)
            if isinstance(chgdoptval, basestring):
                commands += """psi4.set_global_option('%s', '%s')\n""" % (
                    chgdopt, chgdoptval)
            elif isinstance(chgdoptval, int) or isinstance(chgdoptval, float):
                commands += """psi4.set_global_option('%s', %s)\n""" % (
                    chgdopt, chgdoptval)
            else:
                raise ValidationError(
                    'Option \'%s\' is not of a type (string, int, float, bool) that can be processed.'
                    % (chgdopt))
    return commands
Esempio n. 2
0
def format_options_for_input():
    """Function to return a string of commands to replicate the
    current state of user-modified options. Used to capture C++
    options information for distributed (sow/reap) input files.

    .. caution:: Some features are not yet implemented. Buy a developer a coffee.

       - Does not cover local (as opposed to global) options.

       - Does not work with array-type options.

    """
    commands = ''
    commands += """\npsi4.set_memory(%s)\n\n""" % (psi4.get_memory())
    for chgdopt in psi4.get_global_option_list():
        if psi4.has_global_option_changed(chgdopt):
            chgdoptval = psi4.get_global_option(chgdopt)
            if isinstance(chgdoptval, basestring):
                commands += """psi4.set_global_option('%s', '%s')\n""" % (chgdopt, chgdoptval)
            elif isinstance(chgdoptval, int) or isinstance(chgdoptval, float):
                commands += """psi4.set_global_option('%s', %s)\n""" % (chgdopt, chgdoptval)
            else:
                raise ValidationError('Option \'%s\' is not of a type (string, int, float, bool) that can be processed.' % (chgdopt))
    return commands
Esempio n. 3
0
def get_nbf(mints):
# get # of basis functions from psi4 mints library
    nbf = mints.basisset().nbf()
    if( nbf**4 *8.0 > psi4.get_memory()  ):
        raise Exception("Integrals exceed memory limit.")
    return nbf
Esempio n. 4
0
def get_memory():
    """Function to return the total memory allocation."""
    return psi4.get_memory()
Esempio n. 5
0
def get_nbf(mints):
# get # of basis functions from psi4 mints library
    nbf = mints.basisset().nbf()
    if( nbf**4 *8.0 > psi4.get_memory()  ):
        raise Exception("Integrals exceed memory limit.")
    return nbf
Esempio n. 6
0
def get_memory():
    """Function to return the total memory allocation."""
    return psi4.get_memory()