aspuru-guzik-group / funsies

funsies is a lightweight workflow engine 🔧
MIT License
41 stars 3 forks source link

Cannot run crest using funsies #7

Open Leticia-maria opened 2 years ago

Leticia-maria commented 2 years ago

Hello, I have tried to run crest using funsies:

"""Generate a single conformer from a SMILES string."""
from __future__ import annotations

import argparse
import funsies as f
from funsies.types import Encoding

parser = argparse.ArgumentParser(
    description="Compute the spectrum of a molecule using the Vertical Gradient method."
)

parser.add_argument("-c", "--charge", help="charge", type=int, default=0)

args = parser.parse_args()

CHARGE = args.charge

xtbopt = "/home/leticia/Projects/SN1/xtbopt.xyz"
with f.Fun():
    crest_conf = f.shell("crest xtbopt.xyz", inp={"xtbopt.xyz": xtbopt}, out=["crest_best.xyz"], env={"OMP_NUM_THREADS": "40"})

But I got this error:

if you don't want it to be converted to json (and wrapped with "), 
you NEED to pass it as bytes (by .encode()-ing it first)

Important:

ThiagoReschutzegger commented 2 years ago

I had the same problem

clavigne commented 2 years ago

Hi,

That's because you need to pass the content of the file as the value, not the path to the file. Something like

with open("/home/leticia/Projects/SN1/xtbopt.xyz", "rb") as fi:
    xtbopt = fi.read()

To get the data out to a file you'll need to do something like,

f.execute(crest_conf)
f.wait_for(crest_conf)
f.takeout(crest_conf.out['crest_best.xyz'], "path to output")