Skip to content

Commit

Permalink
Support for multiple potential file locaitons
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed Mar 1, 2021
1 parent fb38c7a commit 0fbb225
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions pyiron_atomistics/atomistics/job/potentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def _get_potential_df(plugin_name, file_name_lst, backward_compatibility_name):
for conda_var in ["CONDA_PREFIX", "CONDA_DIR"]:
if conda_var in env.keys(): # support iprpy-data package
resource_path_lst += [os.path.join(env[conda_var], "share", "iprpy")]
df_lst = []
for resource_path in resource_path_lst:
if os.path.exists(os.path.join(resource_path, plugin_name, "potentials")):
resource_path = os.path.join(resource_path, plugin_name, "potentials")
Expand All @@ -128,7 +129,7 @@ def _get_potential_df(plugin_name, file_name_lst, backward_compatibility_name):
periodic_table_file_name in file_lst
and periodic_table_file_name.endswith(".csv")
):
return pandas.read_csv(
df_lst.append(pandas.read_csv(
os.path.join(path, periodic_table_file_name),
index_col=0,
converters={
Expand All @@ -143,15 +144,11 @@ def _get_potential_df(plugin_name, file_name_lst, backward_compatibility_name):
.strip("[]")
.split(", "),
},
)
elif (
periodic_table_file_name in file_lst
and periodic_table_file_name.endswith(".h5")
):
return pandas.read_hdf(
os.path.join(path, periodic_table_file_name), mode="r"
)
raise ValueError("Was not able to locate the potential files.")
))
if len(df_lst) > 0:
return pandas.concat(df_lst)
else:
raise ValueError("Was not able to locate the potential files.")

@staticmethod
def _get_potential_default_df(
Expand Down

0 comments on commit 0fbb225

Please sign in to comment.