Пример #1
0
def run_optavc_mpi():
    from optavc.mpi4py_iface import mpirun
    options_kwargs = {
        'template_file_path': "template.dat",
        'queue': "shared",
        'command': "qchem input.dat output.dat",
        'time_limit': "48:00:00",  # has no effect
        # 'memory'            : "10 GB", #calculator uses memory, number of nodes, and numcores to
        # distribute resources
        'energy_regex': r"CCSD\(T\) total energy[=\s]+(-\d+\.\d+)",
        'success_regex': r"beer",
        'fail_regex': r"coffee",
        'input_name': "input.dat",
        'output_name': "output.dat",
        # 'readhess'          : False,
        'mpi': True,  # set to true to use mpi, false to not
        # 'submitter'         : None,
        'maxiter': 20,
        'findif': {
            'points': 3
        },  # set to 5 if you want slightly better frequencies
        # 'job_array'         : True,
        'optking': {
            'max_force_g_convergence':
            1e-7,  # tighter than this is not recommended
            'rms_force_g_convergence': 1e-7,
        }
    }

    options_obj = Options(**options_kwargs)
    mpirun(options_obj)
Пример #2
0
def run_optavc(jobtype,
               options_dict,
               restart_iteration=0,
               xtpl_restart=None,
               sow=True,
               path="."):
    """ optavc driver meant to unify input
    
    Parameters
    ----------
    jobtype: str
        generous with available strings for optimziation / hessian
    options_dict: dict
        should contain BOTH optavc and psi4 options
    restart_iteration: int
        corresponds to the iteration we should begin trying to sow gradients for
    xtpl_restart: str
        should be ['high_corr', 'large_basis', 'med_basis', 'small_basis']
    sow: bool
        if False optavc will try to reap only
    path: str
        for Hessian jobs only

    """

    options_obj = Options(**options_dict)

    if options_obj.xtpl:
        tfps = [
            TemplateFileProcessor(open(i).read(), options_obj)
            for i in options_obj.xtpl_templates
        ]
        tfp = tfps[0]
        xtpl_inputs = [i.input_file_object for i in tfps]
    else:
        template_file_string = open(options_obj.template_file_path).read()
        tfp = TemplateFileProcessor(template_file_string, options_obj)
        xtpl_inputs = None

    input_obj = tfp.input_file_object
    molecule = tfp.molecule

    if jobtype.upper() in ['OPT', "OPTIMIZATION"]:
        opt_obj = optimize.Optimization(options_obj, input_obj, molecule,
                                        xtpl_inputs)
        opt_obj.run(restart_iteration, xtpl_restart)
    elif jobtype.upper() in ["HESS", "FREQUENCY", "FREQUENCIES", "HESSIAN"]:
        if options_obj.xtpl:
            hessian.xtpl_hessian(options_obj, molecule, xtpl_inputs, path, sow)
        else:
            hess_obj = hessian.Hessian(options_obj,
                                       input_obj,
                                       molecule,
                                       path=path)
            hess_obj.compute_hessian(sow)
    else:
        raise ValueError(
            "Can only run deriv or optimizations. For gradients see optimize.py to run or add wrapper here"
        )
Пример #3
0
def initialize_optavc(options_dict, molecule=None):
    """Create the three basic objects required for running optavc. Options, InputFile, Molecule """

    options_obj = Options(**options_dict)

    if options_obj.xtpl:
        options_obj.template_file_path = options_obj._xtpl_templates[0][0]

    template_file_string = open(options_obj.template_file_path).read()
    tfp = TemplateFileProcessor(template_file_string, options_obj)

    input_obj = tfp.input_file_object
    if not molecule:
        molecule = tfp.molecule

    return options_obj, input_obj, molecule
Пример #4
0
    'program': "molpro",
    'prep_cmd': "module load molpro",
    'command':
    "molpro -n 8 --nouse-logfile --no-xml-output -o {}/output.dat {}/input.dat",
    'time_limit': "08:00:00",
    'memory': "4GB",
    # 'num_cores'         : 1,
    'energy_regex': r" ENERGY\(1\)\s+=\s+(-\d+\.\d+)",
    'dask': "/global/cscratch1/sd/md38294/scheduler.json",
    'success_regex': r" Variable memory released",
    'input_name': "input.dat",
    'output_name': "output.dat",
    'submitter': submitoptavc,
    'maxiter': 20,
    'findif': {
        'points': 3
    },
    'job_array': True,
    'optking': {
        'max_force_g_convergence': 1e-7,
        'rms_force_g_convergence': 1e-7,
    }
}
from optavc.options import Options

options_obj = Options(**options_kwargs)
from optavc.optimize import Optimization

optimization_obj = Optimization(options_obj)
optimization_obj.run()