Skip to content

Commit

Permalink
Implement path for custom config files
Browse files Browse the repository at this point in the history
  • Loading branch information
edan-bainglass committed Feb 15, 2025
1 parent 0441b1c commit fc49f85
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/aiidalab_qe/app/parameters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import yaml

from aiidalab_qe.app import parameters
from aiidalab_qe.app.utils import get_entry_items


def recursive_merge(d1, d2):
Expand Down Expand Up @@ -47,8 +48,13 @@ def recursive_merge(d1, d2):

DEFAULT_PARAMETERS = yaml.safe_load(resources.read_text(parameters, "qeapp.yaml"))

CUSTOM_CONFIG_DIR = Path.home() / ".aiidalab" / "quantum-espresso"

custom_config_file = Path.home() / ".aiidalab" / "quantumespresso" / "config.yml"
if custom_config_file.exists():
configs = ["custom_config.yml"]
configs.extend(get_entry_items("aiidalab_qe.properties", "config").values())
for config in configs:
custom_config_file = CUSTOM_CONFIG_DIR / config
if not custom_config_file.exists():
continue
custom_config = yaml.safe_load(custom_config_file.read_text())
DEFAULT_PARAMETERS = recursive_merge(DEFAULT_PARAMETERS, custom_config)

0 comments on commit fc49f85

Please sign in to comment.