Skip to content

Commit

Permalink
Add flag to allow POSCAR export
Browse files Browse the repository at this point in the history
  • Loading branch information
pmrv committed May 17, 2024
1 parent 153df5b commit aa6f0c4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pyiron_potentialfit/spgfit/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,11 @@ def main():
action="store_true",
help="Retry the current step from scratch",
)
parser.add_argument(
"--export", type=str,
help="Optionally specify a directory where to dump POSCAR files with the generated structures after everything "
"is finished."
)
args = parser.parse_args()

pr = Project(args.project)
Expand All @@ -881,6 +886,13 @@ def main():
pr.data.write()
if state != "finished" and args.fast_forward is not None:
fast_forward(args.fast_forward, __spec__)
if state == "finished" and args.export is not None:
os.makedirs(args.export, exist_ok=True)
for cont in pr["containers"].iter_jobs(hamilton="StructureContainer"):
dir_path = os.path.join(args.export, cont.name)
os.makedirs(dir_path, exist_ok=True)
for i, s in enumerate(cont.iter_structures()):
s.write(os.path.join(dir_path, cont._container["identifier", i]) + ".POSCAR", format="vasp")


if __name__ == "__main__":
Expand Down

0 comments on commit aa6f0c4

Please sign in to comment.