Giter VIP home page Giter VIP logo

Comments (7)

ffmulks avatar ffmulks commented on May 24, 2024 1

Until I encountered my current somewhat odd research question where kinetics of such reactions became interesting to me, I was also neither aware of the possibility nor need for this. Oh I see, in the openSMILES definition the meaning of this seems to be arbitrary. RDKit implements it as enforced atom index.

Thanks for the reply and the pointers @t-young31! At the moment I am not quite familiar enough yet with the structure of autodE but I think I will be using it quite a lot and when I understood sufficiently how to implement this without breaking everything, I may try and give it a shot.

from autode.

ffmulks avatar ffmulks commented on May 24, 2024 1

Lovely! Just in time for the student starting in my lab who will work on the project. :D

from autode.

t-young31 avatar t-young31 commented on May 24, 2024

Hi @ffmulks – unfortunately, at the moment, there isn't a way to use those kind of SMILES strings to initialise molecules (I wasn't aware that it was possible!).

It would be great to have this functionality, but because no one is working on this project full time I'm not sure it'll be addressed until later on this year. Of course if you would like to implement it and submit a pull request that would be awesome! 😄

Some thoughts/questions if/when it's added:

  • I assume it's §3.1.7 in the openSMILES specification?
  • If it's just an arbitrary integer then does the atom ordering need to be regenerated?
  • An atom_class would need to be added to a SMILESAtom and Atom, defaulting to zero
  • The nodes in the molecular graph would need to add an atom_class attribute
  • Isomorphisms would need to match also on atom_class

from autode.

t-young31 avatar t-young31 commented on May 24, 2024

will try and get this into v1.2.3

from autode.

t-young31 avatar t-young31 commented on May 24, 2024

What version of RDKit are you using that applies the atom classes as indices? Mine (v. 2021.09.4) doesn't seem to do it:

>>> from rdkit import Chem
>>> m = Chem.MolFromSmiles('C[Br:0]')
>>> print(Chem.MolToMolBlock(m))

     RDKit          2D

  2  1  0  0  0  0  0  0  0  0999 V2000
    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    1.2990    0.7500    0.0000 Br  0  0  0  0  0  0  0  0  0  0  0  0
  1  2  1  0
M  END

>>> m = Chem.MolFromSmiles('C[Br:1]')
>>> print(Chem.MolToMolBlock(m))

     RDKit          2D

  2  1  0  0  0  0  0  0  0  0999 V2000
    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    1.2990    0.7500    0.0000 Br  0  0  0  0  0  0  0  0  0  1  0  0
  1  2  1  0
M  END

A version that doesn't reassign atom indices is implemented on atom_index_labeling which can be installed in a similar way to the naming fix branch by replacing fix_naming_clash -> atom_index_labeling. If you have time to test it out that would be awesome. Also, how important is it for atom indices to be reassigned?

Thanks!

from autode.

ffmulks avatar ffmulks commented on May 24, 2024

Just a little oversight, I think. It saves it. That is the 1 that you get in the post-coordinate bit (0 0 0 0 0 0 0 0 0 1 0 0). I run RDKit version 2022.03.2. Thanks a lot, will test ASAP!

Both of these work fine for testing:

from rdkit.Chem import rdChemReactions as Reactions
from rdkit.Chem import Draw

rxn = Reactions.ReactionFromSmarts('C[Cl:1].[Cl-:2]>>C[Cl:2].[Cl-:1]', useSmiles=True)
image = Draw.ReactionToImage(rxn)
image.save('rxn_image.png')
from rdkit import Chem

print(Chem.MolToMolBlock(Chem.MolFromSmiles('C[Cl:1]')))

Labelling starts at 1, so the 0 will not change the molblock but >0 does.

from autode.

ffmulks avatar ffmulks commented on May 24, 2024

Optimization went smoothly, great! Just a note for future optimization: it would save resources to not optimize identical reactants and products. This may be weird to pull off with differently indexed molecules, though. Not a problem for me anyways, this will mostly be used for small molecules.

from autode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.