Skip to content

Commit

Permalink
boh
Browse files Browse the repository at this point in the history
  • Loading branch information
cpignedoli committed Feb 11, 2024
2 parents 8c5083d + 0579f0c commit c82691d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
4 changes: 2 additions & 2 deletions aiida_cp2k/calculations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
###############################################################################
"""AiiDA-CP2K input plugin."""

import numpy as np
from operator import add

import numpy as np
from aiida.common import CalcInfo, CodeInfo, InputValidationError
from aiida.engine import CalcJob
from aiida.orm import Dict, RemoteData, SinglefileData
Expand Down Expand Up @@ -458,7 +458,7 @@ def _trajectory_to_xyz_and_cell(trajectory, atoms):
xyz = ""
elem_symbols = kind_names(atoms)

for (i,step) in enumerate(trajectory.get_array("positions")):
for i, step in enumerate(trajectory.get_array("positions")):
elem_coords = [f"{p[0]:25.16f} {p[1]:25.16f} {p[2]:25.16f}" for p in step]
xyz += f"{len(elem_coords)}\n"
xyz += f"i = {i+1} , time = {(i+1)*0.5} \n"
Expand Down
34 changes: 32 additions & 2 deletions examples/single_calculations/example_dft_md_reftraj.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import sys
import random

import ase.io
import click
import numpy as np
import ase.io
from aiida.common import NotExistent
from aiida.engine import run
from aiida.orm import Dict, SinglefileData, load_code
Expand All @@ -36,10 +36,28 @@ def example_dft_md_reftraj(cp2k_code):
)

# Trajectory.
<<<<<<< HEAD
steps=5
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']
=======
positions = np.array(
[
[[2, 2, 2.73], [2, 2, 2.0]],
[[2, 2, 2.74], [2, 2, 2.0]],
[[2, 2, 2.75], [2, 2, 2.0]],
]
)
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]],
]
)
symbols = ["H", "H"]
>>>>>>> 0579f0ce4b6ee754292a941572730fae741122cd
trajectory = TrajectoryData()
trajectory.set_trajectory(symbols, positions, cells=cells)

Expand All @@ -65,6 +83,7 @@ def example_dft_md_reftraj(cp2k_code):
"MOTION": {
"MD": {
"ENSEMBLE": "REFTRAJ",
<<<<<<< HEAD
"STEPS": steps,
"REFTRAJ":{
'FIRST_SNAPSHOT':1,
Expand All @@ -74,6 +93,17 @@ def example_dft_md_reftraj(cp2k_code):
'CELL_FILE_NAME':'reftraj.cell',
'VARIABLE_VOLUME':'.TRUE.'
},
=======
"STEPS": 3,
"REFTRAJ": {
"FIRST_SNAPSHOT": 1,
"LAST_SNAPSHOT": 3,
"EVAL_FORCES": ".TRUE.",
"TRAJ_FILE_NAME": "trajectory.xyz",
"CELL_FILE_NAME": "reftraj.cell",
"VARIABLE_VOLUME": ".TRUE.",
},
>>>>>>> 0579f0ce4b6ee754292a941572730fae741122cd
},
"PRINT": {
"RESTART": {
Expand Down Expand Up @@ -132,7 +162,7 @@ def example_dft_md_reftraj(cp2k_code):
},
],
},
}
},
}
)

Expand Down

0 comments on commit c82691d

Please sign in to comment.