-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unification of plot and settings widgets, as well as polymorphism instead of inheritance and composition. This will help maintaining the code clear and readable. This is still a draft commit, let's say. I started doing the unification in the euphonicmodel.py and in the structurefactorwidget.py - but the files, imports and everything need to be fixed
- Loading branch information
1 parent
fbb0075
commit f256211
Showing
7 changed files
with
759 additions
and
287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/aiidalab_qe_vibroscopy/utils/euphonic/data/export_vibronic_to_euphonic.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from aiida.orm import Dict | ||
from aiida_phonopy.common.raw_parsers import get_force_constants_from_phonopy | ||
from aiida_phonopy.workflows.phonon import generate_force_constant_instance | ||
|
||
def export_euphonic_data(output_vibronic, fermi_energy=None): | ||
if "phonon_bands" not in output_vibronic: | ||
return None | ||
|
||
output_set = output_vibronic.phonon_bands | ||
|
||
if any(not element for element in output_set.creator.caller.inputs.structure.pbc): | ||
vibro_bands = output_set.creator.caller.inputs.phonopy_bands_dict.get_dict() | ||
# Group the band and band_labels | ||
band = vibro_bands["band"] | ||
band_labels = vibro_bands["band_labels"] | ||
|
||
grouped_bands = [ | ||
item | ||
for sublist in [band_labels[i : i + 2] for i in range(len(band_labels) - 1)] | ||
for item in sublist | ||
] | ||
grouped_q = [ | ||
[tuple(band[i : i + 3]), tuple(band[i + 3 : i + 6])] | ||
for i in range(0, len(band) - 3, 3) | ||
] | ||
q_path = { | ||
"coordinates": grouped_q, | ||
"labels": grouped_bands, | ||
"delta_q": 0.01, # 1/A | ||
} | ||
else: | ||
q_path = None | ||
|
||
phonopy_calc = output_set.creator | ||
fc = generate_force_constant_instance(phonopy_calc) | ||
# bands = compute_bands(fc) | ||
# pdos = compute_pdos(fc) | ||
return { | ||
"fc": fc, | ||
"q_path": q_path, | ||
} # "bands": bands, "pdos": pdos, "thermal": None} |
52 changes: 52 additions & 0 deletions
52
src/aiidalab_qe_vibroscopy/utils/euphonic/data/parameters.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""Set of parameters for given Euphonic calculation. | ||
We distinguish between parameters for a single crystal and for a powder calculation: the former requires a path in reciprocal space, | ||
while the latter requires a range of q-points. | ||
We have a set of common parameters that are shared between the two types of calculations. | ||
""" | ||
common_parameters = { | ||
"weighting": "coherent", # Spectral weighting to plot: DOS, coherent inelastic neutron scattering (default: dos) | ||
"grid": None, # FWHM of broadening on q axis in 1/LENGTH_UNIT (no broadening if unspecified). (default: None) | ||
"grid_spacing": 0.1, # q-point spacing of Monkhorst-Pack grid. (default: 0.1) | ||
"energy_unit": "THz", | ||
"temperature": 0, # Temperature in K; enable Debye-Waller factor calculation. (Only applicable when --weighting=coherent). (default: None) | ||
"shape": "gauss", # The broadening shape (default: gauss) | ||
"length_unit": "angstrom", | ||
"q_spacing": 0.01, # Target distance between q-point samples in 1/LENGTH_UNIT (default: 0.025) | ||
"energy_broadening": 1, | ||
"q_broadening": None, # FWHM of broadening on q axis in 1/LENGTH_UNIT (no broadening if unspecified). (default: None) | ||
"ebins": 200, # Number of energy bins (default: 200) | ||
"e_min": 0, | ||
"e_max": None, | ||
"title": None, | ||
"ylabel": "THz", | ||
"xlabel": "", | ||
"save_json": False, | ||
"no_base_style": False, | ||
"style": False, | ||
"vmin": None, | ||
"vmax": None, | ||
"save_to": None, | ||
"asr": None, # Apply an acoustic-sum-rule (ASR) correction to the data: "realspace" applies the correction to the force constant matrix in real space. "reciprocal" applies the correction to the dynamical matrix at each q-point. (default: None) | ||
"dipole_parameter": 1.0, # Set the cutoff in real/reciprocal space for the dipole Ewald sum; higher values use more reciprocal terms. If tuned correctly this can result in performance improvements. See euphonic-optimise-dipole-parameter program for help on choosing a good DIPOLE_PARAMETER. (default: 1.0) | ||
"use_c": None, | ||
"n_threads": None, | ||
} | ||
|
||
parameters_single_crystal = { | ||
**common_parameters, | ||
} | ||
|
||
parameters_powder = { | ||
**common_parameters, | ||
"q_min": 0, | ||
"q_max": 1, | ||
"npts": 150, | ||
"npts_density": None, | ||
"pdos": None, | ||
"e_i": None, | ||
"sampling": "golden", | ||
"jitter": True, | ||
"e_f": None, | ||
"disable_widgets": True, | ||
} |
Oops, something went wrong.