Skip to content

Commit

Permalink
fix: stop MP2020 saving a hardcoded config path
Browse files Browse the repository at this point in the history
  • Loading branch information
CompRhys committed Apr 29, 2021
1 parent cb9854d commit ce45ed3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pymatgen/entries/compatibility.py
Expand Up @@ -863,10 +863,17 @@ def __init__(

# load corrections and uncertainties
if config_file:
self.config_file = config_file
if os.path.isfile(config_file):
self.config_file = config_file
c = loadfn(self.config_file)
else:
raise ValueError(
f"Custom MaterialsProject2020Compatibility config_file ({config_file}) does not exist."
)
else:
self.config_file = os.path.join(MODULE_DIR, "MP2020Compatibility.yaml")
c = loadfn(self.config_file)
self.config_file = None
c = loadfn(os.path.join(MODULE_DIR, "MP2020Compatibility.yaml"))

self.name = c["Name"]
self.comp_correction = c["Corrections"].get("CompositionCorrections", defaultdict(float))
self.comp_errors = c["Uncertainties"].get("CompositionCorrections", defaultdict(float))
Expand Down

0 comments on commit ce45ed3

Please sign in to comment.