You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+35-19
Original file line number
Diff line number
Diff line change
@@ -65,10 +65,12 @@ For this example to work, you will need:
65
65
</ul>
66
66
</details>
67
67
68
-
69
68
### Converted Workflow with ZnTrack
70
69
71
-
To make this workflow reproducible, we convert it into a **directed graph structure** where each step is represented as a **Node**. Nodes define their inputs, outputs, and the computational logic to execute. Here's the graph structure for our example:
70
+
To make this workflow reproducible, we convert it into a **directed graph
71
+
structure** where each step is represented as a **Node**. Nodes define their
72
+
inputs, outputs, and the computational logic to execute. Here's the graph
In ZnTrack, each **Node** is defined as a Python class. The class attributes define the **inputs** (parameters and dependencies) and **outputs**, while the `run` method contains the computational logic to be executed.
84
+
In ZnTrack, each **Node** is defined as a Python class. The class attributes
85
+
define the **inputs** (parameters and dependencies) and **outputs**, while the
86
+
`run` method contains the computational logic to be executed.
83
87
84
-
> [!NOTE]
85
-
> ZnTrack uses Python dataclasses under the hood, providing an automatic `__init__` method. Starting from Python 3.11, most IDEs should reliably provide type hints for ZnTrack Nodes.
88
+
> [!NOTE] ZnTrack uses Python dataclasses under the hood, providing an automatic
89
+
> `__init__` method. Starting from Python 3.11, most IDEs should reliably
90
+
> provide type hints for ZnTrack Nodes.
86
91
87
-
> [!TIP]
88
-
> For files produced during the `run` method, ZnTrack provides a unique **Node Working Directory** (`zntrack.nwd`). Always use this directory to store files to ensure reproducibility and avoid conflicts.
92
+
> [!TIP] For files produced during the `run` method, ZnTrack provides a unique
93
+
> **Node Working Directory** (`zntrack.nwd`). Always use this directory to store
94
+
> files to ensure reproducibility and avoid conflicts.
89
95
90
96
```python
91
97
import zntrack
@@ -170,18 +176,22 @@ class StructureOptimization(zntrack.Node):
170
176
171
177
#### Building and Running the Workflow
172
178
173
-
Now that we’ve defined all the necessary Nodes, we can build and execute the workflow. Follow these steps:
179
+
Now that we’ve defined all the necessary Nodes, we can build and execute the
180
+
workflow. Follow these steps:
174
181
175
182
1.**Initialize a new directory** for your project:
183
+
176
184
```bash
177
185
git init
178
186
dvc init
179
187
```
180
188
181
-
2.**Create a Python module** for the Node definitions:
189
+
1.**Create a Python module** for the Node definitions:
190
+
182
191
- Create a file `src/__init__.py` and place the Node definitions inside it.
183
192
184
-
3.**Define and execute the workflow** in a `main.py` file:
193
+
1.**Define and execute the workflow** in a `main.py` file:
194
+
185
195
```python
186
196
import zntrack
187
197
from src importMACE_MP, Smiles2Conformers, Pack, StructureOptimization
@@ -202,14 +212,18 @@ Now that we’ve defined all the necessary Nodes, we can build and execute the w
202
212
project.repro()
203
213
```
204
214
205
-
> **TIP**
206
-
> If you don’t want to execute the graph immediately, use `project.build()` instead. You can run the graph later using `dvc repro` or the [paraffin](https://github.com/zincware/paraffin) package.
215
+
> **TIP** If you don’t want to execute the graph immediately, use
216
+
> `project.build()` instead. You can run the graph later using `dvc repro` or
217
+
> the [paraffin](https://github.com/zincware/paraffin) package.
207
218
208
219
#### Accessing Results
209
220
210
-
Once the workflow has been executed, the results are stored in the respective files. For example, the optimized trajectory is saved in `nodes/StructureOptimization/frames.traj`.
221
+
Once the workflow has been executed, the results are stored in the respective
222
+
files. For example, the optimized trajectory is saved in
223
+
`nodes/StructureOptimization/frames.traj`.
211
224
212
-
You can load the results directly using ZnTrack, without worrying about file paths or formats:
225
+
You can load the results directly using ZnTrack, without worrying about file
0 commit comments