Dear Noel

Thanks a lot for your valuable hint and it works, I created a loop and
wrote the conformers as individual SDF file (code below), then I combine
all the individual SDF files into one using Openbabel GUI (not an ideal way
to do),

conformer.Setup(mol,5);

conformer.GetConformers(mol);

for(int i=1;i<6;i++) {

mol.SetConformer(i);

String fileName = "fileName"+ i +".sdf";

conv.WriteFile(mol,fileName); //
}

Is there a way that I could do it programmatically to combine all the
individual files into a single SDF file? any hints? Thank you.




On Wed, Dec 20, 2017 at 2:12 PM, Noel O'Boyle <baoille...@gmail.com> wrote:

> Have you tried SetConformer(int n)? This switches the coordinates of the
> molecule between the available conformers.
>
> On 20 December 2017 at 12:35, Vinothkumar Mohanakrishnan <
> kmvin...@gmail.com> wrote:
>
>> Dear OpenBabelers
>>
>> I am using OpenBabel in my Java application.I would like to generate set
>> of conformers for my molecule using Openbabel and write the generated
>> conformers to an output file (SDF format).
>>
>> I am able to generate the conformers using GetConformers method in
>> OBConformerSearch class, Since, the return type of the method is void, I am
>> not able to get hold of the generated conformers and write them to the
>> output file. It would be great if I can have a list of generated conformers
>> which I can later write them in an SDF file?
>>
>> Below is the java code, by the way with this code, writes only one
>> generated conformer to the output file.
>>
>> System.loadLibrary("openbabel_java");
>>
>> OBMol mol = new OBMol();
>>
>> OBConformerSearch conformer = new OBConformerSearch();
>>
>> OBConversion conv = new OBConversion();
>>
>> conv.ReadFile(mol,"input.mol");
>>
>> conv.SetOutFormat("sdf");
>>
>> conformer.Setup(mol,5);
>>
>> conformer.GetConformers(mol);
>>
>> conv.WriteFile(mol, "conformers.sdf");
>>
>>
>> I have seen a similar post
>> ​ ​
>> (
>> http://forums.openbabel.org/Generating-a-diverse-set-of-conf
>> ormers-td4656011.html
>> )
>> in python but there seems to be no answer.
>> Any suggestion in the right direction is highly appreciated. Thank you.
>>
>> --
>> Regards
>> Vinothkumar Mohanakrishnan
>>
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> OpenBabel-discuss mailing list
>> OpenBabel-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>
>>
>


-- 
Regards
Vinothkumar Mohanakrishnan
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to