Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| technical:recipes:openmm [2024-07-29 14:15] – bkang | technical:recipes:openmm [2024-07-29 14:50] (current) – [VALET Package Definition] bkang | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== OpenMM Python Virtual Environment ====== | ||
| + | This page documents the creation of a Python virtual environment (virtualenv) containing the OpenMM software on the Caviness HPC system((The steps should also work on the DARWIN HPC system, though with different package versions.)). | ||
| + | |||
| + | ===== Prepare Workgroup Directory ===== | ||
| + | |||
| + | Prepare to add software in the standard sub-directories of the workgroup storage: | ||
| + | |||
| + | <code bash> | ||
| + | [user@login01 ~]$ workgroup -g my_workgroup | ||
| + | [(my_workgroup: | ||
| + | [(my_workgroup: | ||
| + | </ | ||
| + | |||
| + | These commands create any missing directories. | ||
| + | |||
| + | ===== Create Virtualenv ===== | ||
| + | |||
| + | The Python distribution will form the basis for the anaconda virtualenv, so add it to the environment: | ||
| + | |||
| + | <code bash> | ||
| + | [(my_workgroup: | ||
| + | Adding package `anaconda/ | ||
| + | </ | ||
| + | |||
| + | The virtual environment is first populated with all packages that **do not** require OpenMM. | ||
| + | |||
| + | <WRAP center round important 60%> | ||
| + | The two channel options are present to ensure only the default Anaconda channels are consulted -- otherwise the command could still pick packages from the Intel channel, for example, which would still have the binary compatibility issues! | ||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | $ conda create --prefix=$WORKDIR/ | ||
| + | Solving environment: | ||
| + | : | ||
| + | Proceed ([y]/n)? y | ||
| + | : | ||
| + | Preparing transaction: | ||
| + | Verifying transaction: | ||
| + | Executing transaction: | ||
| + | # | ||
| + | # To activate this environment, | ||
| + | # | ||
| + | # $ conda activate / | ||
| + | # | ||
| + | # To deactivate an active environment, | ||
| + | # | ||
| + | # $ conda deactivate | ||
| + | # | ||
| + | </ | ||
| + | |||
| + | |||
| + | Before building and installing OpenMM the environment needs to be activated: | ||
| + | |||
| + | <code bash> | ||
| + | $ conda activate $WORKDIR/ | ||
| + | (/ | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Building OpenMM ===== | ||
| + | |||
| + | With the new virtual environment activated, we can now build OpenMM. | ||
| + | |||
| + | <code base> | ||
| + | (/ | ||
| + | Solving environment: | ||
| + | : | ||
| + | Proceed ([y]/n)? y | ||
| + | : | ||
| + | Preparing transaction: | ||
| + | Verifying transaction: | ||
| + | Executing transaction: | ||
| + | |||
| + | done | ||
| + | </ | ||
| + | |||
| + | ===== VALET Package Definition ===== | ||
| + | |||
| + | The new virtual environment can easily be added to your login shell and job runtime environments using VALET. | ||
| + | Assuming the workgroup does //not// already have a OpenMM VALET package definition, the following text: | ||
| + | |||
| + | <file openmm.vpkg_yaml> | ||
| + | openmm: | ||
| + | prefix: / | ||
| + | description: | ||
| + | flags: | ||
| + | - no-standard-paths | ||
| + | actions: | ||
| + | - action: source | ||
| + | script: | ||
| + | sh: anaconda-activate-2020.sh | ||
| + | order: failure-first | ||
| + | success: 0 | ||
| + | versions: | ||
| + | " | ||
| + | description: | ||
| + | dependencies: | ||
| + | - anaconda/ | ||
| + | </ | ||
| + | |||
| + | would be added to '' | ||
| + | |||
| + | ===== Using the Virtual Environment ===== | ||
| + | |||
| + | The versions of the virtual environment declared in the VALET package are listed using the '' | ||
| + | |||
| + | <code bash> | ||
| + | $ vpkg_versions openmm | ||
| + | |||
| + | Available versions in package (* = default version): | ||
| + | |||
| + | [/ | ||
| + | openmm | ||
| + | * 20240726 | ||
| + | </ | ||
| + | |||
| + | You can import openmm, activating the virtual environment is accomplished using the '' | ||
| + | |||
| + | <code bash> | ||
| + | $ vpkg_require openmm/ | ||
| + | Adding dependency `anaconda/ | ||
| + | Adding package `openmm/ | ||
| + | (/ | ||
| + | ~/ | ||
| + | Python 3.12.4 | packaged by conda-forge | (main, Jun 17 2024, 10:23:07) [GCC 12.3.0] on linux | ||
| + | Type " | ||
| + | >>> | ||
| + | >>> | ||
| + | </ | ||