aiidalab / aiidalab/aiidalab-qe

Avoid overriding HubbardStructureData

未關閉
#1,003 1 則留言 0 個 reaction 已指派 1 人 已被 @mikibonacci 認領 在 GitHub 檢視
enhancement
主要語言
Python
星號
33
分支
25
平均合併
6 小時 7 分鐘
30 天內合併 PR
8

描述

I want to use an already existing HubbardStructureData for a new calculation. If I upload it to qe-app and enable the Hubbard calculation, it asks me to provide Hubbard U values again and creates (surprisingly) a new HubbardStructureData. In my case, I had both U and V values and the V values were lost. Would it be possible to take the input HubbardStructureData as it is without the need to override the Hubbard parameters?

The workaround that we did with @mikibonacci in src/aiidalab_qe/workflows/\_\_init\_\_.py, starting from the line 135:

```
# Check if hubbard_dict is provided
if hubbard_dict is not None:
if isinstance(structure,HubbardStructureData):
builder.structure = structure
else:
hubbard_parameters = hubbard_dict["hubbard_u"]
hubbard_structure = HubbardStructureData.from_structure(structure)

# Initialize on-site Hubbard values
for key, value in hubbard_parameters.items():
kind, orbital = key.rsplit(" - ", 1)
hubbard_structure.initialize_onsites_hubbard(
atom_name=kind,
atom_manifold=orbital,
value=value,
hubbard_type="U",
use_kinds=True,
)

# Determine whether to store and use hubbard_structure based on conditions
if (
isinstance(structure, HubbardStructureData)
and hubbard_structure.hubbard == structure.hubbard
):
# If the structure is HubbardStructureData and hubbard parameters match, assign the original structure
builder.structure = structure
else:
# In all other cases, store and assign hubbard_structure
hubbard_structure.store()
builder.structure = hubbard_structure
```

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。