(ccing the list)
---------- Forwarded message ---------- From: Geoffrey Wood <ge.ff...@gmail.com> Date: 28 May 2015 at 13:15 Subject: Re: [Open Babel] perl api To: Noel O'Boyle <baoille...@gmail.com> Hi Noel, I'm not sure exactly how to extract the value of $genOp within the perl script. Obviously printing it doesn't work as I just get a hash reference. If I extract the description of what it is: my $desc=$genOp->Description(); print "$desc\n"; $genOp->Do($obmol2); Then this prints " Generate 3D coordinates" So it seems to be set. Geoff. On Thu, May 28, 2015 at 4:23 AM, Noel O'Boyle <baoille...@gmail.com> wrote: > > Is $genOp NULL if you test it just before calling "Do"? > > On 27 May 2015 at 23:02, Geoffrey Wood <ge.ff...@gmail.com> wrote: > > Hi Geoff, > > > > I downloaded the master again for the latest updates and I've been running > > into a problem that has been documented before. That is, a "segmentation > > fault" when it trys to generate 3D coordinates from a smiles string. The > > rest of the code that I have looking at VectoInts etc works fine but the > > offending part of the code looks like: > > > > my $obconversion2 = Chemistry::OpenBabel::OBConversion->new(); # > > conversion object > > > > my $obmol2 = Chemistry::OpenBabel::OBMol->new(); # molecule > > > > my $genOp = Chemistry::OpenBabel::OBOp::FindType("gen3D"); > > > > $obconversion2->SetInAndOutFormats("smi","xyz"); # conversion formats > > > > $obconversion2->ReadString($obmol2,"CCC"); # convert > > > > $genOp->Do($obmol2); > > > > > > > > With the final line causing the segmentation fault. > > > > > > Any help here would be great as I have spent the last couple of days trying > > to revert back to what I originally had without any success. This is what > > I'm passing to cmake (perl 5.20.0; gcc 4.8.3, swig 3.0.5): > > > > CXX=/home/woodg07/software/gccBuild/bin/g++ > > CC=/home/woodg07/software/gccBuild/bin/gcc cmake ../openbabel-master/ > > -DCMAKE_INSTALL_PREFIX=/home/woodg07/software/openBabel/ -DRUN_SWIG=TRUE > > -DPERL_BINDINGS=TRUE -DSWIG_EXECUTABLE=/home/woodg07/software/swig/bin/swig > > -DEIGEN3_INCLUDE_DIR=/home/woodg07/software/eigen3/include/eigen3/ > > > > > > > > > > On Mon, May 4, 2015 at 5:45 PM, Geoffrey Wood <ge.ff...@gmail.com> wrote: > >> > >> Using version 2.3.1 with the perl bindings I used to have a piece of code > >> that went something like: > >> > >> my $obrotorList = new Chemistry::OpenBabel::OBRotorList; # rotor list > >> object > >> > >> $obrotorList->Setup($obmol); > >> > >> $obrotorList->FindRotors($obmol); > >> > >> > >> my $nRotors = $obrotorList->Size(); # number of rotors found > >> > >> if ($nRotors > 0 ) > >> > >> { > >> > >> my $rotor = new Chemistry::OpenBabel::OBRotor; # create new rotor > >> object > >> > >> my $it=$obrotorList->BeginRotors(); # an STL iterator > >> > >> $rotor=$obrotorList->BeginRotor($it); # get first rotor in list > >> > >> my $increment=0; > >> > >> for (my $j = 0 ; $j < $nRotors ; $j++) > >> > >> { > >> > >> my $v_i = new Chemistry::OpenBabel::VectorInt; # vector of > >> integers for dihedral atoms > >> > >> $v_i = $rotor->GetDihedralAtoms(); > >> > >> if($v_i->size() == 4 ) # make sure that the dihedral has atoms --- > >> babel returns 0's for methyls > >> > >> { > >> > >> } > >> > >> } > >> > >> > >> After updating my release to the master I've found that this code doesn't > >> work anymore, inparticular the line: > >> > >> $v_i->size() > >> > >> gives the error: > >> > >> Can't locate object method "size" via package > >> "Chemistry::OpenBabel::VectorInt" > >> > >> I cannot work out why this is happening, the get function still works, > >> i.e. $v_i->get(0) for example. > >> > >> I did notice that in the OpenBabel.pm file a number of new lines have been > >> added to class definitions: > >> > >> like: *size = *Chemistry::OpenBabelc::VectorInt_size; > >> > >> Could someone help me out here? > >> > >> > >> Thanks in advance, Geoff. > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > > > > > > ------------------------------------------------------------------------------ > > > > _______________________________________________ > > OpenBabel-discuss mailing list > > OpenBabel-discuss@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss > > ------------------------------------------------------------------------------ _______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss