Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 11, 2024
1 parent c82691d commit 9200862
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion aiida_cp2k/workchains/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def restart_incomplete_calculation(self, calc):

self.ctx.inputs.parent_calc_folder = calc.outputs.remote_folder
params = self.ctx.inputs.parameters

# Check if we need to fix restart snapshot in REFTRAJ MD
try:
first_snapshot = int(params['MOTION']['MD']['REFTRAJ']['FIRST_SNAPSHOT'])
Expand Down
2 changes: 1 addition & 1 deletion examples/single_calculations/example_dft_md_reftraj.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"""Run simple DFT calculation."""

import os
import sys
import random
import sys

import ase.io
import click
Expand Down
41 changes: 23 additions & 18 deletions examples/workchains/example_base_md_reftraj_restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
"""An example testing the restart calculation handler for geo_opt run in CP2K."""

import os
import sys
import random
import numpy as np
import sys

import ase.io
import click
from ase import Atoms
import numpy as np
from aiida.common import NotExistent
from aiida.engine import run
from aiida.orm import Dict, SinglefileData, load_code
from aiida.plugins import DataFactory, WorkflowFactory
from ase import Atoms

Cp2kBaseWorkChain = WorkflowFactory("cp2k.base")
StructureData = DataFactory("core.structure")
Expand Down Expand Up @@ -47,14 +47,19 @@ def example_base(cp2k_code):
)

# Trajectory.
steps=20
positions = np.array([[[2,2,2.73+0.05*random.random()],[2,2,2]] for i in range(steps)])
cells = np.array([[[4,0,0],[0,4,0],[0,0,4.75+0.05*random.random()]]for i in range(steps)])
symbols=['H','H']
steps = 20
positions = np.array(
[[[2, 2, 2.73 + 0.05 * random.random()], [2, 2, 2]] for i in range(steps)]
)
cells = np.array(
[
[[4, 0, 0], [0, 4, 0], [0, 0, 4.75 + 0.05 * random.random()]]
for i in range(steps)
]
)
symbols = ["H", "H"]
trajectory = TrajectoryData()
trajectory.set_trajectory(symbols, positions, cells=cells)



# Parameters.
parameters = Dict(
Expand All @@ -69,14 +74,14 @@ def example_base(cp2k_code):
"MD": {
"ENSEMBLE": "REFTRAJ",
"STEPS": steps,
"REFTRAJ":{
'FIRST_SNAPSHOT':1,
'LAST_SNAPSHOT':steps,
'EVAL_FORCES':'.TRUE.',
'TRAJ_FILE_NAME':'trajectory.xyz',
'CELL_FILE_NAME':'reftraj.cell',
'VARIABLE_VOLUME':'.TRUE.'
},
"REFTRAJ": {
"FIRST_SNAPSHOT": 1,
"LAST_SNAPSHOT": steps,
"EVAL_FORCES": ".TRUE.",
"TRAJ_FILE_NAME": "trajectory.xyz",
"CELL_FILE_NAME": "reftraj.cell",
"VARIABLE_VOLUME": ".TRUE.",
},
},
"PRINT": {
"RESTART": {
Expand Down Expand Up @@ -135,7 +140,7 @@ def example_base(cp2k_code):
},
],
},
}
},
}
)

Expand Down

0 comments on commit 9200862

Please sign in to comment.