> For the complete documentation index, see [llms.txt](https://devdocs.olisystems.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devdocs.olisystems.com/chemistry-model-files/chembuilder-api/getting-started-with-chembuilder/choose-redox.md).

# Choose Redox

Redox offers the capability to specify all oxidation states for a chemical element. A sample code featuring a Redox field is available below.

```json
{
  "params": {
    "thermodynamicFramework": "MSE (H3O+ ion)",
    "modelName": "testModel",
    "phases": [
      "liquid1",
      "vapor",
      "solid",
      "liquid2"
    ],
    "inflows": [
      {
        "name": "H2O"
      },
      {
        "name": "NACL"
      },
      {
        "name": "UREA"
      },
      {
        "name": "NH3"
      },
      {
        "name": "CO2"
      },
      {
        "name": "CACO3"
      },
      {
        "name": "Benzene"
      },
      {
        "name": "Ethanol"
      }
    ],
    "redox": {
      "enabled": "true",
      "subSystems": [
        {
          "name": "Chlorine",
          "enabled": false,
          "valenceStates": [
            {
              "name": "Cl(-1)",
              "enabled": true
            },
            {
              "name": "Cl(+1)",
              "enabled": false
            },
            {
              "name": "Cl(+7)",
              "enabled": true
            }
          ]
        },
        {
          "name": "Calcium",
          "enabled": true,
          "valenceStates": [
            {
              "name": "Ca(0)",
              "enabled": true
            },
            {
              "name": "Ca(+2)"
            }
          ]
        },
        {
          "name": "Nitrogen",
          "valenceStates": [
            {
              "name": "N(-3)",
              "enabled": true
            },
            {
              "name": "N(-2)"
            },
            {
              "name": "N(-1)",
              "enabled": true
            },
            {
              "name": "N",
              "enabled": true
            },
            {
              "name": "N(+1)",
              "enabled": true
            },
            {
              "name": "N(+2)"
            },
            {
              "name": "N(+3)",
              "enabled": true
            },
            {
              "name": "N(+4)"
            },
            {
              "name": "N(+5)",
              "enabled": true
            }
          ]
        }
      ]
    }
  }
}
```

{% hint style="info" %}
The Redox field is optional for generating .dbs files.
{% endhint %}

If Redox is enabled, the "subSystems" object becomes mandatory. Within this object, users must include the name along with a list of all valence states.

| redox      |    always required   | type                 |
| ---------- | :------------------: | -------------------- |
| subSystems | :heavy\_check\_mark: | Array of JSON Object |

Subsystem properties

| subSystems    |    always required   | type                 |
| ------------- | :------------------: | -------------------- |
| name          | :heavy\_check\_mark: | String               |
| valenceStates | :heavy\_check\_mark: | Array of JSON Object |

{% hint style="info" %}
Enabling a subSystem element automatically enables all of its valence states by default.
{% endhint %}

{% hint style="info" %}
To disable specific valence states, the user must explicitly set `"enabled": false`.
{% endhint %}

{% hint style="info" %}
Please refer to [Redox Query](/chemistry-model-files/chembuilder-api/chembuilder-query/redox-query.md) for information on element availability and its valence states. The output of a Redox Query can be directly inserted into the JSON input for generating .dbs files, as the JSON structure of both datasets is identical.
{% endhint %}

{% hint style="info" %}
The JSON object of Redox and its internal JSON objects can be enabled or disabled using ["enabled" Keyword](/chemistry-model-files/chembuilder-api/supporting-information-for-chembuilder/enabled-keyword.md)
{% endhint %}


---

# 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://devdocs.olisystems.com/chemistry-model-files/chembuilder-api/getting-started-with-chembuilder/choose-redox.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.
