Dear Greg,
I just cannot understand what's going on - please take a look below:
std::string strSmiles = "[*]CCCC";
RDKit::RWMol *fragMol = new RDKit::RWMol();
fragMol = RDKit::SmilesToMol(strSmiles);
RDKit::ROMOL_SPTR msp((RDKit::ROMol *)fragMol);
//TESTING
std::string strTest = RDKit::MolToSmiles(*msp.get());
//TEST RESULT: strTest is the same as strSmiles
RDKit::MOL_SPTR_VECT m_vF;
m_vF.push_back(msp);
//TESTING
std::string strTest2 = RDKit::MolToSmiles(*m_vF[0].get());
//TEST RESULT: EXCEPTION
Can you help please!!!!!!
Regards,
Evgueni
On 6 February 2010 05:21, Greg Landrum <greg.land...@gmail.com> wrote:
> Dear Evgueni,
>
> On Fri, Feb 5, 2010 at 11:21 AM, Evgueni Kolossov <ekolos...@gmail.com>
> wrote:
> > Dear Greg,
> >
> > Thank you very much for quick answer.
> > I think the problem is in the copying from one vector to another:
> > for (unsigned int i=9; i < m_vF.size(); i++)
> > vNew.push_back(m_vF[i]);
> >
> > Can this corrupt the content of new vector?
>
> The boost smart pointers can be copied without problems, so this
> shouldn't cause any corruption. Building on the small example I was
> doing before, the following works without problems:
> {
> RWMol *m=new RWMol();
> m->addAtom(new Atom(6));
> m->addAtom(new Atom(6));
> m->addBond(0,1,Bond::SINGLE);
> ROMOL_SPTR msp((ROMol *)m);
> RDKit::MOL_SPTR_VECT m_vF;
> m_vF.push_back(msp);
>
> ROMol *nm = new ROMol(*m_vF[0]);
> m_vF.push_back(ROMOL_SPTR(nm));
>
> RDKit::MOL_SPTR_VECT m_vF2;
> m_vF2.resize(m_vF.size());
> std::copy(m_vF.begin(),m_vF.end(),m_vF2.begin());
> std::cerr<<m_vF2[0]->getNumAtoms()<<std::endl;
> }
>
>
> The original error you saw, from here:
> > T * operator-> () const
> > {
> > BOOST_ASSERT(px != 0);
> > return px;
> > }
> is triggered when you try to dereference a smart pointer that has a
> null pointer as its contents. I'd suggest being sure that your
> original vector doesn't have any empty elements (cases where the
> molecule was a null pointer).
>
> -greg
>
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss