> For the complete documentation index, see [llms.txt](https://anufrievroman.gitbook.io/freepaths/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://anufrievroman.gitbook.io/freepaths/advanced-tutorials/parametric-sweep.md).

# Parametric sweep

The `examples/sweep_parameter_script.py`, shows an example of how one can run several simulations one after another so that the input file remains the same except for one parameter. In this example, we sweep the temperature parameter `T` in the input file called `point_line.py` as defined as `temperatures = [4, 100, 200, 300]` list. Below, a typical script is provided:

```
import subprocess

FILENAME = "point_line.py"

def update_config_file(config_file, temperature):
    with open(config_file, 'r') as f:
        lines = f.readlines()
    for i, line in enumerate(lines):
        if line.startswith("OUTPUT_FOLDER_NAME"):
            lines[i] = f"OUTPUT_FOLDER_NAME = '{temperature}'\n"
        if line.startswith("T "):
            lines[i] = f"T = {temperature}\n"

    with open(config_file, 'w') as f:
        f.writelines(lines)

temperatures = [4, 100, 200, 300]
for temp in temperatures:
    update_config_file(FILENAME, temp)
    subprocess.run(['python', '-m', 'freepaths', FILENAME])
```

Essentially, for each temperature, the script changes and saves the input file, runs the simulation, and proceeds to the next temperature. Note, that this is not an input file, this is a separate python script that runs the simulations, so you must launch it as:

```
python sweep_parameter_script.py
```

As a result, several folders will appear in the `Results` folder for different temperatures.


---

# 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://anufrievroman.gitbook.io/freepaths/advanced-tutorials/parametric-sweep.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.
