How to use the qcfractal.interface function in qcfractal

To help you get started, we’ve selected a few qcfractal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MolSSI / QCFractal / qcfractal / cli / qcfractal_manager.py View on Github external
adapter_logger = logging.getLogger(logger_map[settings.common.adapter])
        adapter_logger.setLevel("DEBUG")
        logger.setLevel("DEBUG")

    if settings.manager.log_file_prefix is not None:
        tornado.options.options["log_file_prefix"] = settings.manager.log_file_prefix
        # Clones the log to the output
        tornado.options.options["log_to_stderr"] = True
    tornado.log.enable_pretty_logging()

    if settings.manager.test:
        # Test this manager, no client needed
        client = None
    else:
        # Connect to a specified fractal server
        client = qcfractal.interface.FractalClient(
            address=settings.server.fractal_uri, **settings.server.dict(skip_defaults=True, exclude={"fractal_uri"})
        )

    # Figure out per-task data
    node_parallel_tasks = settings.common.nodes_per_task > 1  # Whether tasks are node-parallel
    if node_parallel_tasks:
        supported_adapters = ["parsl"]
        if settings.common.adapter not in supported_adapters:
            raise ValueError("Node-parallel jobs are only supported with {} adapters".format(supported_adapters))
        # Node-parallel tasks use all cores on a worker
        cores_per_task = settings.common.cores_per_worker
        memory_per_task = settings.common.memory_per_worker
        if settings.common.tasks_per_worker > 1:
            raise ValueError(">1 task per node and >1 node per tasks are mutually-exclusive")
    else:
        cores_per_task = settings.common.cores_per_worker // settings.common.tasks_per_worker
github MolSSI / QCFractal / examples / local_dataset / query_database.py View on Github external
import qcfractal.interface as portal

# Build a interface to the server
p = portal.FractalClient("localhost:7777", verify=False)

# Pull data from the server
ds = portal.collections.ReactionDataset.from_server(p, "Water")

# Submit computations
r = ds.query("SCF", "STO-3G", stoich="cp", program="psi4")

# Print the Pandas DataFrame
print(ds.df)

# Tests to ensure the correct results are returned
# Safe to comment out
import pytest
assert pytest.approx(ds.df.loc["Water Dimer", "SCF/STO-3G"], 1.e-3) == -1.392710
assert pytest.approx(ds.df.loc["Water Dimer Stretch", "SCF/STO-3G"], 1.e-3) ==  0.037144
assert pytest.approx(ds.df.loc["Helium Dimer", "SCF/STO-3G"], 1.e-3) == -0.003148
github MolSSI / QCFractal / examples / local_dataset / build_database.py View on Github external
import qcfractal.interface as portal

# Builds a blank database object
# Tell the database we are going to build interaction energies
ds = portal.collections.ReactionDataset("Water", ds_type="ie")

# Portal has some molecules stored for easy access.
water_dimer = portal.data.get_molecule("water_dimer_minima.psimol")
water_dimer_stretch = portal.data.get_molecule("water_dimer_stretch.psimol")

# We can also create a new molecule from canonical strings such as a Psi4 molecule
helium_dimer = portal.Molecule.from_data("He 0 0 -5\n--\nHe 0 0 5", dtype="psi4")

# Add several intermolecular interaction, dimers are automatically fragmented
ds.add_ie_rxn("Water Dimer", water_dimer)
ds.add_ie_rxn("Water Dimer Stretch", water_dimer_stretch)
ds.add_ie_rxn("Helium Dimer", helium_dimer)

# Build a interface to the server 
p = portal.FractalClient("localhost:7777", verify=False)

# Add the database to the server
ds.save(p)
github MolSSI / QCFractal / qcfractal / storage_sockets / mongo_socket.py View on Github external
Constructs a new socket where url and port points towards a Mongod instance.

        """

        # Logging data
        if logger:
            self.logger = logger
        else:
            self.logger = logging.getLogger('MongoSocket')

        # Secuity
        self._bypass_security = bypass_security

        # Static data
        self._table_indices = {
            "collections": interface.schema.get_table_indices("collection"),
            "options": interface.schema.get_table_indices("options"),
            "results": interface.schema.get_table_indices("result"),
            "molecules": interface.schema.get_table_indices("molecule"),
            "procedures": interface.schema.get_table_indices("procedure"),
            "service_queue": interface.schema.get_table_indices("service_queue"),
            "task_queue": interface.schema.get_table_indices("task_queue"),
            "users": ("username", ),
            "queue_managers": ("name", )
        }
        self._valid_tables = set(self._table_indices.keys())
        self._table_unique_indices = {
            "collections": True,
            "options": True,
            "results": True,
            "molecules": False,
            "procedures": False,
github MolSSI / QCFractal / docs / qcportal / source / conf.py View on Github external
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config

import datetime
import os
import sys

sys.path.insert(0, os.path.abspath('../../..'))
import qcfractal

# A little magic to make interface look like qcportal
import qcfractal.interface as qcportal
sys.modules["qcportal"] = qcportal

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- Project information -----------------------------------------------------

project = 'QCPortal'
copyright = f'2018-{datetime.datetime.today().year}, The Molecular Sciences Software Institute'
github MolSSI / QCFractal / benchmarks / bench_mongoengine.py View on Github external
def insert_molecules(n_mol):
    # add Molecules
    water = portal.data.get_molecule("water_dimer_minima.psimol").to_json()

    mol_data = {}
    # Add Molecule using pymongo
    for i in range(n_mol):
        tmp = water.copy()
        tmp['molecular_charge'] = i
        mol_data['water'+str(i)] = tmp

    mongoengine_socket.add_molecules(mol_data)
github MolSSI / QCFractal / examples / local_dataset / query_database.py View on Github external
import qcfractal.interface as portal

# Build a interface to the server
p = portal.FractalClient("localhost:7777", verify=False)

# Pull data from the server
ds = portal.collections.ReactionDataset.from_server(p, "Water")

# Submit computations
r = ds.query("SCF", "STO-3G", stoich="cp", program="psi4")

# Print the Pandas DataFrame
print(ds.df)

# Tests to ensure the correct results are returned
# Safe to comment out
import pytest
assert pytest.approx(ds.df.loc["Water Dimer", "SCF/STO-3G"], 1.e-3) == -1.392710
assert pytest.approx(ds.df.loc["Water Dimer Stretch", "SCF/STO-3G"], 1.e-3) ==  0.037144
assert pytest.approx(ds.df.loc["Helium Dimer", "SCF/STO-3G"], 1.e-3) == -0.003148
github MolSSI / QCFractal / examples / local_dataset / query_database.py View on Github external
import qcfractal.interface as portal

# Build a interface to the server
p = portal.FractalClient("localhost:7777", verify=False)

# Pull data from the server
ds = portal.collections.Dataset.from_server(p, "Water")

# Submit computations
r = ds.query("SCF", "STO-3G", stoich="cp", scale="kcal")

# Print the Pandas DataFrame
print(ds.df)

# Tests to ensure the correct results are returned
# Safe to comment out
import pytest
assert pytest.approx(ds.df.loc["Water Dimer", "SCF/STO-3G"], 1.e-3) == -1.392710
assert pytest.approx(ds.df.loc["Water Dimer Stretch", "SCF/STO-3G"], 1.e-3) ==  0.037144
# assert pytest.approx(ds.df.loc["Helium Dimer", "SCF/STO-3G"], 1.e-3) == -0.003148
github MolSSI / QCFractal / examples / local_dataset / compute_database.py View on Github external
import qcfractal.interface as portal

# Build a interface to the server 
p = portal.FractalClient("localhost:7777", verify=False)

# Pull data from the server
ds = portal.collections.ReactionDataset.from_server(p, "Water")
print(ds.data)

# Print the current data
# Should be blank, except for an index
print(ds.df)

# Submit computations (cp corrected scf/sto-3g)
r = ds.compute("scf", "sto-3g", stoich="cp", program="psi4")

print("Jobs to be computed:")
print("\n".join(r.submitted) + "\n")
print("Jobs Already Done:")
print("\n".join(r.existing) + "\n")
github MolSSI / QCFractal / examples / parsl_torsiondrive / compute_torsion.py View on Github external
import qcfractal.interface as portal

# Build a interface to the server 
client = portal.FractalClient("localhost:7777", verify=False)

# Add a HOOH
hooh = portal.data.get_molecule("hooh.json")

# Geometric options
tdinput = {
    "initial_molecule": [hooh],
    "keywords": {
        "dihedrals": [[0, 1, 2, 3]],
        "grid_spacing": [90]
    },
    "optimization_spec": {
        "program": "geometric",
        "keywords": {
            "coordsys": "tric",
        }