|
I am writing a workflow that will depend on previous calculations performed with simmate. For example, I have performed relaxations on many structures and now want to perform static energy calculations on those structures that have already been relaxed and are in the simmate database. I am having trouble figuring out to: 1) pull the "structure" column from a database table to perform calculations on, 2) filter to only perform my new workflow on the wanted structures and 3) exclude duplicates in the table so I am not performing the static energy calculation on multiple of the same structure that is present in the relaxation table. I know that the fifth line of code, |
Replies: 1 comment 2 replies
Try this updated script: from simmate.database import connect
from simmate.workflows.utilities import get_workflow
# Grab the database table from our workflow object
relax_workflow = get_workflow("relaxation.vasp.matproj")
relax_results = relax_workflow.all_results
# Filter down to the structure you'd like
structures = (
relax_results.filter(
spacegroup=148,
formula_anonymous="ABC6",
)
.distinct("formula_full")
.all()
)
# Then submit each of these to the new workflow.
# There's no need to grab the structure column because Simmate does it for you
static_workflow = get_workflow("static-energy.vasp.matproj")
static_jobs = []
for structure in structures:
status = static_workflow.run_cloud(
structure=structure,
tags = ["radomster"],
command="mpirun vasp_std > vasp.out",
)
static_jobs.append(status) |
to_toolkitmethod. But since you are using these for a new calculation, you can actually just give the database object to your workflow.first()on your search results. You might also want to do something like "give me the most recent one" in which case you would doorder_by("-created_at").first(). Your case is slightly different where you want to re…