4
* $Date: 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) $
7
* Copyright (C) 2004-2007 Miguel Rojas <miguel.rojas@uni-koeln.de>
9
* Contact: cdk-devel@lists.sourceforge.net
11
* This program is free software; you can redistribute it and/or
12
* modify it under the terms of the GNU Lesser General Public License
13
* as published by the Free Software Foundation; either version 2.1
14
* of the License, or (at your option) any later version.
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Lesser General Public License for more details.
21
* You should have received a copy of the GNU Lesser General Public License
22
* along with this program; if not, write to the Free Software
23
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
25
package org.openscience.cdk.qsar.descriptors.bond;
27
import org.openscience.cdk.Molecule;
28
import org.openscience.cdk.exception.CDKException;
29
import org.openscience.cdk.interfaces.IAtom;
30
import org.openscience.cdk.interfaces.IAtomContainer;
31
import org.openscience.cdk.interfaces.IBond;
32
import org.openscience.cdk.qsar.DescriptorSpecification;
33
import org.openscience.cdk.qsar.DescriptorValue;
34
import org.openscience.cdk.qsar.IBondDescriptor;
35
import org.openscience.cdk.qsar.descriptors.atomic.PartialSigmaChargeDescriptor;
36
import org.openscience.cdk.qsar.result.DoubleResult;
37
import org.openscience.cdk.tools.manipulator.BondManipulator;
40
* The calculation of bond-sigma Partial charge is calculated
41
* determining the difference the Partial Sigma Charge on atoms
42
* A and B of a bond. Based in Gasteiger Charge.
43
* <p>This descriptor uses these parameters:
48
* <td>Description</td>
51
* <td>bondPosition</td>
53
* <td>The position of the target bond</td>
58
* @author Miguel Rojas
59
* @cdk.created 2006-05-08
61
* @cdk.set qsar-descriptors
62
* @cdk.dictref qsar-descriptors:bondPartialSigmaCharge
63
* @see PartialSigmaChargeDescriptor
65
public class BondPartialSigmaChargeDescriptor implements IBondDescriptor {
67
private PartialSigmaChargeDescriptor descriptor;
71
* Constructor for the BondPartialSigmaChargeDescriptor object
73
public BondPartialSigmaChargeDescriptor() {
74
descriptor = new PartialSigmaChargeDescriptor() ;
79
* Gets the specification attribute of the BondPartialSigmaChargeDescriptor
82
*@return The specification value
84
public DescriptorSpecification getSpecification() {
85
return new DescriptorSpecification(
86
"http://www.blueobelisk.org/ontologies/chemoinformatics-algorithms/#bondPartialSigmaCharge",
87
this.getClass().getName(),
88
"$Id: BondPartialSigmaChargeDescriptor.java 5855 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) egonw $",
89
"The Chemistry Development Kit");
93
* This descriptor does have any parameter.
95
public void setParameters(Object[] params) throws CDKException {
100
* Gets the parameters attribute of the BondPartialSigmaChargeDescriptor object.
102
*@return The parameters value
103
* @see #setParameters
105
public Object[] getParameters() {
111
* The method calculates the bond-sigma Partial charge of a given bond
112
* It is needed to call the addExplicitHydrogensToSatisfyValency method from the class tools.HydrogenAdder.
114
*@param ac AtomContainer
115
*@return return the sigma electronegativity
116
*@exception CDKException Possible Exceptions
118
public DescriptorValue calculate(IBond bond, IAtomContainer ac) throws CDKException {
119
Molecule mol = new Molecule(ac);
120
IAtom[] atoms = BondManipulator.getAtomArray(bond);
121
double[] results = new double[2];
123
Integer[] params = new Integer[1];
124
for(int i = 0 ; i < 2 ; i++){
125
params[0] = new Integer(6);
126
descriptor.setParameters(params);
127
results[i] = ((DoubleResult)descriptor.calculate(atoms[i],mol).getValue()).doubleValue();
130
double result = Math.abs(results[0] - results[1]);
132
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(result));
136
* Gets the parameterNames attribute of the BondPartialSigmaChargeDescriptor object.
138
* @return The parameterNames value
140
public String[] getParameterNames() {
141
return new String[0];
146
* Gets the parameterType attribute of the BondPartialSigmaChargeDescriptor object.
148
* @param name Description of the Parameter
149
* @return An Object of class equal to that of the parameter being requested
151
public Object getParameterType(String name) {