Skip to content

Commit

Permalink
fixing bug that made two record files or simulation files get the sam…
Browse files Browse the repository at this point in the history
…e id
  • Loading branch information
Jgmedina95 committed Feb 20, 2024
1 parent e362aa3 commit 2904fe7
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions mdagent/utils/path_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def get_fileid(self, file_name: str, type: FileType):
# Split the filename on underscores
parts, ending = file_name.split(".")
parts_list = parts.split("_")

current_ids = self.list_path_names()
# Extract the timestamp (assuming it's always in the second to last part)
timestamp_part = parts_list[-1]
# Get the last 6 digits of the timestamp
Expand All @@ -218,9 +218,19 @@ def get_fileid(self, file_name: str, type: FileType):
pdb_id = parts_list[0]
return pdb_id + "_" + timestamp_digits
if type == FileType.SIMULATION:
return "sim" + "_" + timestamp_digits
num = 0
sim_id = "sim" + f"{num}" + "_" + timestamp_digits
while sim_id in current_ids:
num += 1
sim_id = "sim" + f"{num}" + "_" + timestamp_digits
return sim_id
if type == FileType.RECORD:
return "rec" + "_" + timestamp_digits
num = 0
rec_id = "rec" + f"{num}" + "_" + timestamp_digits
while rec_id in current_ids:
num += 1
rec_id = "rec" + f"{num}" + "_" + timestamp_digits
return rec_id
if type == FileType.SOLVENT:
return parts + "_" + timestamp_digits

Expand Down

0 comments on commit 2904fe7

Please sign in to comment.