Hello,

I`m trying to retrive charge density (OBGridData) from Gaussuan Cube using
OBDotNet (latest version).
My code looks like this:

conv    =    new OBConversion();
mol     =    new OBMol();

if (!conv.SetInFormat("CUBE")) {
    throw new Exception("cann`t set input format");
}

if (!conv.ReadFile(mol, "test3.cube")) {
    throw new Exception("cann`t open \"test3.cube\" file");
}

VectorpData    data_set = mol.GetAllData(openbabelcsharp.GridData);

for (int i=0; i<data_set.Count; i++) {
    OBGenericData data = data_set[i];
    Debug.WriteLine("Data #" + i + " : " + data.GetAttribute() + ",
type="+data.GetDataType() + data.ToString());

    OBGridData    grid = (OBGridData)data; // <-- InvalidCastException
}

Molecule is loaded successfully.
data.GetDataType() returns 24 (openbabelcsharp.GridData)
An exception on type casting is occurs.

What is a right way get OBGridData?

Thanks before hand.
Alex.
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
OpenBabel-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to