From 991cb8ae6f08d43bb84347a086609e3e36b35984 Mon Sep 17 00:00:00 2001 From: janash Date: Wed, 15 May 2024 02:26:25 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20MolSSI-M?= =?UTF-8?q?DI/ani-driver-tutorial@f66ed51cab7361c74d806e514d0c5d782daed5f4?= =?UTF-8?q?=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _sources/energy_calculations.md.txt | 13 +- _sources/mdimechanic.md.txt | 95 ++++ driver_tutorial.html | 34 +- energy_calculations.html | 57 ++- genindex.html | 30 +- index.html | 30 +- mdimechanic.html | 673 ++++++++++++++++++++++++++++ objects.inv | Bin 343 -> 364 bytes search.html | 30 +- searchindex.js | 2 +- setup.html | 36 +- 11 files changed, 927 insertions(+), 73 deletions(-) create mode 100644 _sources/mdimechanic.md.txt create mode 100644 mdimechanic.html diff --git a/_sources/energy_calculations.md.txt b/_sources/energy_calculations.md.txt index 3ee5d25..bbec43a 100644 --- a/_sources/energy_calculations.md.txt +++ b/_sources/energy_calculations.md.txt @@ -14,7 +14,7 @@ These XYZ files come from a [database of water cluster minima](https://sites.uw. ## Energy Calculation and Benchmarking Script -Open the script `xyz/energy_calculations.py` to see the starting code for this section. +Open the script `energy/energy_calculations.py` to see the starting code for this section. The starting code includes functions for caluculating the energy of a system using ANI and Psi4. :::{tab-set} @@ -22,7 +22,7 @@ The starting code includes functions for caluculating the energy of a system usi ````{tab-item} xyz/energy_calculations.py ```python """ -Retrieve xyz from a URL and calculate the energy using ANI +Calculate energies using Psi4 and ANI2x for water clusters. """ import glob @@ -142,7 +142,7 @@ def calculate_Psi4_energy(xyz_file, name=None): if __name__ == "__main__": - xyz_files = glob.glob("scaling/*.xyz") + xyz_files = glob.glob("xyz/scaling/*.xyz") energies = [] times = [] @@ -205,6 +205,7 @@ if __name__ == "__main__": plt.legend() plt.savefig("timing.png") + ``` ```` ::: @@ -213,7 +214,7 @@ Run this script by opening the MDI Mechanic container in interactive mode. :::{tab-set} -````{tab-item} ANI Energy Calculation +````{tab-item} bash ```bash mdi interactive ``` @@ -224,9 +225,9 @@ Next, `cd` to the `xyz` directory and run the script. :::{tab-set} -````{tab-item} ANI Energy Calculation +````{tab-item} bash ```bash -cd xyz +cd energy python energy_calculations.py ``` ```` diff --git a/_sources/mdimechanic.md.txt b/_sources/mdimechanic.md.txt new file mode 100644 index 0000000..5e8a3ba --- /dev/null +++ b/_sources/mdimechanic.md.txt @@ -0,0 +1,95 @@ +# Using MDIMechanic + +:::{admonition} Prerequisites +:class: note + +Before completing this section, make sure you have completed the setup instructions in the [previous section](setup.md). +::: + +In this tutorial, we will use the MDIMechanic package to run our code. +MDIMechanic is a Python package that provides an interface for running environments and MDI Engines. +It orchestrates Docker containers using a streamlined set up process. + +The file `mdimechanic.yml` contains the configuration for the MDIMechanic environment. + + +To get started, execute the following command in your terminal: + +:::{tab-set} + +````{tab-item} bash + +```bash +mdimechanic build +``` +```` +::: + +While your image is building, we can examine the `mdimechanic.yaml` file to see what is happening. +Looking at the file, you will see the following: + +```yaml +code_name: 'mdi-ani-tutorial' +docker: + image_name: 'mdi-ani-tutorial' + + build_image: + - apt-get update && apt-get install -y curl + - curl "http://vergil.chemistry.gatech.edu/psicode-download/Psi4conda-1.9.1-py311-Linux-x86_64.sh" -o Psi4conda-1.9.1-py311-Linux-x86_64.sh --keepalive-time 2 + - bash Psi4conda-1.9.1-py311-Linux-x86_64.sh -b -p $HOME/psi4conda + - echo $'. $HOME/psi4conda/etc/profile.d/conda.sh\nconda activate' >> ~/.bashrc + - source ~/.bashrc + - /root/psi4conda/bin/pip install pymdi + - /root/psi4conda/bin/pip install numpy + - /root/psi4conda/bin/pip install torch --index-url https://download.pytorch.org/whl/cpu + - /root/psi4conda/bin/pip install torchani + - /root/psi4conda/bin/pip install matplotlib + - /root/psi4conda/bin/pip install tabulate + - /root/psi4conda/bin/pip cache purge +``` + +This file specifies the name of the code, the Docker image to use, and the commands to run to build the image. +The Docker image is built from a base image for MDI that has compilers and other necessary software installed. +The `build_image` section specifies the commands to run to install the necessary software for the tutorial. +We are installing Psi4, pymdi, numpy, torch, torchani, and matplotlib. +Notice that this container is configured to install the CPU version of PyTorch (to save space and improve build time). + +## Using the Image + +MDIMechanic has a command called `mdimechanic interactive` that will mount your local directory as a volume in the container and open a shell in the container. +Execute MDIMechanic interactive with the following command: + +:::{tab-set} + +````{tab-item} bash + +```bash +mdimechanic interactive +``` +```` +::: + +You are now in the container and can use the software installed. +Check the directory contents using `ls` and confirm that it is the same as your local directory. + +Open a Python interpreter and confirm that you can import torch and Psi4: + +:::{tab-set} + +````{tab-item} python + +```python +import torch +import psi4 +``` +```` +::: + +If you can import these packages, you have successfully set up your environment and are ready to run the tutorial. + +The other important section in `mdimechanic.yml` is the `run_scripts` section. +In that section, you will see commands for launching LAMMPS as well as the MDI Driver we will be writing. +If you are familiar with Docker, you may be interested to know that this section is used to specify a configuration for Docker Compose. +It will be discussed further in the [Driver Tutorial](driver_tutorial.md). + +In the next section, we will use MDI Mechanic and the `mdimechanic interactive` mode to run Psi4 and ANI for energy calculations. \ No newline at end of file diff --git a/driver_tutorial.html b/driver_tutorial.html index 4da9622..25c0854 100644 --- a/driver_tutorial.html +++ b/driver_tutorial.html @@ -158,15 +158,15 @@ - @@ -176,6 +176,13 @@