Skip to content

Commit

Permalink
make sure the plot name is not repeated
Browse files Browse the repository at this point in the history
  • Loading branch information
Jgmedina95 committed Feb 20, 2024
1 parent b2f264a commit 6fb06b5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mdagent/tools/base_tools/analysis_tools/rdf_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ def _run(self, input):
ax.set_xlabel(r"$r$ (nm)")
ax.set_ylabel(r"$g(r)$")
ax.set_title("RDF")
image_name = "rdf_{}.png".format(trajectory_id)
num = 0
image_name = "rdf{}_{}.png".format(num, trajectory_id)
while image_name in self.path_registry.list_path_names():
num += 1
image_name = "rdf_{}_{}.png".format(trajectory_id, num)

plt.savefig(image_name)
plt.close()
return (
Expand Down

0 comments on commit 6fb06b5

Please sign in to comment.