Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add an adjustable intensity factor for XPS spectra #642

Merged
merged 4 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions src/aiidalab_qe/plugins/xps/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def export_xps_data(outputs):


def xps_spectra_broadening(
points, equivalent_sites_data, gamma=0.3, sigma=0.3, label=""
points, equivalent_sites_data, gamma=0.3, sigma=0.3, label="", intensity=1.0
):
"""Broadening the XPS spectra with Voigt function and return the spectra data"""

Expand All @@ -55,7 +55,7 @@ def xps_spectra_broadening(
)
for site in point:
# Weight for the spectra of every atom
intensity = equivalent_sites_data[site]["multiplicity"]
intensity = equivalent_sites_data[site]["multiplicity"] * intensity
relative_core_level_position = point[site]
y = (
intensity
Expand Down Expand Up @@ -117,6 +117,13 @@ def _update_view(self):
disabled=False,
style={"description_width": "initial"},
)
intensity = ipw.FloatText(
value=1.0,
min=0.001,
description="Adjustable Intensity Factor",
disabled=False,
style={"description_width": "initial"},
)
fill = ipw.Checkbox(
description="Fill",
value=True,
Expand All @@ -125,7 +132,7 @@ def _update_view(self):
)
# Create a description label
upload_description = ipw.HTML(
value="<b>Upload Experimental Data (csv format):</b>",
value="Upload Experimental Data (<b>csv format, without header</b>):",
placeholder="",
description="",
)
Expand All @@ -135,7 +142,7 @@ def _update_view(self):
description="Choose File",
multiple=False,
)
upload_container = ipw.VBox([upload_description, upload_btn])
upload_container = ipw.VBox([upload_description, upload_btn, intensity])
upload_btn.observe(self._handle_upload, names="value")

paras = ipw.HBox(
Expand Down Expand Up @@ -171,7 +178,11 @@ def _update_view(self):
self.g.layout.xaxis.autorange = "reversed"
#
spectra = xps_spectra_broadening(
chemical_shifts, equivalent_sites_data, gamma=gamma.value, sigma=sigma.value
chemical_shifts,
equivalent_sites_data,
gamma=gamma.value,
sigma=sigma.value,
intensity=intensity.value,
)
# only plot the selected spectrum
for site, d in spectra[spectrum_select.value].items():
Expand All @@ -189,7 +200,11 @@ def response(change):
xaxis = "Binding Energy (eV)"
#
spectra = xps_spectra_broadening(
points, equivalent_sites_data, gamma=gamma.value, sigma=sigma.value
points,
equivalent_sites_data,
gamma=gamma.value,
sigma=sigma.value,
intensity=intensity.value,
)

for site, d in spectra[spectrum_select.value].items():
Expand Down Expand Up @@ -223,6 +238,7 @@ def response(change):
spectrum_select.observe(response, names="value")
gamma.observe(response, names="value")
sigma.observe(response, names="value")
intensity.observe(response, names="value")
fill.observe(response, names="value")
self.children = [
spectra_type,
Expand Down
2 changes: 1 addition & 1 deletion src/aiidalab_qe/plugins/xps/setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def install_pseudos(pseudo_group="pseudo_demo_pbe"):
def run_(*args, **kwargs):
return run(*args, env=env, capture_output=True, check=True, **kwargs)

run_(["verdi", "archive", "import", url])
run_(["verdi", "archive", "import", url, "--no-import-group"])


class Setting(Panel):
Expand Down
Loading