> This page is for NVIDIA NIM for Batched Geometry Relaxation, version 1.1.0 (Latest) (default).
> For other versions, use one of these documentation indexes:
> - 1.1.0 (Latest) (default): https://docs.nvidia.com/nim/alchemi/alchemi-bgr/1.1.0/llms.txt
> - 1.0.0: https://docs.nvidia.com/nim/alchemi/alchemi-bgr/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/alchemi/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nim/alchemi/_mcp/server.

# Process Request

POST /v1/infer
Content-Type: application/json

Perform batched geometry relaxation using MLIP models and FIRE2 optimizer.

Reference: https://docs.nvidia.com/nim/alchemi/alchemi-bgr/api-reference/process-request-v-1-infer-post

## Request

### Body (application/json)

This endpoint expects a BGRRequest.

- `atoms` (list of BGRAtomicData, required) — List of atomic structures to optimize.
- `info` (string, optional, nullable)
- `opttol` (double, optional, nullable) — Per-request force tolerance for geometry optimization in eV/Å. Overrides global config.
- `opttol_pressure` (double, optional, nullable) — Per-request pressure tolerance for cell optimization in kBar. Overrides global config.
- `cellopt` (boolean, optional, nullable) — Per-request cell optimization flag. Overrides global config.

## Response

### 200

Successful Response

- `atoms` (list of BGRResult, required) — List of optimized atomic structures.
- `info` (string, optional, nullable)
- `status` (string, optional, default: Success)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (HttpValidationErrorDetail, optional)

### 503 Service Unavailable Error

Backend unavailable or recovering

- `detail` (string, required) — Error detail.

## Types

### BGRAtomicData

- `coord` (list of double, required) — Cartesian coordinates of the atoms in Angstrom, flattened list [x1, y1, z1, x2, y2, z2, ...].
- `numbers` (list of integer, required) — Atomic numbers of the atoms.
- `charge` (integer, optional, nullable, default: 0) — Charge of the system. Default is 0.
- `mult` (integer, optional, nullable, default: 1) — Spin multiplicity of the system (2S+1). Default is 1.
- `cell` (list of double, optional, nullable) — Unit cell parameters in Angstrom, flattened list (9 elements). Required when backend PBC mode is enabled and forbidden when it is disabled.
- `pbc` (list of boolean, optional, nullable, default: [true,true,true]) — Periodic axes for a supplied cell, ordered as [x, y, z]. This field does not override backend PBC mode. Defaults to [True, True, True].
- `structure_id` (string, optional, nullable) — Unique string identifier for the structure. Defaults to empty string.
- `active_mask` (list of boolean, optional, nullable) — Mask indicating which atoms are active in the optimization. If None, all atoms are active.

### BGRResult

- `coord` (list of double, required) — Cartesian coordinates of the atoms in Angstrom, flattened list [x1, y1, z1, x2, y2, z2, ...].
- `numbers` (list of integer, required) — Atomic numbers of the atoms.
- `converged` (boolean, required) — Flag indicating convergence of optimization.
- `optimizer_nsteps` (integer, required) — Number of optimization steps taken.
- `energy` (double, required) — Energy of the optimized structure in eV.
- `forces` (list of double, required) — Forces on the atoms in eV/Å
- `charge` (integer, optional, nullable, default: 0) — Charge of the system. Default is 0.
- `mult` (integer, optional, nullable, default: 1) — Spin multiplicity of the system (2S+1). Default is 1.
- `cell` (list of double, optional, nullable) — Unit cell parameters in Angstrom, flattened list (9 elements). Required when backend PBC mode is enabled and forbidden when it is disabled.
- `pbc` (list of boolean, optional, nullable, default: [true,true,true]) — Periodic axes for a supplied cell, ordered as [x, y, z]. This field does not override backend PBC mode. Defaults to [True, True, True].
- `structure_id` (string, optional, nullable) — Unique string identifier for the structure. Defaults to empty string.
- `active_mask` (list of boolean, optional, nullable) — Mask indicating which atoms are active in the optimization. If None, all atoms are active.
- `stress` (list of double, optional, nullable) — Stress on the unit cell in eV/Å³. If None, no stress was computed.
- `charges` (list of double, optional, nullable) — Partial charges on the atoms. If None, no charges were computed.

### HttpValidationErrorDetail

- list of ValidationError
- string
- map from string to any

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### ValidationErrorLocItems

- string
- integer

## Examples

**Request**

```json
{
  "atoms": [
    {
      "coord": [
        0,
        0,
        0,
        1.42,
        0,
        0,
        0.71,
        1.23,
        0,
        2.13,
        1.23,
        0
      ],
      "numbers": [
        6,
        6,
        6,
        6
      ]
    }
  ]
}
```

**Response**

```json
{
  "atoms": [
    {
      "coord": [
        0,
        0,
        0,
        1.421,
        0,
        0,
        0.7105,
        1.2312,
        0,
        2.1315,
        1.2312,
        0
      ],
      "numbers": [
        6,
        6,
        6,
        6
      ],
      "converged": true,
      "optimizer_nsteps": 42,
      "energy": -36.847,
      "forces": [
        0.0012,
        -0.0008,
        0.0001,
        -0.0011,
        0.0009,
        0.0001,
        0.001,
        -0.0007,
        0.0001,
        -0.0011,
        0.0006,
        0.0001
      ],
      "charge": 0,
      "mult": 1,
      "cell": [
        4.26,
        0,
        0,
        0,
        4.92,
        0,
        0,
        0,
        20
      ],
      "pbc": [
        true,
        true,
        false
      ],
      "structure_id": "graphene_unit_cell_001",
      "active_mask": [
        true,
        true,
        true,
        true
      ],
      "stress": [
        -0.0023,
        -0.0021,
        -0.0001,
        0,
        0,
        0.0001
      ],
      "charges": [
        -0.012,
        -0.011,
        -0.013,
        -0.01
      ]
    }
  ],
  "info": "Geometry relaxation completed successfully using MACE-MP-0 model with FIRE2 optimizer.",
  "status": "Success"
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/v1/infer"

payload = { "atoms": [
        {
            "coord": [0, 0, 0, 1.42, 0, 0, 0.71, 1.23, 0, 2.13, 1.23, 0],
            "numbers": [6, 6, 6, 6]
        }
    ] }
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.example.com/v1/infer';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"atoms":[{"coord":[0,0,0,1.42,0,0,0.71,1.23,0,2.13,1.23,0],"numbers":[6,6,6,6]}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/infer"

	payload := strings.NewReader("{\n  \"atoms\": [\n    {\n      \"coord\": [\n        0,\n        0,\n        0,\n        1.42,\n        0,\n        0,\n        0.71,\n        1.23,\n        0,\n        2.13,\n        1.23,\n        0\n      ],\n      \"numbers\": [\n        6,\n        6,\n        6,\n        6\n      ]\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/infer")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"atoms\": [\n    {\n      \"coord\": [\n        0,\n        0,\n        0,\n        1.42,\n        0,\n        0,\n        0.71,\n        1.23,\n        0,\n        2.13,\n        1.23,\n        0\n      ],\n      \"numbers\": [\n        6,\n        6,\n        6,\n        6\n      ]\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/infer")
  .header("Content-Type", "application/json")
  .body("{\n  \"atoms\": [\n    {\n      \"coord\": [\n        0,\n        0,\n        0,\n        1.42,\n        0,\n        0,\n        0.71,\n        1.23,\n        0,\n        2.13,\n        1.23,\n        0\n      ],\n      \"numbers\": [\n        6,\n        6,\n        6,\n        6\n      ]\n    }\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/infer', [
  'body' => '{
  "atoms": [
    {
      "coord": [
        0,
        0,
        0,
        1.42,
        0,
        0,
        0.71,
        1.23,
        0,
        2.13,
        1.23,
        0
      ],
      "numbers": [
        6,
        6,
        6,
        6
      ]
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/v1/infer");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"atoms\": [\n    {\n      \"coord\": [\n        0,\n        0,\n        0,\n        1.42,\n        0,\n        0,\n        0.71,\n        1.23,\n        0,\n        2.13,\n        1.23,\n        0\n      ],\n      \"numbers\": [\n        6,\n        6,\n        6,\n        6\n      ]\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["atoms": [
    [
      "coord": [0, 0, 0, 1.42, 0, 0, 0.71, 1.23, 0, 2.13, 1.23, 0],
      "numbers": [6, 6, 6, 6]
    ]
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/infer")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```