[Rdkit-discuss] Fingerprint visualization drawings

2022-12-29 Thread Ling Chan
Dear Colleagues,

Happy New Year!

I am trying to make some illustrations regarding the meaning of fingerprint
bits. Thanks to Jan Jensen for the tips at the recent post of
https://sourceforge.net/p/rdkit/mailman/message/37734537/ .

I just wonder if there is any manual for the fingerprint drawing routines?
I only managed to find the page
http://rdkit.org/docs/source/rdkit.Chem.Draw.html . Butt there does not
seem to be much detail there. For example, Jan's example in the above post
would not be described. I wonder what other function arguments are
available.

Thank you.

Ling
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Error: free(): double free detected in tcache 2 (going from pickles to mol)

2022-12-29 Thread Jason Biggs
Jason Biggs



On Thu, Dec 29, 2022 at 3:22 PM Jarod Younker 
wrote:

> The code compiles fine, but I’m running into a memory deallocation issue
> in ‘Dummy’ if I use ROMol derived from pickled strings:
>
>
>
> Error: free(): double free detected in tcache 2
>
>
>
> If, however, I go from pickle to SMILES and then to ROMol there is no
> memory error.  Somewhere, I’m deallocating memory twice.  Any help would be
> appreciated.
>
>
>
> std::string MolPickle2Smiles(std::string& pickle) {
>
>
>
>   RDKit::ROMol molecule;
>
>   RDKit::MolPickler::molFromPickle(pickle,molecule);
>
>   return RDKit::MolToSmiles(molecule);
>
>
>
> }
>
>
>
> bool Dummy(std::string& pickle1, std::string& pickle2) {
>
>
>
>   RDKit::MOL_SPTR_VECT reacts;
>
>   reacts.clear();
>
>
>
>   //THIS DOESN’T WORK
>
>   RDKit::ROMol molecule;
>

By declaring the 'molecule' in that way you ensure that it will be deleted
automatically when the function exits.  To create an ROMol that persists
after the Dummy function exits you need the 'new' keyword.  Even better is
to start with a smart pointer out of the gate:

bool Dummy(std::string& pickle1) {
  RDKit::MOL_SPTR_VECT reacts;
  reacts.clear();
  RDKit::ROMOL_SPTR mptr;
  RDKit::MolPickler::molFromPickle(pickle1, mptr.get());
  reacts.push_back(mptr);
  return 0;
}

Hope that helps
Jason


>   RDKit::MolPickler::molFromPickle(pickle1,molecule);
>
>   reacts.push_back(RDKit::ROMOL_SPTR());
>
>
>
>   //THIS WORKS
>
>
> //reacts.push_back(RDKit::ROMOL_SPTR(RDKit::SmilesToMol(MolPickle2Smiles(pickle1;
>
>
>
>   return 0;
>
>
>
> }
>
> Sent from my iPhone
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] Error: free(): double free detected in tcache 2 (going from pickles to mol)

2022-12-29 Thread Jarod Younker
The code compiles fine, but I’m running into a memory deallocation issue in 
‘Dummy’ if I use ROMol derived from pickled strings:

Error: free(): double free detected in tcache 2

If, however, I go from pickle to SMILES and then to ROMol there is no memory 
error.  Somewhere, I’m deallocating memory twice.  Any help would be 
appreciated.

std::string MolPickle2Smiles(std::string& pickle) {

  RDKit::ROMol molecule;
  RDKit::MolPickler::molFromPickle(pickle,molecule);
  return RDKit::MolToSmiles(molecule);

}

bool Dummy(std::string& pickle1, std::string& pickle2) {

  RDKit::MOL_SPTR_VECT reacts;
  reacts.clear();

  //THIS DOESN’T WORK
  RDKit::ROMol molecule;
  RDKit::MolPickler::molFromPickle(pickle1,molecule);
  reacts.push_back(RDKit::ROMOL_SPTR());

  //THIS WORKS
  
//reacts.push_back(RDKit::ROMOL_SPTR(RDKit::SmilesToMol(MolPickle2Smiles(pickle1;

  return 0;

}

Sent from my iPhone
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss