Sorry - forgot to reply.

Do you need OpenMP on the Open Babel side (i.e. if not, turn off it
off)? Your original email didn't make it clear whether it was just the
client code that needed OpenMP, or you are compiling OB with OpenMP
support also.

The warning may indicate that your BABEL_DATADIR is not set correctly,
though I'm not sure.

Regards,
- Noel

On 8 November 2016 at 07:46, Nicolas Cheron
<nicolas.cheron.bou...@gmail.com> wrote:
> Dear all,
>
> Did anyone ever manage to use both openMP and openBabel in the same code?
>
> Thank you.
>
> Nicolas
>
>
> 2016-10-29 9:11 GMT+02:00 Nicolas Cheron <nicolas.cheron.bou...@gmail.com>:
>>
>> Dear all,
>>
>> I would like to use OpenMP with a code that uses the Openbabel library,
>> and I am facing problems. I have copied an example of a simple code below. I
>> have tried with Openbabel 2.3.2 and 2.4.1. I am compiling with:
>>
>> g++ -O3 -Wall -std=c++11 -Wno-uninitialized
>> -I/home/nicolas/Programs/Openbabel_2.3.2/include/openbabel-2.0 -lm -fopenmp
>> -c File.cpp -o File.o
>> g++ File.o -o File.exe -rdynamic
>> /home/nicolas/Programs/Openbabel_2.3.2/lib/libopenbabel.so
>> -Wl,-rpath,/home/nicolas/Programs/Openbabel_2.3.2/lib -fopenmp
>>
>> When using the following, it works and produces 20 files (Ligand_0_x.xyz
>> with x from 0 to 19):
>> export OMP_NUM_THREADS=1
>> ./File.exe
>>
>> When I set export OMP_NUM_THREADS=4, it fails with:
>> ==============================
>> *** Open Babel Warning  in Translate
>>   Cannot perform atom type translation: table cannot find requested types.
>> Erreur de segmentation (core dumped)
>>
>>
>> Can someone please help me fixing it. I am now wondering if it is possible
>> to mix OpenMP and Openbabel.
>>
>> Thank you
>>
>> Nicolas
>>
>>
>>
>> ***********************************************
>> #include <openbabel/mol.h>
>> #include <openbabel/obconversion.h>
>> #include <openbabel/forcefield.h>
>> #include <openbabel/atom.h>
>> #include <omp.h>
>>
>> using namespace std;
>>
>> int main(int nbarg, char * argv[])
>> {
>>    #pragma omp parallel for
>>    for (int x=0 ; x < 20 ; x++) {
>>       //Convert thread index and x in string
>>       ostringstream threadFlow;
>>       threadFlow << omp_get_thread_num();
>>       string thread = threadFlow.str();
>>       ostringstream xFlow;
>>       xFlow << x;
>>       string counter = xFlow.str();
>>
>>       //Read the input file
>>       OpenBabel::OBMol obMol;
>>       OpenBabel::OBConversion obConversion;
>>       OpenBabel::OBFormat *format =
>> obConversion.FormatFromExt("Molecule.pdb");
>>       obConversion.SetInFormat(format);
>>       obConversion.ReadFile(&obMol, "Molecule.pdb");
>>
>>       //Convert the object in xyz
>>       string outputFileName = "Ligand_" + thread + "_" + counter + ".xyz";
>>       obConversion.SetOutFormat("xyz");
>>       obMol.SetTitle(outputFileName);
>>       obConversion.WriteFile(&obMol, outputFileName);
>>       }
>>     return 0;
>> }
>>
>>
>>
>>
>
>
> ------------------------------------------------------------------------------
> Developer Access Program for Intel Xeon Phi Processors
> Access to Intel Xeon Phi processor-based developer platforms.
> With one year of Intel Parallel Studio XE.
> Training and support from Colfax.
> Order your platform today. http://sdm.link/xeonphi
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to