Skip to content

Commit

Permalink
Improved how database library labels are created.
Browse files Browse the repository at this point in the history
Now libraries will not have empty labels if a
leaf directory is directly specified by the user.
  • Loading branch information
ssun30 committed Jan 27, 2025
1 parent 8caf40e commit bba3c41
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion rmgpy/data/kinetics/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,16 @@ def load_libraries(self, path, libraries=None):
for f in files:
if f.lower() == 'reactions.py':
library_file = os.path.join(root, f)
label = os.path.dirname(library_file)[len(path) + 1:]
dirname = os.path.dirname(library_file)
if dirname == path:
label = os.path.basename(dirname)
else:
label = os.path.relpath(dirname, path)

if not label:
logging.warning(f"Empty label for {library_file}. Using 'default'.")
label = "default"

logging.info(f'Loading kinetics library {label} from {library_file}...')
library = KineticsLibrary(label=label)
try:
Expand Down

0 comments on commit bba3c41

Please sign in to comment.