josejimenezluna / delfta

Δ-QML for medicinal chemistry
GNU Affero General Public License v3.0
96 stars 16 forks source link

Add default option tasks="all" to DelftaCalculator #9

Closed cisert closed 3 years ago

cisert commented 3 years ago

https://github.com/josejimenezluna/delfta/blob/67f1703a9dd2b0aea60bd8edc8624fd4ea79a0e4/delfta/calculator.py#L18

cisert commented 3 years ago

When tasks="all", charges are not returned from the calculator.

josejimenezluna commented 3 years ago

?

In [3]:     from openbabel.pybel import readstring
   ...: 
   ...:     mols = [readstring("smi", "CCO")]
   ...:     calc = DelftaCalculator(
   ...:         tasks="all",
   ...:         delta=True,
   ...:         force3D=True,
   ...:     )

In [4]:     preds_delta = calc.predict(mols, batch_size=32)
   ...: 
2021/06/18 03:16:16 PM | DelFTa | INFO: Assigned MMFF94 coordinates to molecules with idx. [0]
2021/06/18 03:16:16 PM | DelFTa | INFO: Now running network for model multitask_delta...
2021/06/18 03:16:19 PM | DelFTa | INFO: Now running network for model single_energy_delta...
2021/06/18 03:16:19 PM | DelFTa | INFO: Now running network for model charges_delta...
2021/06/18 03:16:19 PM | DelFTa | INFO: Now running xTB...

In [5]: preds_delta
Out[5]: 
{'E_homo': array([-0.34795533]),
 'E_lumo': array([0.20835459]),
 'E_gap': array([0.55864072]),
 'dipole': array([1.72065301]),
 'E_form': array([-1.5600189], dtype=float32),
 'charges': array([[-0.0834298 ,  0.12999302, -0.3572342 ,  0.0377308 ,  0.02626066,
          0.04680862,  0.01781182,  0.0433155 ,  0.17601211]],
       dtype=float32)}
cisert commented 3 years ago

This only seems to happen if you pass multiple molecules.

mols = [readstring("smi", "CCO"), readstring("smi", "CCCC")] 
# rest of code the same 
# >> error
error_message