avogadrolibs icon indicating copy to clipboard operation
avogadrolibs copied to clipboard

Property Calculator Scripts

Open ghutchis opened this issue 1 year ago • 6 comments

Beyond the "command" scripts, it would be good to add scripts that calculate properties (potentially with a UI)

  • optional config dialog
  • called on every change to the molecule
  • filtered based on chemistry (e.g., can it handle metals, unit cells, etc.)
  • can request changes to 3D geometry vs. just changes to the atoms / bond graph

Returns JSON, e.g.

{
  "properties": {
     "logP": 3.45,
     "pKa": 6.7,
  }
}

It might also be useful for this to include data for graphs e.g., x, y as arrays.

ghutchis avatar Nov 03 '23 16:11 ghutchis

That's a good point a "properties" script type that was called whenever the molecule changes (and killed if the molecule changes before the calculation is finished).

I guess it would be useful to separate changes for 0D / 2D descriptors vs. 3D descriptors.

Do you think these scripts would need filtering based on elements / unit cells, etc.?

It could be a nice option.

What could be done:

  • restrict computation to selected part of the molecule
  • in more far futur it could be nice to have gradient like visualisation tool (like tone of red and green). This make possible to show user which part of the molecule / polymer is hydrophobic, biodegradable, .... For that computation of molecular properties still on the script side, just allowing as return value to describe which atoms have what scale of the porperty. Also This visualisation should appear only clicked in the visual properties editor. It's a little bit ambitious but usefull when designing molecules

Is can request changes to 3D geometry vs. just changes to the atoms / bond graph not already the role of Input Generators scripts ?

For optional config dialog I suggest a generic place to configure any scripts/plugins of avogadro. Eg change a little bit the plugindownloader to "extension manager" where additionnally to download feature, user could click on "configure" and open that config ui, the config ui is modified by the script to include script specific option (same way userOptions customise the dialog popup).

research11111 avatar Nov 04 '23 08:11 research11111

This is a good reminder to write the docs on atom properties and changing colors on atoms. 😄

ghutchis avatar Nov 04 '23 16:11 ghutchis

This should also include bond / angle / torsion properties. For example, someone may want to identify bond dissociation energies or label bond lengths, etc.

ghutchis avatar Nov 08 '23 19:11 ghutchis

Here is a sample of the run_command that compute logP of the molecule

def run_command():

    stdinStr = sys.stdin.read()
    opts = json.loads(stdinStr)
    smiles = jsonStrToMol(opts)
    mol = Chem.MolFromSmiles(smiles)
    calc = Calculator(SLogP())
    result = calc(mol)
    
    return {
        "properties": {
            "logP": result['SLogP']
        }
    }

jsonStrToMol take in account the current selection if any. If many molecules are displayed the total logP value is computed

Waiting integration 🚀 😄

research11111 avatar Nov 10 '23 11:11 research11111