Skip to content

Commit 0579f0c

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

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

aiida_cp2k/calculations/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
###############################################################################
77
"""AiiDA-CP2K input plugin."""
88

9-
import numpy as np
109
from operator import add
1110

11+
import numpy as np
1212
from aiida.common import CalcInfo, CodeInfo, InputValidationError
1313
from aiida.engine import CalcJob
1414
from aiida.orm import Dict, RemoteData, SinglefileData
@@ -458,7 +458,7 @@ def _trajectory_to_xyz_and_cell(trajectory, atoms):
458458
xyz = ""
459459
elem_symbols = kind_names(atoms)
460460

461-
for (i,step) in enumerate(trajectory.get_array("positions")):
461+
for i, step in enumerate(trajectory.get_array("positions")):
462462
elem_coords = [f"{p[0]:25.16f} {p[1]:25.16f} {p[2]:25.16f}" for p in step]
463463
xyz += f"{len(elem_coords)}\n"
464464
xyz += f"i = {i+1} , time = {(i+1)*0.5} \n"

examples/single_calculations/example_dft_md_reftraj.py

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
import os
1010
import sys
1111

12+
import ase.io
1213
import click
1314
import numpy as np
14-
import ase.io
1515
from aiida.common import NotExistent
1616
from aiida.engine import run
1717
from aiida.orm import Dict, SinglefileData, load_code
@@ -35,9 +35,21 @@ def example_dft_md_reftraj(cp2k_code):
3535
)
3636

3737
# Trajectory.
38-
positions = np.array([[[2,2,2.73],[2,2,2.]],[[2,2,2.74],[2,2,2.]],[[2,2,2.75],[2,2,2.]]])
39-
cells = np.array([[[4,0,0],[0,4,0],[0,0,4.75]],[[4.4,0,0],[0,4.2,0],[0,0,4.76]],[[4,0,0],[0,4.1,0],[0,0,4.75]]])
40-
symbols=['H','H']
38+
positions = np.array(
39+
[
40+
[[2, 2, 2.73], [2, 2, 2.0]],
41+
[[2, 2, 2.74], [2, 2, 2.0]],
42+
[[2, 2, 2.75], [2, 2, 2.0]],
43+
]
44+
)
45+
cells = np.array(
46+
[
47+
[[4, 0, 0], [0, 4, 0], [0, 0, 4.75]],
48+
[[4.4, 0, 0], [0, 4.2, 0], [0, 0, 4.76]],
49+
[[4, 0, 0], [0, 4.1, 0], [0, 0, 4.75]],
50+
]
51+
)
52+
symbols = ["H", "H"]
4153
trajectory = TrajectoryData()
4254
trajectory.set_trajectory(symbols, positions, cells=cells)
4355

@@ -64,14 +76,14 @@ def example_dft_md_reftraj(cp2k_code):
6476
"MD": {
6577
"ENSEMBLE": "REFTRAJ",
6678
"STEPS": 3,
67-
"REFTRAJ":{
68-
'FIRST_SNAPSHOT':1,
69-
'LAST_SNAPSHOT':3,
70-
'EVAL_FORCES':'.TRUE.',
71-
'TRAJ_FILE_NAME':'trajectory.xyz',
72-
'CELL_FILE_NAME':'reftraj.cell',
73-
'VARIABLE_VOLUME':'.TRUE.'
74-
},
79+
"REFTRAJ": {
80+
"FIRST_SNAPSHOT": 1,
81+
"LAST_SNAPSHOT": 3,
82+
"EVAL_FORCES": ".TRUE.",
83+
"TRAJ_FILE_NAME": "trajectory.xyz",
84+
"CELL_FILE_NAME": "reftraj.cell",
85+
"VARIABLE_VOLUME": ".TRUE.",
86+
},
7587
},
7688
"PRINT": {
7789
"RESTART": {
@@ -130,7 +142,7 @@ def example_dft_md_reftraj(cp2k_code):
130142
},
131143
],
132144
},
133-
}
145+
},
134146
}
135147
)
136148

0 commit comments

Comments
 (0)