OK, I sort it out. Should be:
ATOM_SPTR at2=(*mol)[*atBegin];

Regards,
Evgueni

2009/3/26 Evgueni Kolossov <[email protected]>

> Greg,
>
> In your example:
>  ATOM_SPTR at2=mol[*atBegin];
> is not working: 'initializing' cannot convert from RDKit::ROMol to
> boost::shared_ptr<T>
>
> Regards,
> Evgueni
>
> 2009/3/25 Greg Landrum <[email protected]>
>
>> [Redirected to the list because the question is of general interest]
>>
>>
>> Hi Evgueni,
>>
>> On Wed, Mar 25, 2009 at 10:56 AM, Evgueni Kolossov
>> <[email protected]> wrote:
>> >
>> > Got some problems with looping over an atom's bonds when I need to
>> compare
>> > (see below):
>> >
>> > double CRDKitDescriptor::GetEdgeDegree(RDKit::Bond * Bond_in, bool
>> > bWeighted) const
>> > {
>> >        double dRtn = 0.0;
>> >        RDKit::ROMol::OEDGE_ITER beg,end;
>> >        RDKit::ROMol mol = Bond_in->getOwningMol();
>> >        //OLD CODE//    RDKit::ROMol::GRAPH_MOL_BOND_PMAP::type pMap =
>> > mol.getBondPMap();
>> >
>> >        // Take two atoms involved in this bond.
>> >        RDKit::Atom *pAtom[2] = { Bond_in->getBeginAtom(),
>> > Bond_in->getEndAtom() };
>> >        for (int i=0; i < 2; i++)
>> >        {
>> >                // Add degrees of other bonds (not connected to H) on
>> this
>> > atom.
>> >                boost::tie(beg,end) = mol.getAtomBonds(pAtom[i]);
>> >                while(beg!=end)
>> >                {
>> >                        //OLD CODE//    RDKit::Bond *pCurrentBond =
>> > pMap[*beg];
>> >                        //NEW CODE//    RDKit::BOND_SPTR pCurrentBond =
>> > (mol)[*beg];
>> > //NOW I have RDKit::Bond pointer and RDKit::BOND_SPTR instead of 2
>> > RDKit::Bond pointers
>> > //and how I am going to compare them?
>> >                        if (pCurrentBond != Bond_in
>> >                                &&
>> > pCurrentBond->getOtherAtom(pAtom[i])->getAtomicNum() != 1)//not 'H' and
>> not
>> > the same bond
>> >                        {
>> >                                // Bond contributes its weight, or 1 if
>> > we're not considering weights.
>> >                dRtn += bWeighted ? GetBondWeight(pCurrentBond) : 1.0;
>> >                        }
>> >                        ++beg;
>> >        }
>> >        }
>> >        return dRtn;
>> > }
>> > Can you help please!!!
>>
>> Indeed, I can.
>> A BOND_SPTR is a boost shared pointer that contains a Bond *. To get
>> the Bond * itself, you call the shared pointer's get() method.
>> Something like this:
>>
>>    if (pCurrentBond.get() != Bond_in)
>>
>> Best Regards,
>> -greg
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Rdkit-discuss mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
>
>
>
>

Reply via email to