01_getting_started.rst 4.51 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
.. default-domain:: py

.. _the-openmm-application-layer-introduction:

Getting Started
###############

Introduction
************

The first thing to understand about the OpenMM “application layer” is that it is
not exactly an application in the traditional sense: there is no program called
“OpenMM” that you run.  Rather, it is a collection of libraries written in the
Python programming language.  Those libraries can easily be chained together to
create Python programs that run simulations.  But don’t worry!  You don’t need
to know anything about Python programming (or programming at all) to use it.
Nearly all molecular simulation applications ask you to write some sort of
“script” that specifies the details of the simulation to run.  With OpenMM, that
script happens to be written in Python.  But it is no harder to write than those
for most other applications, and this guide will teach you everything you need
to know.  There is even a graphical interface that can write the script for you
based on a simple set of options (see Section :numref:`the-script-builder-application`),
so you never need to type a single line of code!

On the other hand, if you don’t mind doing a little programming, this approach
gives you enormous power and flexibility.  Your script has complete access to
the entire OpenMM application programming interface (API), as well as the full
power of the Python language and libraries.  You have complete control over
every detail of the simulation, from defining the molecular system to analyzing
the results.


.. _installing-openmm:

Installing OpenMM
*****************

38
39
40
41
42
43
OpenMM is installed using either the pip or conda package manager.  Pip is
normally included with all Python distributions.  The easiest way to get conda
is to use Miniconda (available from https://docs.conda.io/en/latest/miniconda.html),
a Python distribution with conda preinstalled.

(Another option is to compile OpenMM from source.  This provides more flexibility,
44
45
46
but it is much more work, and there is rarely a need for anyone but advanced users
to compile from source.  Detailed instruction are in Chapter :numref:`compiling-openmm-from-source-code`.)

47
\1. Begin by installing the most recent 64 bit, Python 3.x version of Miniconda.
48
49
50
51

\2. (Optional) If you want to run OpenMM on a GPU, make sure you have installed
modern drivers from your vendor.

52
  * If you have an NVIDIA GPU, download the latest drivers from
53
54
    https://www.nvidia.com/Download/index.aspx. CUDA itself will be installed
    automatically when you install :code:`openmm` in the next steps.
55
  * If you have an AMD GPU and are using Linux or Windows, download the latest
56
57
58
59
60
    version of the drivers from https://support.amd.com.  To use the HIP
    platform (recommended), you also need to install HIP/ROCm by following the
    instructions at https://rocm.docs.amd.com.
  * On macOS, OpenCL is included with the operating system and is supported on
    macOS 10.10.3 or later.
61

62
3.a. To install with conda, open a command line terminal and type the following command
63
64
65
66
67
68
69
70
71
72
::

    conda install -c conda-forge openmm

With recent :code:`conda` versions (v4.8.4+), this will install a version of
OpenMM compiled with the latest version of CUDA supported by your drivers.
Alternatively you can request a version that is compiled for a specific CUDA
version with the command
::

73
    conda install -c conda-forge openmm cuda-version=12
74

75
where :code:`12` should be replaced with the particular CUDA version
76
you want to target.  We build packages for CUDA 12 and above.  Because different
77
78
CUDA releases are not binary compatible with each other, OpenMM can only work
with the particular CUDA version it was compiled with.
79

80
81
82
83
3.b. To install with pip, open a command line terminal and type the following command
::

    pip install openmm
84

85
86
87
88
89
90
91
The package installed with that command includes the OpenCL, CPU, and Reference
platforms.  To also install the CUDA platform (recommended if you have an NVIDIA
GPU), type
::

    pip install openmm[cuda12]

92
This will install a copy of the CUDA platform compiled with CUDA 12.  :code:`cuda13`
93
94
is also available.  Alternatively, if you have an AMD GPU, specify :code:`hip6`
or :code:`hip7` to install the HIP platform (compiled with HIP version 6 or 7):
95
::
96

97
    pip install openmm[hip6]
98
99
100
101
102
103
104

4. Verify your installation by typing the following command:
::

    python -m openmm.testInstallation

This command confirms that OpenMM is installed, checks whether GPU acceleration
105
is available (via the CUDA, OpenCL, and/or HIP platforms), and verifies that all
106
107
platforms produce consistent results.