/src/openbabel/src/charges/gasteiger.cpp
Line | Count | Source |
1 | | /********************************************************************** |
2 | | gasteiger.cpp - A OBChargeModel to handle Gasteiger sigma charges |
3 | | |
4 | | Copyright (C) 2010 by Geoffrey R. Hutchison |
5 | | |
6 | | This file is part of the Open Babel project. |
7 | | For more information, see <http://openbabel.org/> |
8 | | |
9 | | This program is free software; you can redistribute it and/or modify |
10 | | it under the terms of the GNU General Public License as published by |
11 | | the Free Software Foundation version 2 of the License. |
12 | | |
13 | | This program is distributed in the hope that it will be useful, |
14 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | | GNU General Public License for more details. |
17 | | ***********************************************************************/ |
18 | | |
19 | | #include <openbabel/babelconfig.h> |
20 | | #include <openbabel/chargemodel.h> |
21 | | #include <openbabel/mol.h> |
22 | | #include <openbabel/molchrg.h> |
23 | | |
24 | | namespace OpenBabel |
25 | | { |
26 | | |
27 | | class GasteigerCharges : public OBChargeModel |
28 | | { |
29 | | public: |
30 | 2 | GasteigerCharges(const char* ID) : OBChargeModel(ID, false){}; |
31 | 0 | const char* Description() override { return "Assign Gasteiger-Marsili sigma partial charges"; } |
32 | | |
33 | | /// \return whether partial charges were successfully assigned to this molecule |
34 | | bool ComputeCharges(OBMol &mol) override; |
35 | | |
36 | 0 | double DipoleScalingFactor() override { return 3.4927; } // fit from regression |
37 | | }; |
38 | | |
39 | | ///////////////////////////////////////////////////////////////// |
40 | | GasteigerCharges theGasteigerCharges("gasteiger"); //Global instance |
41 | | |
42 | | ///////////////////////////////////////////////////////////////// |
43 | | |
44 | | bool GasteigerCharges::ComputeCharges(OBMol &mol) |
45 | 0 | { |
46 | 0 | mol.SetPartialChargesPerceived(); |
47 | |
|
48 | 0 | OBGastChrg gc; |
49 | 0 | bool returnValue = gc.AssignPartialCharges(mol); |
50 | |
|
51 | 0 | OBChargeModel::FillChargeVectors(mol); |
52 | |
|
53 | 0 | return returnValue; |
54 | 0 | } |
55 | | |
56 | | }//namespace |