Skip to content

Commit 9200862

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

File tree

3 files changed

+25
-20
lines changed

3 files changed

+25
-20
lines changed

aiida_cp2k/workchains/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def restart_incomplete_calculation(self, calc):
8585

8686
self.ctx.inputs.parent_calc_folder = calc.outputs.remote_folder
8787
params = self.ctx.inputs.parameters
88-
88+
8989
# Check if we need to fix restart snapshot in REFTRAJ MD
9090
try:
9191
first_snapshot = int(params['MOTION']['MD']['REFTRAJ']['FIRST_SNAPSHOT'])

examples/single_calculations/example_dft_md_reftraj.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"""Run simple DFT calculation."""
88

99
import os
10-
import sys
1110
import random
11+
import sys
1212

1313
import ase.io
1414
import click

examples/workchains/example_base_md_reftraj_restart.py

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
"""An example testing the restart calculation handler for geo_opt run in CP2K."""
88

99
import os
10-
import sys
1110
import random
12-
import numpy as np
11+
import sys
1312

1413
import ase.io
1514
import click
16-
from ase import Atoms
15+
import numpy as np
1716
from aiida.common import NotExistent
1817
from aiida.engine import run
1918
from aiida.orm import Dict, SinglefileData, load_code
2019
from aiida.plugins import DataFactory, WorkflowFactory
20+
from ase import Atoms
2121

2222
Cp2kBaseWorkChain = WorkflowFactory("cp2k.base")
2323
StructureData = DataFactory("core.structure")
@@ -47,14 +47,19 @@ def example_base(cp2k_code):
4747
)
4848

4949
# Trajectory.
50-
steps=20
51-
positions = np.array([[[2,2,2.73+0.05*random.random()],[2,2,2]] for i in range(steps)])
52-
cells = np.array([[[4,0,0],[0,4,0],[0,0,4.75+0.05*random.random()]]for i in range(steps)])
53-
symbols=['H','H']
50+
steps = 20
51+
positions = np.array(
52+
[[[2, 2, 2.73 + 0.05 * random.random()], [2, 2, 2]] for i in range(steps)]
53+
)
54+
cells = np.array(
55+
[
56+
[[4, 0, 0], [0, 4, 0], [0, 0, 4.75 + 0.05 * random.random()]]
57+
for i in range(steps)
58+
]
59+
)
60+
symbols = ["H", "H"]
5461
trajectory = TrajectoryData()
5562
trajectory.set_trajectory(symbols, positions, cells=cells)
56-
57-
5863

5964
# Parameters.
6065
parameters = Dict(
@@ -69,14 +74,14 @@ def example_base(cp2k_code):
6974
"MD": {
7075
"ENSEMBLE": "REFTRAJ",
7176
"STEPS": steps,
72-
"REFTRAJ":{
73-
'FIRST_SNAPSHOT':1,
74-
'LAST_SNAPSHOT':steps,
75-
'EVAL_FORCES':'.TRUE.',
76-
'TRAJ_FILE_NAME':'trajectory.xyz',
77-
'CELL_FILE_NAME':'reftraj.cell',
78-
'VARIABLE_VOLUME':'.TRUE.'
79-
},
77+
"REFTRAJ": {
78+
"FIRST_SNAPSHOT": 1,
79+
"LAST_SNAPSHOT": steps,
80+
"EVAL_FORCES": ".TRUE.",
81+
"TRAJ_FILE_NAME": "trajectory.xyz",
82+
"CELL_FILE_NAME": "reftraj.cell",
83+
"VARIABLE_VOLUME": ".TRUE.",
84+
},
8085
},
8186
"PRINT": {
8287
"RESTART": {
@@ -135,7 +140,7 @@ def example_base(cp2k_code):
135140
},
136141
],
137142
},
138-
}
143+
},
139144
}
140145
)
141146

0 commit comments

Comments
 (0)