diff --git a/src/aiidalab_qe_vibroscopy/app/workchain.py b/src/aiidalab_qe_vibroscopy/app/workchain.py index 06cc126..41cd05c 100644 --- a/src/aiidalab_qe_vibroscopy/app/workchain.py +++ b/src/aiidalab_qe_vibroscopy/app/workchain.py @@ -56,7 +56,7 @@ def get_builder(codes, structure, parameters): "supercell_matrix": supercell_matrix, }, "dielectric": {"scf": deepcopy(parameters["advanced"])}, - "symmetry:": {"symprec": parameters["vibronic"]["symmetry_symprec"]}, + "symmetry": {"symprec": parameters["vibronic"]["symmetry_symprec"]}, } # Update code information with resource configurations diff --git a/src/aiidalab_qe_vibroscopy/workflows/vibroworkchain.py b/src/aiidalab_qe_vibroscopy/workflows/vibroworkchain.py index 26738a9..be7cd7d 100644 --- a/src/aiidalab_qe_vibroscopy/workflows/vibroworkchain.py +++ b/src/aiidalab_qe_vibroscopy/workflows/vibroworkchain.py @@ -481,8 +481,12 @@ def get_builder_from_protocol( ) else: builder.phonopy_bands_dict = Dict(dict=PhononProperty.BANDS.value) + builder.phonopy_bands_dict["symmetry_tolerance"] = overrides[ + "symmetry" + ]["symprec"] builder.phonopy_pdos_dict = Dict( dict={ + "symmetry_tolerance": overrides["symmetry"]["symprec"], "pdos": "auto", "mesh": 150, # 1000 is too heavy "write_mesh": False, @@ -491,6 +495,7 @@ def get_builder_from_protocol( builder.phonopy_thermo_dict = Dict( dict={ + "symmetry_tolerance": overrides["symmetry"]["symprec"], "tprop": True, "mesh": 200, # 1000 is too heavy "write_mesh": False, @@ -552,9 +557,8 @@ def get_builder_from_protocol( builder_phonon.phonopy.settings = Dict(dict={"keep_phonopy_yaml": True}) # MBO: I do not understand why I have to do this, but it works - symmetry = builder_phonon.pop("symmetry") builder.phonon = builder_phonon - builder.phonon.symmetry = symmetry + builder.phonon.symmetry = overrides["symmetry"] # Adding the bands and pdos inputs. if structure.pbc != (True, True, True): @@ -624,8 +628,12 @@ def get_builder_from_protocol( ) else: builder.phonopy_bands_dict = Dict(dict=PhononProperty.BANDS.value) + builder.phonopy_bands_dict["symmetry_tolerance"] = overrides[ + "symmetry" + ]["symprec"] builder.phonopy_pdos_dict = Dict( dict={ + "symmetry_tolerance": overrides["symmetry"]["symprec"], "pdos": "auto", "mesh": 150, # 1000 is too heavy "write_mesh": False, @@ -634,6 +642,7 @@ def get_builder_from_protocol( builder.phonopy_thermo_dict = Dict( dict={ + "symmetry_tolerance": overrides["symmetry"]["symprec"], "tprop": True, "mesh": 200, # 1000 is too heavy "write_mesh": False, @@ -649,12 +658,10 @@ def get_builder_from_protocol( **kwargs, ) - # MBO: I do not understand why I have to do this, but it works. maybe related with excludes. - symmetry = builder_dielectric.pop("symmetry") if structure.pbc != (True, True, True): builder_dielectric.pop("kpoints_parallel_distance", None) builder.dielectric = builder_dielectric - builder.dielectric.symmetry = symmetry + builder.dielectric.symmetry = overrides["symmetry"] builder.dielectric.property = dielectric_property # Deleting the not needed parts of the builder: diff --git a/tests/conftest.py b/tests/conftest.py index 3f6d75a..f085677 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -48,14 +48,15 @@ def _fixture_code(entry_point_name): def generate_structure_data(): """generate a `StructureData` object.""" - def _generate_structure_data(name="silicon", pbc=(True, True, True)): + def _generate_structure_data(name="silicon"): if name == "silicon": structure = orm.StructureData( cell=[ [3.84737, 0.0, 0.0], [1.923685, 3.331920, 0.0], [1.923685, 1.110640, 3.141364], - ] + ], + pbc=(True, True, True), ) structure.append_atom(position=(0.0, 0.0, 0.0), symbols="Si") structure.append_atom(position=(1.923685, 1.110640, 0.785341), symbols="Si") @@ -65,7 +66,8 @@ def _generate_structure_data(name="silicon", pbc=(True, True, True)): [4.18, 0.0, 0.0], [0.0, 4.18, 0.0], [0.0, 0.0, 2.66], - ] + ], + pbc=(True, True, True), ) structure.append_atom(position=(0.0, 0.0, 0.0), symbols="Si") structure.append_atom(position=(2.09, 2.09, 1.33), symbols="Si") @@ -88,11 +90,23 @@ def _generate_structure_data(name="silicon", pbc=(True, True, True)): ["O", "O", (0, 0, 10.201532881212)], ["Li", "Li", (0, 0, 6.9018028772754)], ] - structure = orm.StructureData(cell=cell) + structure = orm.StructureData(cell=cell, pbc=(True, True, True)) for site in sites: structure.append_atom(position=site[2], symbols=site[0], name=site[1]) - structure.pbc = pbc + + elif name == "2D-xy-arsenic": + cell = [[3.61, 0, 0], [-1.80, 3.13, 0], [0, 0, 21.3]] + structure = orm.StructureData(cell=cell, pbc=(True, True, False)) + structure.append_atom( + position=(1.804, 1.042, 11.352), symbols="As", name="As" + ) + structure.append_atom(position=(0, 2.083, 9.960), symbols="As", name="As") + + elif name == "1D-x-carbon": + cell = [[4.2, 0, 0], [0, 20, 0], [0, 0, 20]] + structure = orm.StructureData(cell=cell, pbc=(True, False, False)) + structure.append_atom(position=(0, 0, 0), symbols="C", name="C") return structure diff --git a/tests/test_settings.py b/tests/test_settings.py index f2ca0f1..88d7db6 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -47,3 +47,31 @@ def test_settings(): parameters = configure_step.settings["vibronic"].get_panel_value() assert parameters["simulation_mode"] == 1 assert parameters["supercell_selector"] == [2, 2, 2] + + +@pytest.mark.usefixtures("sssp") +def test_xy_settings(generate_structure_data): + """Test the settings of the vibroscopy app.""" + + from aiidalab_qe.app.configuration import ConfigureQeAppWorkChainStep + + configure_step = ConfigureQeAppWorkChainStep() + structure = generate_structure_data("2D-xy-arsenic") + configure_step.input_structure = structure + configure_step.workchain_settings.properties["vibronic"].run.value = True + parameters = configure_step.settings["vibronic"].get_panel_value() + assert parameters["supercell_selector"] == [2, 2, 1] + + +@pytest.mark.usefixtures("sssp") +def test_x_settings(generate_structure_data): + """Test the settings of the vibroscopy app.""" + + from aiidalab_qe.app.configuration import ConfigureQeAppWorkChainStep + + configure_step = ConfigureQeAppWorkChainStep() + structure = generate_structure_data("1D-x-carbon") + configure_step.input_structure = structure + configure_step.workchain_settings.properties["vibronic"].run.value = True + parameters = configure_step.settings["vibronic"].get_panel_value() + assert parameters["supercell_selector"] == [2, 1, 1] diff --git a/tests/test_submit/test_create_builder_default.yml b/tests/test_submit/test_create_builder_default.yml index 57ff655..bb9be5f 100644 --- a/tests/test_submit/test_create_builder_default.yml +++ b/tests/test_submit/test_create_builder_default.yml @@ -39,11 +39,11 @@ codes: nodes: 1 ntasks_per_node: 1 pw: - cpus: 10 + cpus: 8 cpus_per_task: 1 max_wallclock_seconds: 43200 nodes: 1 - ntasks_per_node: 10 + ntasks_per_node: 8 parallelization: {} vibronic: simulation_mode: 1 @@ -51,6 +51,7 @@ vibronic: - 2 - 2 - 2 + symmetry_symprec: 1.0e-05 workchain: electronic_type: metal properties: