|
From: Marcelino A. <mar...@if...> - 2016-06-20 18:55:18
|
Hi all, I am having problems to assing Partial Charges with OBChargeModel. I basically copy and paste an example from: http://openbabel.org/dev-api/classOpenBabel_1_1OBChargeModel.shtml but it is not working. Can someone please tell me where is my mistake? (the code is here bellow) Thanks, Marcelino include <iostream> #include <openbabel/obconversion.h> #include <openbabel/mol.h> #include <openbabel/chargemodel.h> #include <openbabel/forcefield.h> using namespace OpenBabel; using namespace std; int main(int argc,char **argv) { OBConversion obconversion; obconversion.SetInFormat("mol2"); OBMol mol; bool notatend = obconversion.ReadFile(&mol,"../structures/colorantes.mol2"); while (notatend) { OBChargeModel *mmffCharges = OBChargeModel::FindType("mmff94"); std::vector<double> partialCharges; if (mmffCharges && mmffCharges->ComputeCharges(mol)) { partialCharges = mmffCharges->GetPartialCharges(); cout << " Charges were assigned " << endl; } mol.Clear(); notatend = obconversion.Read(&mol); } return(0); } |