Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute properties (energy/forces) on series of geometries #157

Merged
merged 35 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4545469
created protocol file
cpignedoli Jan 31, 2024
157f0ad
draft workchain
cpignedoli Feb 2, 2024
9fc517a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 2, 2024
30bdb09
Drafting the outline of the reftraj_md workchain.
yakutovicha Feb 2, 2024
1c81c37
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 2, 2024
cfe41d6
Merge branch 'master' into feature/reftraj
cpignedoli Feb 9, 2024
ee3e6e1
few more steps
cpignedoli Feb 10, 2024
86e1770
added trajectory case to get_kinds
cpignedoli Feb 10, 2024
5e81906
getting closer
cpignedoli Feb 10, 2024
79de47e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 10, 2024
c250315
update of inputs for different batches
cpignedoli Feb 10, 2024
ad430da
Merge branch 'feature/reftraj' of https://github.com/nanotech-empa/ai…
cpignedoli Feb 10, 2024
e3c8d27
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 10, 2024
7d4a2f9
bugs
cpignedoli Feb 10, 2024
7ff74c0
Merge branch 'feature/reftraj' of https://github.com/nanotech-empa/ai…
cpignedoli Feb 10, 2024
849b546
creating example for reftraj workchain
cpignedoli Feb 12, 2024
3f204e1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 12, 2024
bbaa731
cleaning
cpignedoli Feb 13, 2024
3cb2aab
Merge branch 'feature/trajkinds' into feature/reftraj
cpignedoli Feb 13, 2024
a64aae1
example working, need to code now the restarting from previous workchain
cpignedoli Feb 14, 2024
9fb92c5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 14, 2024
9d85230
added checks for finished_ok
cpignedoli Feb 14, 2024
279279f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 14, 2024
ab08517
added mmerging of trajectories
cpignedoli Feb 14, 2024
bfae9be
some merge mess
cpignedoli Feb 14, 2024
360672a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 14, 2024
1701a2d
working, tbd: loop on keys of available arrays
cpignedoli Feb 16, 2024
8bcdc24
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 16, 2024
4acaa44
cleaning
cpignedoli Feb 17, 2024
af5a3b1
conflicts
cpignedoli Feb 17, 2024
0caa390
solved conflicts
cpignedoli Feb 17, 2024
af7c694
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 17, 2024
b041ff6
refinements
cpignedoli Feb 29, 2024
ae416a3
added restart
cpignedoli Sep 9, 2024
3be3313
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions aiida_nanotech_empa/workflows/cp2k/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from .orbitals_workchain import Cp2kOrbitalsWorkChain
from .pdos_workchain import Cp2kPdosWorkChain
from .phonons_workchain import Cp2kPhononsWorkChain
from .reftraj_md_workchain import Cp2kRefTrajWorkChain
from .replica_workchain import Cp2kReplicaWorkChain
from .stm_workchain import Cp2kStmWorkChain

Expand All @@ -28,4 +29,5 @@
"Cp2kReplicaWorkChain",
"Cp2kNebWorkChain",
"Cp2kPhononsWorkChain",
"Cp2kRefTrajWorkChain",
)
24 changes: 21 additions & 3 deletions aiida_nanotech_empa/workflows/cp2k/cp2k_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,14 @@ def get_kinds_section(kinds_dict, protocol="gapw_std"):

def determine_kinds(structure, magnetization_per_site=None, ghost_per_site=None):
"""Gather the same atoms with the same magnetization into one atomic kind."""
ase_structure = structure.get_ase()

if isinstance(structure, orm.TrajectoryData):
cell = structure.get_array("cells")[0]
positions = structure.get_array("positions")[0]
symbols = structure.symbols
ase_structure = ase.Atoms(symbols, positions=positions, cell=cell)
else:
ase_structure = structure.get_ase()

if magnetization_per_site is None or len(magnetization_per_site) == 0:
magnetization_per_site = [0 for i in range(len(ase_structure))]
Expand Down Expand Up @@ -176,7 +183,6 @@ def load_protocol(fname, protocol=None):


def get_dft_inputs(dft_params, structure, template, protocol):
ase_atoms = structure.get_ase()
files = {
"basis": orm.SinglefileData(
file=os.path.join(
Expand All @@ -196,6 +202,18 @@ def get_dft_inputs(dft_params, structure, template, protocol):
),
}

# number of atoms
if isinstance(structure, orm.TrajectoryData):
natoms = structure.get_shape("positions")[1]
structure = orm.StructureData(
ase=ase.Atoms(
structure.symbols,
positions=structure.get_array("positions")[0],
cell=(structure.get_array("cells")[0]),
)
)
natoms = len(structure.sites)

# Load input template.
input_dict = load_protocol(template, protocol)

Expand All @@ -211,7 +229,7 @@ def get_dft_inputs(dft_params, structure, template, protocol):
input_dict["FORCE_EVAL"]["DFT"]["CHARGE"] = dft_params["charge"]

# uks
magnetization_per_site = [0 for i in range(len(ase_atoms))]
magnetization_per_site = [0 for i in range(natoms)]
if "uks" in dft_params:
if dft_params["uks"]:
magnetization_per_site = dft_params["magnetization_per_site"]
Expand Down
249 changes: 249 additions & 0 deletions aiida_nanotech_empa/workflows/cp2k/protocols/md_reftraj_protocol.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
standard:
GLOBAL:
EXTENDED_FFT_LENGTHS: ''
PRINT_LEVEL: MEDIUM
RUN_TYPE: MD
WALLTIME: '600'
ELPA_KERNEL: AVX2_BLOCK2
MOTION:
MD:
STEPS: '1'
ENSEMBLE: 'REFTRAJ'
REFTRAJ:
FIRST_SNAPSHOT: '1'
LAST_SNAPSHOT: '1'
STRIDE: '1'
EVAL_FORCES: '.TRUE.'
TRAJ_FILE_NAME: 'aiida-reftraj.xyz'
VARIABLE_VOLUME: .TRUE.
CELL_FILE_NAME: 'aiida-reftraj.cell'
PRINT:
RESTART_HISTORY:
_: 'OFF'
FORCES:
EACH:
MD: '1'
FORMAT: 'XYZ'
CELL:
EACH:
MD: '1'
FORCE_EVAL:
METHOD: Quickstep
SUBSYS:
CELL:
PERIODIC: XYZ
SYMMETRY: ORTHORHOMBIC
DFT:
UKS: .FALSE.
MULTIPLICITY: '0'
CHARGE: '0'
BASIS_SET_FILE_NAME: BASIS_MOLOPT
POTENTIAL_FILE_NAME: POTENTIAL
RESTART_FILE_NAME: ./parent_calc/aiida-RESTART.wfn
MGRID:
CUTOFF: '600'
NGRIDS: '5'
POISSON:
PERIODIC: XYZ
POISSON_SOLVER: PERIODIC
QS:
EPS_DEFAULT: '1.0E-14'
EXTRAPOLATION: ASPC
EXTRAPOLATION_ORDER: '3'
METHOD: GPW
SCF:
SCF_GUESS: RESTART
EPS_SCF: '1.0E-7'
MAX_SCF: '40'
OT:
MINIMIZER: CG
PRECONDITIONER: FULL_SINGLE_INVERSE
OUTER_SCF:
EPS_SCF: '1.0E-7'
MAX_SCF: '50'
PRINT:
RESTART:
ADD_LAST: NUMERIC
EACH:
MD: '1'
FILENAME: RESTART
RESTART_HISTORY:
_: 'OFF'
BACKUP_COPIES: '0'
XC:
VDW_POTENTIAL:
DISPERSION_FUNCTIONAL: PAIR_POTENTIAL
PAIR_POTENTIAL:
CALCULATE_C9_TERM: .TRUE.
PARAMETER_FILE_NAME: dftd3.dat
REFERENCE_FUNCTIONAL: PBE
R_CUTOFF: '15'
TYPE: DFTD3
XC_FUNCTIONAL:
_: PBE
low_accuracy:
GLOBAL:
EXTENDED_FFT_LENGTHS: ''
PRINT_LEVEL: MEDIUM
RUN_TYPE: MD
WALLTIME: '600'
ELPA_KERNEL: AVX2_BLOCK2
MOTION:
MD:
STEPS: '1'
ENSEMBLE: 'REFTRAJ'
REFTRAJ:
FIRST_SNAPSHOT: '1'
LAST_SNAPSHOT: '1'
STRIDE: '1'
EVAL_FORCES: '.TRUE.'
TRAJ_FILE_NAME: 'aiida-refttraj.xyz'
VARIABLE_VOLUME: .TRUE.
CELL_FILE_NAME: 'aiida-reftraj.cell'
PRINT:
RESTART_HISTORY:
_: 'OFF'
FORCES:
EACH:
MD: '1'
FORMAT: 'XYZ'
CELL:
EACH:
MD: '1'
FORCE_EVAL:
METHOD: Quickstep
SUBSYS:
CELL:
PERIODIC: XYZ
SYMMETRY: ORTHORHOMBIC
DFT:
UKS: .FALSE.
MULTIPLICITY: '0'
CHARGE: '0'
BASIS_SET_FILE_NAME: BASIS_MOLOPT
POTENTIAL_FILE_NAME: POTENTIAL
RESTART_FILE_NAME: ./parent_calc/aiida-RESTART.wfn
MGRID:
CUTOFF: '600'
NGRIDS: '5'
POISSON:
PERIODIC: XYZ
POISSON_SOLVER: PERIODIC
QS:
EPS_DEFAULT: '1.0E-14'
EXTRAPOLATION: ASPC
EXTRAPOLATION_ORDER: '3'
METHOD: GPW
SCF:
SCF_GUESS: RESTART
EPS_SCF: '1.0E-7'
MAX_SCF: '40'
OT:
MINIMIZER: CG
PRECONDITIONER: FULL_SINGLE_INVERSE
OUTER_SCF:
EPS_SCF: '1.0E-7'
MAX_SCF: '50'
PRINT:
RESTART:
ADD_LAST: NUMERIC
EACH:
MD: '1'
FILENAME: RESTART
RESTART_HISTORY:
_: 'OFF'
BACKUP_COPIES: '0'
XC:
VDW_POTENTIAL:
DISPERSION_FUNCTIONAL: PAIR_POTENTIAL
PAIR_POTENTIAL:
CALCULATE_C9_TERM: .TRUE.
PARAMETER_FILE_NAME: dftd3.dat
REFERENCE_FUNCTIONAL: PBE
R_CUTOFF: '15'
TYPE: DFTD3
XC_FUNCTIONAL:
_: PBE
debug:
GLOBAL:
EXTENDED_FFT_LENGTHS: ''
PRINT_LEVEL: MEDIUM
RUN_TYPE: MD
WALLTIME: '600'
ELPA_KERNEL: AVX2_BLOCK2
MOTION:
MD:
STEPS: '1'
ENSEMBLE: 'REFTRAJ'
REFTRAJ:
FIRST_SNAPSHOT: '1'
LAST_SNAPSHOT: '1'
STRIDE: '1'
EVAL_FORCES: '.TRUE.'
TRAJ_FILE_NAME: 'aiida-reftraj.xyz'
VARIABLE_VOLUME: .TRUE.
CELL_FILE_NAME: 'aiida-reftraj.cell'
PRINT:
RESTART_HISTORY:
_: 'OFF'
FORCES:
EACH:
MD: '1'
FORMAT: 'XYZ'
CELL:
EACH:
MD: '1'
FORCE_EVAL:
METHOD: Quickstep
SUBSYS:
CELL:
PERIODIC: XYZ
SYMMETRY: ORTHORHOMBIC
DFT:
UKS: .FALSE.
MULTIPLICITY: '0'
CHARGE: '0'
BASIS_SET_FILE_NAME: BASIS_MOLOPT
POTENTIAL_FILE_NAME: POTENTIAL
RESTART_FILE_NAME: ./parent_calc/aiida-RESTART.wfn
MGRID:
CUTOFF: '600'
NGRIDS: '5'
POISSON:
PERIODIC: XYZ
POISSON_SOLVER: PERIODIC
QS:
EPS_DEFAULT: '1.0E-12'
EXTRAPOLATION: ASPC
EXTRAPOLATION_ORDER: '3'
METHOD: GPW
SCF:
SCF_GUESS: RESTART
EPS_SCF: '1.0E-1'
MAX_SCF: '40'
OT:
MINIMIZER: CG
PRECONDITIONER: FULL_SINGLE_INVERSE
OUTER_SCF:
EPS_SCF: '1.0E-1'
MAX_SCF: '50'
PRINT:
RESTART:
ADD_LAST: NUMERIC
EACH:
MD: '1'
FILENAME: RESTART
RESTART_HISTORY:
_: 'OFF'
BACKUP_COPIES: '0'
XC:
VDW_POTENTIAL:
DISPERSION_FUNCTIONAL: PAIR_POTENTIAL
PAIR_POTENTIAL:
CALCULATE_C9_TERM: .TRUE.
PARAMETER_FILE_NAME: dftd3.dat
REFERENCE_FUNCTIONAL: PBE
R_CUTOFF: '15'
TYPE: DFTD3
XC_FUNCTIONAL:
_: PBE
Loading
Loading