Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
atztogo committed Jul 9, 2020
1 parent fa6764a commit 0873de6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
9 changes: 7 additions & 2 deletions aiida_phonopy/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def get_phonopy_instance(structure, phonon_settings_dict, params):
from phonopy import Phonopy
phonon = Phonopy(
phonopy_atoms_from_structure(structure),
phonon_settings_dict['supercell_matrix'],
supercell_matrix=phonon_settings_dict['supercell_matrix'],
primitive_matrix='auto',
symprec=phonon_settings_dict['symmetry_tolerance'])
if 'nac_params' in params:
Expand All @@ -363,7 +363,7 @@ def get_phono3py_instance(structure, phonon_settings_dict, params):
ph_smat = None
ph3py = Phono3py(
phonopy_atoms_from_structure(structure),
phonon_settings_dict['supercell_matrix'],
supercell_matrix=phonon_settings_dict['supercell_matrix'],
primitive_matrix='auto',
phonon_supercell_matrix=ph_smat,
symprec=phonon_settings_dict['symmetry_tolerance'])
Expand Down Expand Up @@ -512,6 +512,11 @@ def _update_structure_info(ph_settings, ph):
ph_settings['symmetry'] = {
'number': ph.symmetry.dataset['number'],
'international': ph.symmetry.dataset['international']}

if 'phonon_supercell_matrix' in ph.__dir__():
if ph.phonon_supercell_matrix is not None:
ph_settings['phonon_displacement_dataset'] = ph.phonon_dataset

return ph_settings


Expand Down
2 changes: 1 addition & 1 deletion aiida_phonopy/workflows/phono3py.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def run_force_and_nac_calculations(self):
self.to_context(**{label: future})

# Born charges and dielectric constant
if self.ctx.phonon_setting_info['is_nac']:
if self.is_nac():
self.report('calculate born charges and dielectric constant')
builder = get_calcjob_builder(self.ctx.primitive,
self.inputs.calculator_settings,
Expand Down
6 changes: 3 additions & 3 deletions aiida_phonopy/workflows/phonopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def run_force_and_nac_calculations(self):
self.to_context(**{label: future})

# Born charges and dielectric constant
if self.ctx.phonon_setting_info['is_nac']:
if self.is_nac():
self.report('calculate born charges and dielectric constant')
builder = get_calcjob_builder(self.ctx.primitive,
self.inputs.calculator_settings,
Expand All @@ -247,7 +247,7 @@ def read_force_and_nac_calculations_from_files(self):
self.report('{} pk = {}'.format(label, future.pk))
self.to_context(**{label: future})

if self.ctx.phonon_setting_info['is_nac']: # NAC the last one
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,
Expand All @@ -269,7 +269,7 @@ def read_calculation_data_from_nodes(self):
# self.ctx[label]['forces'] -> ArrayData()('final')
self.ctx[label] = get_data_from_node_id(aiida_node_id)

if self.ctx.phonon_setting_info['is_nac']: # NAC the last one
if self.is_nac():
label = 'born_and_epsilon_cal'
node_id = calc_nodes_Dict['nac'][0]
aiida_node_id = from_node_id_to_aiida_node_id(node_id)
Expand Down

0 comments on commit 0873de6

Please sign in to comment.