Skip to content

Instantly share code, notes, and snippets.

@mesprague
Created December 15, 2008 10:21
Show Gist options
  • Save mesprague/35921 to your computer and use it in GitHub Desktop.
Save mesprague/35921 to your computer and use it in GitHub Desktop.
using System;
using OpenBabel;
namespace OBDotNetExamples
{
class Program1
{
static void Main(string[] args)
{
OBConversion obc = new OBConversion();
//set the input format to sdf
obc.SetInFormat("sdf");
//set the output format to smiles
obc.SetOutFormat("smi");
OBMol mol = new OBMol();
//try to read the first mol
//this initalizes the OBConversion
obc.ReadFile(mol,"someMols.mol");
//try to read the rest of the structures
//and print the smiles string and source file name
while (obc.Read(mol))
{
Console.WriteLine(obc.WriteString(mol));
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment