whitead / synspace

Synthesis generative model
MIT License
35 stars 3 forks source link

Retro step always performed. #3

Closed pschwllr closed 1 year ago

pschwllr commented 1 year ago

Is it intended that one retrosynthesis step is always performed?

I would remove the following line https://github.com/whitead/synspace/blob/016ce66c569acf568c720c2936477cb70842f089/synspace/synspace.py#L36

and use

    mols, props = [], [] # has to be defined, otherwise forward will fail
    if use_mannifold:
        if _pbar:
            _pbar.set_description("⚗️Synspace Retrosynthesis (Mannifold)⚗️")
        mols, props = mannifold_retro(mol)
    else:
        if _pbar and steps[0] > 0:
            _pbar.set_description("⚗️Synspace Retrosynthesis...⚗️")
        # mols, props = retro(mol, rxns=rxns, strict=False if strict is None else strict) # remove this 
        for _ in range(steps[0]): # change 
            to_add = []
            for m, p in zip(mols, props):
                ms, ps = retro(
                    m,
                    rxns=rxns,
                    strict=False if strict is None else strict,
                    start_props=p,
                )
                to_add.append((ms, ps))
            for m, p in to_add:
                mols.extend(m)
                props.extend(p)
                if _pbar:
                    _pbar.update(len(mols))
            mols, props = remove_dups(mols, props)

so that if the steps are (0,1) it only performs a forward step.

whitead commented 1 year ago

Fixed by #4