In [2]:
import qcfractal.interface as ptl
client = ptl.FractalClient()
client
Out[2]:
We can query results from the database based off a variety of values, but for this example we will query a known result from the database.
In [20]:
record = client.query_results(id=1615129)[0]
record
Out[20]:
There are a variety of helped functions on this
In [21]:
record.get_molecule()
Out[21]:
In [37]:
print(f"Program: {record.program} Model: {record.method.upper()}/{record.basis} ({record.driver})")
Since the primary driver
of this computation a gradient
is in the record.return_result
slot as a NumPy array. In addition, all parsed intermediates quantities can be found in the record.properties
slot for intermediate data.
In [38]:
record.return_result[:3]
Out[38]:
In [28]:
record.properties.dict()
Out[28]:
Additional data such as the output of the quantum chemistry program can be queried as well:
In [34]:
print(record.get_stdout()[:245])
In [39]:
from qcfractal import FractalSnowflakeHandler
snowflake = FractalSnowflakeHandler()
client = snowflake.client()
client
Out[39]:
In [45]:
methane = ptl.Molecule.from_data("pubchem:methane")
methane
Out[45]:
To run a quantum chemistry computation on this methane molecule we need to specify the full input as shown below. It should be noted that this function is also organized in such a way where the computation of many molecules with the same level of theory is most efficient.
In [54]:
# program, method, basis, driver, keywords, molecule
compute = client.add_compute('psi4', 'hf', 'sto-3g', 'energy', None, [methane])
compute
Out[54]:
The id
s of the submitted compute can then be queried and examined. As a note the computation is not instantaneous, you may need to wait a moment and requery for this small molecule.
In [52]:
result = client.query_results(id=compute.ids)[0]
result
Out[52]:
In [51]:
result.return_result
Out[51]: