> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-de/wissenschaft-and-forschung/gromacs.md).

# GROMACS-Molekulardynamik

> **GPU-beschleunigte Molekulardynamik-Simulationen — von der Proteinfaltung bis zur Arzneimittelforschung**

GROMACS (GROningen-Maschine für chemische Simulationen) ist das weltweit am häufigsten verwendete Paket für Molekulardynamik-Simulationen. Ursprünglich an der Universität Groningen entwickelt, wird es heute von einer globalen Community gepflegt und ist das Arbeitspferd der computergestützten Chemie- und Strukturbiologie-Labore weltweit.

Mit GPU-Beschleunigung kann GROMACS Systeme mit Millionen von Atomen mit Geschwindigkeiten simulieren, für die CPU-only-Hardware Wochen benötigen würde. Die günstigen GPU-Mietangebote von Clore.ai machen groß angelegte MD-Simulationen für einzelne Forschende und kleine Labore zugänglich.

***

## Was können Sie simulieren?

* **Proteinfaltung und -dynamik** — beobachten Sie Konformationsänderungen im Nanosekunden- bis Mikrosekundenbereich
* **Bindung von Arzneistoffen an Proteine** — berechnen Sie Bindungsfreie Energien für die Arzneimittelforschung
* **Membransimulationen** — Lipiddoppelschichten, Membranproteine, Ionentransport
* **Protein-Protein-Interaktionen** — untersuchen Sie Komplexbildung und Grenzflächendynamik
* **Materialwissenschaft** — Polymere, Nanopartikel, Wassermodelle
* **Freie-Energie-Berechnungen** — alchemische Transformationen, PME

***

## Voraussetzungen

* Clore.ai-Konto mit GPU-Miete
* Grundlegende Kenntnisse der Linux-Kommandozeile
* Molekulare Systemdateien (Topologie + Koordinaten) oder verwenden Sie Beispielsysteme
* Optional: GROMACS lokal zur Visualisierung (VMD, Pymol)

***

## Warum GPU-beschleunigtes GROMACS verwenden?

GROMACS mit GPU-Offloading bietet dramatische Beschleunigungen:

| Systemgröße   | Nur CPU (ns/Tag) | Eine einzelne A100 (ns/Tag) | Beschleunigung |
| ------------- | ---------------- | --------------------------- | -------------- |
| 25.000 Atome  | \~50             | \~800                       | \~16x          |
| 100.000 Atome | \~15             | \~400                       | \~27x          |
| 500.000 Atome | \~3              | \~150                       | \~50x          |
| 1 Mio. Atome  | \~1              | \~80                        | \~80x          |

{% hint style="success" %}
**GPU-Beschleunigung ist besonders vorteilhaft für große Systeme (>100K Atome).** Bei kleinen Testsystemen kann die CPU-Leistung aufgrund des Datentransfer-Overheads vergleichbar sein.
{% endhint %}

***

## Schritt 1 — Miete eine GPU auf Clore.ai

1. Gehe zu [clore.ai](https://clore.ai) → **Marktplatz**
2. Nach GPU filtern: **A100, RTX 4090 oder RTX 3090** empfohlen
3. Für große Systeme (>500K Atome): wählen Sie A100 40 GB oder 80 GB
4. Für Standard-Simulationen bieten RTX 4090 oder RTX 3090 ein hervorragendes Preis-Leistungs-Verhältnis

**Empfohlene Spezifikationen:**

* GPU: A100 40 GB oder RTX 4090
* CPU: 16+ Kerne (GROMACS nutzt Mehrkernprozessoren für nicht-gebundene Wechselwirkungen)
* RAM: 32 GB+
* Festplatte: 50 GB+ (Trajektorien können groß sein)

***

## Schritt 2 — GROMACS-Container bereitstellen

Verwenden Sie das offizielle HPC-GROMACS-Image von NVIDIA — es ist für NVIDIA-GPUs mit CUDA-Unterstützung optimiert:

**Docker-Image:**

```
nvcr.io/hpc/gromacs:2023.2
```

**Freigegebene Ports:**

```
22
```

**Umgebungsvariablen:**

```
NVIDIA_VISIBLE_DEVICES=all
NVIDIA_DRIVER_CAPABILITIES=compute,utility
GMX_GPU_DD_COMMS=true
GMX_GPU_PME_PP_COMMS=true
GMX_FORCE_UPDATE_DEFAULT_GPU=true
```

{% hint style="info" %}
**NVIDIA-Umgebungsvariablen für GROMACS:**

* `GMX_GPU_DD_COMMS=true` — aktiviert GPU-basierte Domain-Decomposition-Kommunikation
* `GMX_GPU_PME_PP_COMMS=true` — aktiviert GPU-basierte PME-PP-Kommunikation
* `GMX_FORCE_UPDATE_DEFAULT_GPU=true` — erzwingt GPU-Koordinatenaktualisierung (deutlicher Geschwindigkeitsgewinn)
  {% endhint %}

***

## Schritt 3 — Verbinden und überprüfen

```bash
ssh root@<server-ip> -p <ssh-port>

# GROMACS-Version prüfen
gmx --version

# GPU-Verfügbarkeit prüfen
nvidia-smi

# Prüfen, ob GROMACS die GPU erkennen kann
gmx mdrun -h 2>&1 | grep -i gpu
```

Erwartete Ausgabe von `gmx --version` sollte zeigen:

```
GROMACS-Version: 2023.2
CUDA-Version: 11.x oder 12.x
GPU-Unterstützung: CUDA
```

***

## Schritt 4 — Bereiten Sie Ihr System vor

### Verwendung eines Beispielsystems (Lysozym in Wasser)

Dies ist das klassische GROMACS-Tutorialsystem — perfekt zum Testen Ihrer Einrichtung:

```bash
# Arbeitsverzeichnis erstellen
mkdir -p /workspace/lysozyme && cd /workspace/lysozyme

# Lysozym-PDB-Struktur herunterladen
wget https://files.rcsb.org/download/1AKI.pdb -O 1AKI.pdb

# Wassermoleküle aus der Kristallstruktur entfernen
grep -v HOH 1AKI.pdb > 1AKI_clean.pdb

# Topologie mit dem Kraftfeld AMBER99SB erzeugen
gmx pdb2gmx \\
    -f 1AKI_clean.pdb \\
    -o processed.gro \\
    -water spce \\
    -ff amber99sb-ildn
```

Wenn Sie zur Auswahl des Kraftfelds aufgefordert werden, wählen Sie `amber99sb-ildn` (typischerweise Option 6).

***

## Schritt 5 — Simulationsbox erstellen

```bash
# Simulationsbox definieren (Dodekaeder, 1.0 nm vom Protein entfernt)
gmx editconf \\
    -f processed.gro \\
    -o boxed.gro \\
    -c \\
    -d 1.0 \\
    -bt dodecahedron

# Die Box mit Wasser solvatisieren
gmx solvate \\
    -cp boxed.gro \\
    -cs spc216.gro \\
    -o solvated.gro \\
    -p topol.top

# Ionen hinzufügen, um die Ladung zu neutralisieren
# Zuerst TPR-Datei für das Hinzufügen von Ionen erstellen
gmx grompp \\
    -f /usr/local/gromacs/share/gromacs/top/em.mdp \\
    -c solvated.gro \\
    -p topol.top \\
    -o ions.tpr

# Na+- und Cl--Ionen hinzufügen (0,15 M NaCl)
gmx genion \\
    -s ions.tpr \\
    -o ionized.gro \\
    -p topol.top \\
    -pname NA \\
    -nname CL \\
    -neutral \\
    -conc 0.15
# Wählen Sie bei Aufforderung Gruppe 13 (SOL) aus
```

***

## Schritt 6 — Energie-Minimierung

```bash
# MDP-Datei für die Energie-Minimierung erstellen
cat > em.mdp << 'EOF'
; Parameter der Energie-Minimierung
integrator      = steep         ; Minimierung mit steilstem Abstieg
emtol           = 1000.0        ; Abbrechen, wenn die maximale Kraft < 1000 kJ/mol/nm ist
emstep          = 0.01          ; Anfangsschrittweite
nsteps          = 50000         ; Maximale Minimierungsschritte
nstlist         = 1
cutoff-scheme   = Verlet
ns_type         = grid
coulombtype     = PME
rcoulomb        = 1.0
rvdw            = 1.0
pbc             = xyz
EOF

# TPR für die Energie-Minimierung vorbereiten
gmx grompp \\
    -f em.mdp \\
    -c ionized.gro \\
    -p topol.top \\
    -o em.tpr

# Energie-Minimierung auf der GPU ausführen
gmx mdrun \\
    -v \\
    -deffnm em \\
    -gpu_id 0 \\
    -ntmpi 1 \\
    -ntomp 8

# Prüfen, ob die Energie konvergiert ist
gmx energy -f em.edr -o em_potential.xvg
# Wählen Sie 10 (Potential) und dann 0 zum Beenden
```

***

## Schritt 7 — NVT-Gleichgewichtseinstellung (Temperatur)

```bash
cat > nvt.mdp << 'EOF'
; NVT-Gleichgewichtseinstellung
define              = -DPOSRES      ; Positionsrestriktionen
integrator          = md            ; Leap-Frog-Integrator
nsteps              = 50000         ; 100 ps (2-fs-Zeitschritt)
dt                  = 0.002         ; 2-fs-Zeitschritt
nstxout             = 500
nstvout             = 500
nstenergy           = 500
nstlog              = 500
continuation        = no
constraint_algorithm = lincs
constraints         = h-bonds
lincs_iter          = 1
lincs_order         = 4
cutoff-scheme       = Verlet
ns_type             = grid
nstlist             = 10
rcoulomb            = 1.0
rvdw                = 1.0
DispCorr            = EnerPres
coulombtype         = PME
pme_order           = 4
fourierspacing      = 0.16
tcoupl              = V-rescale
tc-grps             = Protein Non-Protein
tau_t               = 0.1 0.1
ref_t               = 300 300
pcoupl              = no
pbc                 = xyz
EOF

gmx grompp \\
    -f nvt.mdp \\
    -c em.gro \\
    -r em.gro \\
    -p topol.top \\
    -o nvt.tpr

gmx mdrun \\
    -deffnm nvt \\
    -gpu_id 0 \\
    -ntmpi 1 \\
    -ntomp 8 \\
    -nb gpu \\
    -bonded gpu \\
    -pme gpu \\
    -update gpu
```

***

## Schritt 8 — NPT-Gleichgewichtseinstellung (Druck)

```bash
cat > npt.mdp << 'EOF'
; NPT-Gleichgewichtseinstellung
define              = -DPOSRES
integrator          = md
nsteps              = 50000
dt                  = 0.002
nstxout             = 500
nstvout             = 500
nstenergy           = 500
nstlog              = 500
continuation        = yes
constraint_algorithm = lincs
constraints         = h-bonds
cutoff-scheme       = Verlet
ns_type             = grid
nstlist             = 10
rcoulomb            = 1.0
rvdw                = 1.0
DispCorr            = EnerPres
coulombtype         = PME
tcoupl              = V-rescale
tc-grps             = Protein Non-Protein
tau_t               = 0.1 0.1
ref_t               = 300 300
pcoupl              = Parrinello-Rahman
pcoupltype          = isotropic
tau_p               = 2.0
ref_p               = 1.0
compressibility     = 4.5e-5
refcoord_scaling    = com
pbc                 = xyz
EOF

gmx grompp \\
    -f npt.mdp \\
    -c nvt.gro \\
    -r nvt.gro \\
    -t nvt.cpt \\
    -p topol.top \\
    -o npt.tpr

gmx mdrun \\
    -deffnm npt \\
    -gpu_id 0 \\
    -ntmpi 1 \\
    -ntomp 8 \\
    -nb gpu \\
    -bonded gpu \\
    -pme gpu \\
    -update gpu
```

***

## Schritt 9 — Produktions-MD-Lauf

```bash
cat > md.mdp << 'EOF'
; Produktions-MD-Lauf
integrator          = md
nsteps              = 5000000      ; 10 ns (2-fs-Zeitschritt)
dt                  = 0.002
nstxout-compressed  = 5000        ; Koordinaten alle 10 ps speichern
nstenergy           = 5000
nstlog              = 5000
continuation        = yes
constraint_algorithm = lincs
constraints         = h-bonds
cutoff-scheme       = Verlet
ns_type             = grid
nstlist             = 10
rcoulomb            = 1.0
rvdw                = 1.0
DispCorr            = EnerPres
coulombtype         = PME
tcoupl              = V-rescale
tc-grps             = Protein Non-Protein
tau_t               = 0.1 0.1
ref_t               = 300 300
pcoupl              = Parrinello-Rahman
pcoupltype          = isotropic
tau_p               = 2.0
ref_p               = 1.0
compressibility     = 4.5e-5
pbc                 = xyz
EOF

gmx grompp \\
    -f md.mdp \\
    -c npt.gro \\
    -t npt.cpt \\
    -p topol.top \\
    -o md.tpr

# Vollständiger GPU-Offload-Produktionslauf
gmx mdrun \\
    -deffnm md \\
    -gpu_id 0 \\
    -ntmpi 1 \\
    -ntomp 16 \\
    -nb gpu \\
    -bonded gpu \\
    -pme gpu \\
    -update gpu \\
    -v
```

{% hint style="info" %}
**Fortschritt in Echtzeit überwachen:**

```bash
tail -f md.log | grep -E "(ns/day|Step|Time)"
```

{% endhint %}

***

## Schritt 10 — Analyse

### Grundlegende Trajektorienanalyse

```bash
# RMSD (Stabilität des Backbones über die Zeit)
gmx rms \\
    -s md.tpr \\
    -f md.xtc \\
    -o rmsd.xvg \\
    -tu ns
# Wählen Sie 4 (Backbone) für die Referenz- und die Fit-Gruppe

# RMSF (Flexibilität pro Residuum)
gmx rmsf \\
    -s md.tpr \\
    -f md.xtc \\
    -o rmsf.xvg \\
    -res
# Wählen Sie 4 (Backbone)

# Gyrationsradius (Kompaktheit)
gmx gyrate \\
    -s md.tpr \\
    -f md.xtc \\
    -o gyrate.xvg
# Wählen Sie 1 (Protein)

# Wasserstoffbrücken
gmx hbond \\
    -s md.tpr \\
    -f md.xtc \\
    -num hbonds.xvg
# Wählen Sie 1 (Protein) sowohl für Donor als auch Akzeptor
```

### XVG-Dateien plotten

```python
import numpy as np
import matplotlib.pyplot as plt

# RMSD-Daten laden
data = np.loadtxt('rmsd.xvg', comments=['@', '#'])
time = data[:, 0]      # in ns
rmsd = data[:, 1] * 10 # nm in Ångström umrechnen

plt.figure(figsize=(10, 4))
plt.plot(time, rmsd)
plt.xlabel('Zeit (ns)')
plt.ylabel('RMSD (Å)')
plt.title('Backbone-RMSD')
plt.grid(True, alpha=0.3)
plt.savefig('rmsd_plot.png', dpi=150, bbox_inches='tight')
```

### Ergebnisse übertragen

```bash
# Von Ihrem lokalen Rechner aus:
rsync -avz -e "ssh -p <ssh-port>" \\
    root@<server-ip>:/workspace/lysozyme/ \\
    ./md_results/
```

***

## Multi-GPU-Simulationen

Für sehr große Systeme verwenden Sie mehrere GPUs mit Domänenzerlegung:

```bash
# 4-GPU-Lauf (passen Sie -ntmpi an die Anzahl der GPUs an)
gmx mdrun \\
    -deffnm md \\
    -gpu_id 0123 \\
    -ntmpi 4 \\
    -ntomp 4 \\
    -nb gpu \\
    -bonded gpu \\
    -pme gpu \\
    -npme 1 \\
    -update gpu \\
    -v
```

{% hint style="warning" %}
**Multi-GPU-Effizienz:** Skalierung über 4 GPUs hinaus ist typischerweise nur für Systeme mit >1 Million Atomen vorteilhaft. Für kleinere Systeme ist eine einzelne High-End-GPU auf Clore.ai kosteneffizienter.
{% endhint %}

***

## Fehlerbehebung

### Schwerwiegender Fehler: Kein GPU-Offloading

```bash
# Prüfen, ob CUDA funktioniert
nvidia-smi
python3 -c "import ctypes; ctypes.CDLL('libcuda.so')"

# CPU-Fallback zum Testen erzwingen
gmx mdrun -deffnm md -ntmpi 1 -ntomp 16
```

### System explodiert / negative Volumina

Dies weist normalerweise auf ein Problem bei der Energie-Minimierung hin:

```bash
# Längere Minimierung mit kleinerer Schrittweite ausführen
# em.mdp bearbeiten: emstep = 0.001, emtol = 100
```

### Langsame Leistung

```bash
# GPU-Auslastung während des Laufs prüfen
watch -n 1 nvidia-smi

# GPU-Offload-Einstellungen optimieren
gmx mdrun -deffnm md -nb gpu -pme gpu -bonded gpu -update gpu \\
    -ntmpi 1 -ntomp $(nproc)
```

***

## Häufig verwendete Kraftfelder

| Kraftfeld        | Am besten geeignet für          |
| ---------------- | ------------------------------- |
| `amber99sb-ildn` | Proteine, allgemeine Verwendung |
| `charmm36m`      | Proteine + Lipidmembranen       |
| `gromos54a7`     | Arzneistoffähnliche Moleküle    |
| `oplsaa`         | Organische Moleküle, Lipide     |

***

## Kostenschätzung

| Simulation     | Systemgröße  | GPU      | Zeit     | Kosten  |
| -------------- | ------------ | -------- | -------- | ------- |
| 10-ns-Protein  | 25.000 Atome | RTX 3090 | \~2 Std. | \~$0.60 |
| 100-ns-Protein | 25.000 Atome | A100 40G | \~6h     | \~$4.50 |
| 100 ns Membran | 200K Atome   | A100 80G | \~12h    | \~$9    |
| 1 μs Protein   | 25.000 Atome | A100 80G | \~3 Tage | \~$55   |

***

## Zusätzliche Ressourcen

* [GROMACS-Dokumentation](https://manual.gromacs.org/)
* [GROMACS-Tutorials (Justin Lemkul)](http://www.mdtutorials.com/gmx/)
* [NVIDIA HPC GROMACS-Container](https://catalog.ngc.nvidia.com/orgs/hpc/containers/gromacs)
* [GROMACS GitHub](https://github.com/gromacs/gromacs)
* [Amber-Kraftfeldparameter](https://ambermd.org/)
* [CHARMM-GUI Membran-Builder](https://www.charmm-gui.org/)

***

*Die Ausführung von GROMACS auf Clore.ai ermöglicht es Forschern, auf A100- und RTX-4090-GPUs zu einem Bruchteil der Preise von AWS oder Azure zuzugreifen — wodurch lange MD-Simulationen für akademische Labore und einzelne Forscher wirtschaftlich tragfähig werden.*

***

## GPU-Empfehlungen für Clore.ai

| Anwendungsfall              | Empfohlene GPU   | Geschätzte Kosten bei Clore.ai            |
| --------------------------- | ---------------- | ----------------------------------------- |
| Entwicklung/Testen          | RTX 3090 (24 GB) | 0,07–0,21 $/GPU/Stunde                    |
| Standard-MD-Simulationen    | RTX 4090 (24 GB) | 0,14–0,42 $/GPU/Stunde                    |
| Große Systeme / Lange Läufe | A100 80GB        | [Bare Metal](https://clore.ai/bare-metal) |

> 💡 Alle Beispiele in diesem Leitfaden können bereitgestellt werden auf [Clore.ai](https://clore.ai/marketplace) GPU-Servern. Durchsuchen Sie verfügbare GPUs und mieten Sie stundenweise — keine Verpflichtungen, voller Root-Zugriff.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-de/wissenschaft-and-forschung/gromacs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
