Skip to content

Commit

Permalink
setting lazy loading
Browse files Browse the repository at this point in the history
  • Loading branch information
AndresOrtegaGuerrero committed Nov 28, 2024
1 parent e5be3ce commit 8d171b0
Show file tree
Hide file tree
Showing 3 changed files with 311 additions and 232 deletions.
48 changes: 31 additions & 17 deletions src/aiidalab_qe_vibroscopy/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
from aiidalab_qe_vibroscopy.app.settings import Setting
from aiidalab_qe.common.panel import PluginOutline

from aiidalab_qe_vibroscopy.app.model import VibroConfigurationSettingsModel
from aiidalab_qe_vibroscopy.app.settings import VibroConfigurationSettingPanel


# from aiidalab_qe_vibroscopy.app.settings import Setting
from aiidalab_qe_vibroscopy.app.workchain import workchain_and_builder
from aiidalab_qe_vibroscopy.app.result import Result
from aiidalab_qe.common.panel import OutlinePanel
# from aiidalab_qe_vibroscopy.app.result import Result
# from aiidalab_qe.common.panel import OutlinePanel

from aiidalab_qe.common.widgets import (
QEAppComputationalResourcesWidget,
PwCodeResourceSetupWidget,
)


class Outline(OutlinePanel):
title = "Vibrational properties"
# description = "IR and Raman spectra; you may also select phononic and dielectric properties"
class VibroPluginOutline(PluginOutline):
title = "Vibrational Spectroscopy (VIBRO)"


property = {
"outline": VibroPluginOutline,
"configuration": {
"panel": VibroConfigurationSettingPanel,
"model": VibroConfigurationSettingsModel,
},
"workchain": workchain_and_builder,
}

PhononWorkChainPwCode = PwCodeResourceSetupWidget(
description="pw.x for phonons", # code for the PhononWorkChain workflow",
default_calc_job_plugin="quantumespresso.pw",
Expand All @@ -30,14 +44,14 @@ class Outline(OutlinePanel):
default_calc_job_plugin="phonopy.phonopy",
)

property = {
"outline": Outline,
"code": {
"phonon": PhononWorkChainPwCode,
"dielectric": DielectricWorkChainPwCode,
"phonopy": PhonopyCalculationCode,
},
"setting": Setting,
"workchain": workchain_and_builder,
"result": Result,
}
# property = {
# "outline": Outline,
# "code": {
# "phonon": PhononWorkChainPwCode,
# "dielectric": DielectricWorkChainPwCode,
# "phonopy": PhonopyCalculationCode,
# },
# "setting": Setting,
# "workchain": workchain_and_builder,
# "result": Result,
# }
35 changes: 35 additions & 0 deletions src/aiidalab_qe_vibroscopy/app/model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import traitlets as tl


from aiidalab_qe.common.mixins import HasInputStructure
from aiidalab_qe.common.panel import ConfigurationSettingsModel


class VibroConfigurationSettingsModel(ConfigurationSettingsModel, HasInputStructure):
dependencies = [
"input_structure",
]

simulation_type_options = tl.List(
trait=tl.List(tl.Union([tl.Unicode(), tl.Int()])),
default_value=[
("IR/Raman, Phonon, Dielectric, INS properties", 1),
("IR/Raman and Dielectric in Primitive Cell Approach", 2),
("Phonons for non-polar materials and INS", 3),
("Dielectric properties", 4),
],
)
simulation_type = tl.Int(1)

symmetry_symprec = tl.Float(1e-5)
supercell_x = tl.Int(2)
supercell_y = tl.Int(2)
supercell_z = tl.Int(2)

supercell = tl.List(
trait=tl.Int(),
default_value=[2, 2, 2],
)

def _get_default(self, trait):
return self._defaults.get(trait, self.traits()[trait].default_value)
Loading

0 comments on commit 8d171b0

Please sign in to comment.