Skip to content

Commit 5aa8b91

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 2215bf1 commit 5aa8b91

5 files changed

+59
-40
lines changed

docs/source/examples/01_Data_Loading_and_Selection.ipynb

+38-17
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,22 @@
3333
}
3434
],
3535
"source": [
36-
"import ipsuite as ips\n",
3736
"from zntrack.utils import cwd_temp_dir\n",
3837
"\n",
38+
"import ipsuite as ips\n",
39+
"\n",
3940
"temp_dir = cwd_temp_dir()\n",
4041
"\n",
41-
"import ipsuite as ips\n",
4242
"\n",
4343
"import os\n",
44+
"\n",
4445
"from ase import units\n",
4546
"from ase.calculators.emt import EMT\n",
4647
"from ase.io.trajectory import TrajectoryWriter\n",
4748
"from ase.lattice.cubic import FaceCenteredCubic\n",
48-
"from ase.md.velocitydistribution import MaxwellBoltzmannDistribution\n",
4949
"from ase.md.langevin import Langevin\n",
50-
"from ase.visualize import view\n"
50+
"from ase.md.velocitydistribution import MaxwellBoltzmannDistribution\n",
51+
"from ase.visualize import view"
5152
]
5253
},
5354
{
@@ -119,10 +120,10 @@
119120
"# Set up a crystal\n",
120121
"atoms = FaceCenteredCubic(\n",
121122
" directions=[[1, 0, 0], [0, 1, 0], [0, 0, 1]],\n",
122-
" symbol='Cu',\n",
123+
" symbol=\"Cu\",\n",
123124
" size=(size, size, size),\n",
124-
" pbc=True\n",
125-
")\n"
125+
" pbc=True,\n",
126+
")"
126127
]
127128
},
128129
{
@@ -225,7 +226,7 @@
225226
"metadata": {},
226227
"outputs": [],
227228
"source": [
228-
"trajectory.load() # requires the project to have been run"
229+
"trajectory.load() # requires the project to have been run"
229230
]
230231
},
231232
{
@@ -296,9 +297,19 @@
296297
],
297298
"source": [
298299
"with project:\n",
299-
" random_test_selection = ips.configuration_selection.RandomSelection(data=trajectory, n_configurations=10, name=\"random_test_selection\")\n",
300-
" random_val_selection = ips.configuration_selection.RandomSelection(data=random_test_selection.excluded_atoms, n_configurations=15, name=\"random_val_selection\")\n",
301-
" random_train_selection = ips.configuration_selection.RandomSelection(data=random_val_selection.excluded_atoms, n_configurations=75, name=\"random_train_selection\")\n",
300+
" random_test_selection = ips.configuration_selection.RandomSelection(\n",
301+
" data=trajectory, n_configurations=10, name=\"random_test_selection\"\n",
302+
" )\n",
303+
" random_val_selection = ips.configuration_selection.RandomSelection(\n",
304+
" data=random_test_selection.excluded_atoms,\n",
305+
" n_configurations=15,\n",
306+
" name=\"random_val_selection\",\n",
307+
" )\n",
308+
" random_train_selection = ips.configuration_selection.RandomSelection(\n",
309+
" data=random_val_selection.excluded_atoms,\n",
310+
" n_configurations=75,\n",
311+
" name=\"random_train_selection\",\n",
312+
" )\n",
302313
"project.run()"
303314
]
304315
},
@@ -415,13 +426,23 @@
415426
"source": [
416427
"with ips.Project(remove_existing_graph=True) as project:\n",
417428
" trajectory = ips.AddData(file=traj_path, name=\"trajectory\")\n",
418-
" test_split = ips.configuration_selection.SplitSelection(data=trajectory, split=0.1, name=\"test_split\")\n",
419-
" val_split = ips.configuration_selection.SplitSelection(data=test_split.excluded_atoms, split=0.17, name=\"val_split\") # 0.15 / 0.9 * 1.0 \\approx 0.17\n",
420-
" train_split = val_split.excluded_atoms # 0.8 of the total data\n",
429+
" test_split = ips.configuration_selection.SplitSelection(\n",
430+
" data=trajectory, split=0.1, name=\"test_split\"\n",
431+
" )\n",
432+
" val_split = ips.configuration_selection.SplitSelection(\n",
433+
" data=test_split.excluded_atoms, split=0.17, name=\"val_split\"\n",
434+
" ) # 0.15 / 0.9 * 1.0 \\approx 0.17\n",
435+
" train_split = val_split.excluded_atoms # 0.8 of the total data\n",
421436
"\n",
422-
" test_data = ips.configuration_selection.UniformTemporalSelection(data=test_split, n_configurations=10, name=\"test_data\")\n",
423-
" val_data = ips.configuration_selection.UniformTemporalSelection(data=val_split, n_configurations=15, name=\"val_data\")\n",
424-
" train_data = ips.configuration_selection.UniformEnergeticSelection(data=train_split, n_configurations=80, name=\"train_data\")\n",
437+
" test_data = ips.configuration_selection.UniformTemporalSelection(\n",
438+
" data=test_split, n_configurations=10, name=\"test_data\"\n",
439+
" )\n",
440+
" val_data = ips.configuration_selection.UniformTemporalSelection(\n",
441+
" data=val_split, n_configurations=15, name=\"val_data\"\n",
442+
" )\n",
443+
" train_data = ips.configuration_selection.UniformEnergeticSelection(\n",
444+
" data=train_split, n_configurations=80, name=\"train_data\"\n",
445+
" )\n",
425446
"\n",
426447
"project.run()"
427448
]

docs/source/examples/03_Analysing_Datasets_and_Model_Predictions.ipynb

+4-6
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,19 @@
4242
}
4343
],
4444
"source": [
45-
"import ipsuite as ips\n",
4645
"from zntrack.utils import cwd_temp_dir\n",
4746
"\n",
4847
"temp_dir = cwd_temp_dir()\n",
4948
"\n",
50-
"import ipsuite as ips\n",
5149
"\n",
5250
"import os\n",
51+
"\n",
5352
"from ase import units\n",
5453
"from ase.calculators.emt import EMT\n",
5554
"from ase.io.trajectory import TrajectoryWriter\n",
5655
"from ase.lattice.cubic import FaceCenteredCubic\n",
57-
"from ase.md.velocitydistribution import MaxwellBoltzmannDistribution\n",
5856
"from ase.md.langevin import Langevin\n",
59-
"from ase.visualize import view\n"
57+
"from ase.md.velocitydistribution import MaxwellBoltzmannDistribution"
6058
]
6159
},
6260
{
@@ -115,9 +113,9 @@
115113
"# Set up a crystal\n",
116114
"atoms = FaceCenteredCubic(\n",
117115
" directions=[[1, 0, 0], [0, 1, 0], [0, 0, 1]],\n",
118-
" symbol='Cu',\n",
116+
" symbol=\"Cu\",\n",
119117
" size=(size, size, size),\n",
120-
" pbc=True\n",
118+
" pbc=True,\n",
121119
")"
122120
]
123121
},

docs/source/examples/04_Molecular_Dynamics_Structure_Generation_and_Simulation.ipynb

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
"execution_count": null,
1414
"metadata": {},
1515
"outputs": [],
16-
"source": [
17-
"import ipsuite as ips"
18-
]
16+
"source": []
1917
}
2018
],
2119
"metadata": {

docs/source/examples/05_Labeling_with_Calculators.ipynb

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
"execution_count": null,
1414
"metadata": {},
1515
"outputs": [],
16-
"source": [
17-
"import ipsuite as ips"
18-
]
16+
"source": []
1917
}
2018
],
2119
"metadata": {

docs/source/examples/06_Bootstrapping_Datasets.ipynb

+15-11
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@
4949
}
5050
],
5151
"source": [
52-
"import ipsuite as ips\n",
53-
"import znflow\n",
5452
"import matplotlib.pyplot as plt\n",
55-
"\n",
53+
"import znflow\n",
5654
"from zntrack.utils import cwd_temp_dir\n",
5755
"\n",
56+
"import ipsuite as ips\n",
57+
"\n",
5858
"temp_dir = cwd_temp_dir()"
5959
]
6060
},
@@ -376,7 +376,9 @@
376376
" data=[water.atoms], count=[10], density=997\n",
377377
" )\n",
378378
"\n",
379-
" opt_calc = ips.calculators.xTBSinglePoint(data=packmol, method=\"gfn1-xtb\", name=\"opt_calc\")\n",
379+
" opt_calc = ips.calculators.xTBSinglePoint(\n",
380+
" data=packmol, method=\"gfn1-xtb\", name=\"opt_calc\"\n",
381+
" )\n",
380382
"\n",
381383
" geopt = ips.calculators.ASEGeoOpt(\n",
382384
" model=opt_calc,\n",
@@ -390,27 +392,29 @@
390392
" data=geopt.atoms,\n",
391393
" data_id=-1,\n",
392394
" n_configurations=n_configs,\n",
393-
" maximum=0.08, # Ang max atomic displacement\n",
394-
" include_original=True\n",
395+
" maximum=0.08, # Ang max atomic displacement\n",
396+
" include_original=True,\n",
395397
" )\n",
396398
" rotate = ips.bootstrap.RotateMolecules(\n",
397399
" data=geopt.atoms,\n",
398400
" data_id=-1,\n",
399401
" n_configurations=n_configs,\n",
400402
" maximum=15, # deg max rotation\n",
401-
" include_original=False\n",
403+
" include_original=False,\n",
402404
" )\n",
403405
" translate = ips.bootstrap.TranslateMolecules(\n",
404406
" data=geopt.atoms,\n",
405407
" data_id=-1,\n",
406408
" n_configurations=n_configs,\n",
407-
" maximum=0.3, # Ang max molecular displacement\n",
408-
" include_original=False\n",
409+
" maximum=0.3, # Ang max molecular displacement\n",
410+
" include_original=False,\n",
409411
" )\n",
410412
"\n",
411413
" bootstrap_configurations = rattle.atoms + rotate.atoms + translate.atoms\n",
412414
"\n",
413-
" labeling_calc = ips.calculators.xTBSinglePoint(data=bootstrap_configurations, method=\"gfn1-xtb\", name=\"label_calc\")\n",
415+
" labeling_calc = ips.calculators.xTBSinglePoint(\n",
416+
" data=bootstrap_configurations, method=\"gfn1-xtb\", name=\"label_calc\"\n",
417+
" )\n",
414418
" volume_scan = ips.analysis.BoxScale(\n",
415419
" data=rattle.atoms,\n",
416420
" data_id=0,\n",
@@ -473,7 +477,7 @@
473477
"plt.xlabel(energy_hist.xlabel)\n",
474478
"plt.ylabel(energy_hist.ylabel)\n",
475479
"plt.yscale(\"log\")\n",
476-
"plt.show()\n"
480+
"plt.show()"
477481
]
478482
},
479483
{

0 commit comments

Comments
 (0)