Skip to content

Commit

Permalink
Ad-hoc fix of phono3py workchain
Browse files Browse the repository at this point in the history
  • Loading branch information
atztogo committed Jun 15, 2021
1 parent e747c4e commit a66a474
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion aiida_phonopy/common/builders.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Utilities related to process builder or inputs dist."""

from aiida.engine import calcfunction
from aiida.plugins import DataFactory, WorkflowFactory, CalculationFactory
from aiida.plugins import DataFactory, WorkflowFactory
from aiida.common import InputValidationError
from aiida.orm import Str, Bool, Code, load_group

Expand Down
34 changes: 17 additions & 17 deletions aiida_phonopy/workflows/phono3py.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
from aiida.orm import Float, Bool, Code
from aiida.engine import if_
from aiida_phonopy.common.builders import (
get_immigrant_builder, get_calcjob_inputs)
get_calcjob_inputs, get_vasp_immigrant_inputs)
from aiida_phonopy.common.utils import (
generate_phono3py_cells,
get_vasp_force_sets_dict, collect_vasp_forces_and_energies,
compare_structures)
from aiida_phonopy.workflows.nac_params import get_nac_params
from aiida_phonopy.workflows.nac_params import _get_nac_params as get_nac_params


PhonopyWorkChain = WorkflowFactory('phonopy.phonopy')
Expand Down Expand Up @@ -270,6 +270,7 @@ def read_force_and_nac_calculations_from_files(self):
self.report('import calculation data in files')

calc_folders_Dict = self.inputs.immigrant_calculation_folders
VaspImmigrant = WorkflowFactory('vasp.immigrant')

if 'forces' not in calc_folders_Dict.attributes:
return self.exit_code.ERROR_NO_FORCES_FOLDERS
Expand All @@ -281,11 +282,11 @@ def read_force_and_nac_calculations_from_files(self):
digits = len(str(len(calc_folders_Dict['forces'])))
for i, force_folder in enumerate(calc_folders_Dict['forces']):
label = "force_calc_%s" % str(i + 1).zfill(digits)
builder = get_immigrant_builder(force_folder,
self.inputs.calculator_settings,
calc_type='forces')
builder.metadata.label = label
future = self.submit(builder)
inputs = get_vasp_immigrant_inputs(
force_folder,
self.inputs.calculator_settings['forces'],
label=label)
future = self.submit(VaspImmigrant, **inputs)
self.report('{} pk = {}'.format(label, future.pk))
self.to_context(**{label: future})

Expand All @@ -294,22 +295,21 @@ def read_force_and_nac_calculations_from_files(self):
digits = len(str(len(folders)))
for i, force_folder in enumerate(folders):
label = "force_calc_%s" % str(i + 1).zfill(digits)
builder = get_immigrant_builder(
inputs = get_vasp_immigrant_inputs(
force_folder,
self.inputs.calculator_settings,
calc_type='phonon_forces')
builder.metadata.label = label
future = self.submit(builder)
self.inputs.calculator_settings['phonon_forces'],
label=label)
future = self.submit(VaspImmigrant, **inputs)
self.report('{} pk = {}'.format(label, future.pk))
self.to_context(**{label: future})

if self.is_nac(): # NAC the last one
label = 'born_and_epsilon_calc'
builder = get_immigrant_builder(calc_folders_Dict['nac'][0],
self.inputs.calculator_settings,
calc_type='nac')
builder.metadata.label = label
future = self.submit(builder)
inputs = get_vasp_immigrant_inputs(
calc_folders_Dict['nac'][0],
self.inputs.calculator_settings['nac'],
label=label)
future = self.submit(VaspImmigrant, **inputs)
self.report('{} pk = {}'.format(label, future.pk))
self.to_context(**{label: future})

Expand Down

0 comments on commit a66a474

Please sign in to comment.