pyiron / FAQs

General question board for pyiron users
3 stars 0 forks source link

How to publish calculation with pyiron? #46

Open jan-janssen opened 5 months ago

jan-janssen commented 5 months ago

Pyiron provides a publication template in https://github.com/pyiron/pyiron-publication-template this template is based on the project being archived before. In many cases you might not want to archive all calculation in a given project. So below is a short example code to copy the calculation to an archive project and then pack this project for publication.

from pyiron_atomistics import Project

# Create an example calculation 
pr_origin = Project("origin")
job = pr_origin.create.job.Lammps("lmp")
job.structure = pr_origin.create.structure.ase.bulk("Al", cubic=True)
job.run()

# Copy selected calculation 
pr_archive = Project("archive")
job_new = job.copy_to(project=pr_archive)

# Backup selected calculation with all output files
pr_archive.pack(destination_path="publish", copy_all_files=True)

# clean up 
pr_archive.remove(enable=True)
pr_origin.remove(enable=True)

# Restore backup 
Project(".").unpack(origin_path="publish")