Hello,

I've been trying to add unitcell information to a molecule read from a format without unit cell information. What I want to do is read a molecule in .xyz, add unit cell information and then write the .gro with the correct unit cell information on the last line (a, b and c).

I'm using Pybel to load the .xyz info into an object, but I cannot manage to add the unit cell information after that.
If I do something on the line of:

cell = openbabel.OBUnitCell()
cell.SetData(1.0, 1.0, 1.0, 90.0, 90.0, 90.0)
mol.unitcell = cell

It gives me an AttributeError saying it can't set the attribute.

I tought about using OBPairData, but since it's not a generic information, that wouldn't be useful. I've read through the documentation but I can't understand how I'd set OBGenericData (index 12 for the unitcell) from the Python bindings.

Does anyone know how to add the unit cell in a way that "mol.write("gro")" wil give me a gro file with the correct info?

Thank you in advance,
Henrique



_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to