# 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](https://devdocs.olisystems.com/chemistry-model-files/chembuilder-api/chembuilder-query/redox-query "mention") 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](https://devdocs.olisystems.com/chemistry-model-files/chembuilder-api/supporting-information-for-chembuilder/enabled-keyword "mention")
{% endhint %}
