> This page is for GenMol, version 2.0.0 (Latest) (default).
> For other versions, use one of these documentation indexes:
> - 2.0.0 (Latest) (default): https://docs.nvidia.com/nim/bionemo/genmol/2.0.0/llms.txt
> - 1.0.1: https://docs.nvidia.com/nim/bionemo/genmol/1.0.1/llms.txt
> - 1.0.0: https://docs.nvidia.com/nim/bionemo/genmol/1.0.0/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nim/bionemo/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nim/bionemo/_mcp/server.

# Getting Started

This section describes how to launch GenMol NIM v2.0.0 and submit your first request.

## Prerequisites

Review the [Prerequisites](/nim/bionemo/genmol/prerequisites) and [Support Matrix](/nim/bionemo/genmol/support-matrix) before launching the container.

## Launch GenMol NIM

1. Authenticate with the NGC container registry.

```bash
docker login nvcr.io --username '$oauthtoken' --password $NGC_API_KEY
```

2. Pull the NIM container.

```bash
export LOCAL_NIM_CACHE=~/.cache/nim/genmol
mkdir -p "$LOCAL_NIM_CACHE"
```


3. Run the container with a persistent cache mount.

<Note>
Set `NGC_API_KEY` in your shell before launching the container. For more information, refer to the [NGC personal API key guide](https://docs.nvidia.com/ngc/gpu-cloud/ngc-user-guide/index.html#generating-personal-api-key).
</Note>

```bash
export LOCAL_NIM_CACHE=~/.cache/nim/genmol
mkdir -p "$LOCAL_NIM_CACHE"
chmod 777 "$LOCAL_NIM_CACHE"
```


```bash
docker run --rm -it --name genmol-nim \
  --runtime=nvidia --gpus=all \
  -e NVIDIA_VISIBLE_DEVICES=0 \
  --shm-size=2G \
  --ulimit memlock=-1 \
  --ulimit stack=67108864 \
  -e NGC_API_KEY=$NGC_API_KEY \
  -e NIM_HTTP_API_PORT=8000 \
  -v "$LOCAL_NIM_CACHE:/opt/nim/.cache" \
  -p 8000:8000 \
  nvcr.io/nim/nvidia/genmol:2.0.0
```


4. Open a new terminal and wait for the service to become ready.

```bash
curl localhost:8000/v1/health/ready
```

Example output:

```text
true
```

## Run Inference in Linux Shell

```bash
curl --silent --request POST \
  --url 'http://127.0.0.1:8000/generate' \
  --header 'Content-Type: application/json' \
  --output output.json \
  --data '{
    "smiles": "CCS2(=O)(=O).C134CN2C1.C3C#N.[*{15-15}]",
    "num_molecules": 10,
    "temperature": 1.0,
    "noise": 1.0,
    "scoring": "QED"
  }'
```

Example response:

```json
{
  "status": "success",
  "molecules": [
    {
      "smiles": "CCS(=O)(=O)N1CC(CC#N)(c2ccc(Cl)c(F)c2)C1",
      "score": 0.856
    }
  ]
}
```

## Run Inference With Python

```python
import json
import requests

session = requests.Session()
response = session.post(
    "http://127.0.0.1:8000/generate",
    headers={"Accept": "application/json"},
    json={
        "smiles": "CCS2(=O)(=O).C134CN2C1.C3C#N.[*{15-15}]",
        "num_molecules": 5,
        "temperature": 1.0,
        "noise": 1.0,
        "scoring": "QED",
    },
)

response.raise_for_status()
print(json.dumps(response.json(), indent=2))
```

## Input and Output Format

The input is a [SAFE](https://arxiv.org/abs/2310.10773) text sequence with masked fragments as a template for molecular generation. SAFE extends [SMILES](https://en.wikipedia.org/wiki/Simplified_Molecular_Input_Line_Entry_System) with explicit fragment and attachment-point structure. The masked fragment placeholder uses the form `[*{min_len-max_len}]`, where `min_len` and `max_len` specify the number of tokens to generate for that region.

If an empty template is provided, the model performs de novo generation. If a partial SAFE or SMILES template is provided, the model performs conditioned generation such as motif extension, scaffold decoration, or linker design.

## Stop the Container

When you are done, stop the container:

```bash
docker stop genmol-nim
```