Interfaces with ASE ===================== .. warning:: This tutorial requires Gaussian to be installed on your system. If Gaussian is NOT installed, delete that portion of the tutorial from your python file before running it. By default, it is expected that g16 is in your path. The goal of this tutorial is to demonstrate the use of the `pharmaforge` package in conjunction with the `dpdata` and `ase` packages to re-label data within the databse. If you haven't gone through the querying tutorial in the previous example, you should go and do that one now. Learning Objectives ------------------- - Learn how to use the `pharmaforge` package with `ase` to re-label data in the database. - Learn how to use the interface to `dpdata` to re-label data in the database. Required Files -------------- - The tutorial python script is located in examples/CalculationInterfaces Tutorial -------- To get started, we will first import the required packages. The script to do this is as follows: .. literalinclude:: ../../../../examples/CalculationInterfaces/setup_relabeling.py :language: python :end-before: Start Multiprocessing Psi4 with Multiprocessing Interface Example ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Next, we will use the Psi4 package to calculate the energy and the forces of the system. For large datasets it is recommended to use the parallel interface to pharmaforge to run over multiple threads. To do this, you only make one change to the code above, which is to add the num_workers=4 flag to call the interface with 4 workers. This uses `multiprocessing` to run the calculations in parallel with 4 workers. .. literalinclude:: ../../../../examples/CalculationInterfaces/setup_relabeling.py :language: python :start-after: Start Multiprocessing :end-before: End Multiprocessing .. note:: Here we show this for Psi4, but it is the same for most interfaces. Working Directly with queries ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Now, we will run the same example but using the query interface. It works essentially the same way, but now we use a call to the querly class instead to generate the data. Here we are querying the same data with the same query that we used to create saved_model.hdf5. .. literalinclude:: ../../../../examples/CalculationInterfaces/setup_relabeling.py :language: python :start-after: Start Multiprocessing from Query :end-before: End Multiprocessing from Query Gaussian Interface Example ^^^^^^^^^^^^^^^^^^^^^^^^^^ Next, we will use the Gaussian package to calculate the energy and the forces of the system. If you don't have Gaussian installed, this portion of the tutorial will fail. .. literalinclude:: ../../../../examples/CalculationInterfaces/setup_relabeling.py :language: python :start-after: Start Gaussian :end-before: End Gaussian XTB Interface Example ^^^^^^^^^^^^^^^^^^^^^ Next, we will use the XTB package to calculate the energy and the forces of the system. .. literalinclude:: ../../../../examples/CalculationInterfaces/setup_relabeling.py :language: python :start-after: Start XTB :end-before: End XTB See Also --------- To add data to the database, check out the Relabeling tutorial. Full Code --------- .. literalinclude:: ../../../../examples/CalculationInterfaces/setup_relabeling.py :language: python