~ubuntu-branches/ubuntu/maverick/cdk/maverick

« back to all changes in this revision

Viewing changes to src/org/openscience/cdk/qsar/descriptors/atomic/PartialTChargeMMFF94Descriptor.java

  • Committer: Bazaar Package Importer
  • Author(s): Paul Cager
  • Date: 2008-04-09 21:17:53 UTC
  • Revision ID: james.westby@ubuntu.com-20080409211753-46lmjw5z8mx5pd8d
Tags: upstream-1.0.2
ImportĀ upstreamĀ versionĀ 1.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Revision: 5855 $ $Author: egonw $ $Date: 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) $
 
2
 * 
 
3
 * Copyright (C) 2006-2007  The Chemistry Development Kit (CDK) project
 
4
 *
 
5
 * Contact: cdk-devel@lists.sourceforge.net
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or
 
8
 * modify it under the terms of the GNU Lesser General Public License
 
9
 * as published by the Free Software Foundation; either version 2.1
 
10
 * of the License, or (at your option) any later version.
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU Lesser General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU Lesser General Public License
 
18
 * along with this program; if not, write to the Free Software
 
19
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 
20
 */
 
21
package org.openscience.cdk.qsar.descriptors.atomic;
 
22
 
 
23
import org.openscience.cdk.charges.MMFF94PartialCharges;
 
24
import org.openscience.cdk.exception.CDKException;
 
25
import org.openscience.cdk.interfaces.IAtom;
 
26
import org.openscience.cdk.interfaces.IAtomContainer;
 
27
import org.openscience.cdk.qsar.AbstractAtomicDescriptor;
 
28
import org.openscience.cdk.qsar.DescriptorSpecification;
 
29
import org.openscience.cdk.qsar.DescriptorValue;
 
30
import org.openscience.cdk.qsar.result.DoubleResult;
 
31
 
 
32
/**
 
33
 *  The calculation of total partial charges of an heavy atom is based on MMFF94 model.
 
34
 *  
 
35
 * <p>This descriptor uses these parameters:
 
36
 * <table border="1">
 
37
 *   <tr>
 
38
 *     <td>Name</td>
 
39
 *     <td>Default</td>
 
40
 *     <td>Description</td>
 
41
 *   </tr>
 
42
 *   <tr>
 
43
 *     <td></td>
 
44
 *     <td></td>
 
45
 *     <td>no parameters</td>
 
46
 *   </tr>
 
47
 * </table>
 
48
 *
 
49
 *
 
50
 * @author      Miguel Rojas
 
51
 * @cdk.created 2006-04-11
 
52
 * @cdk.module  builder3d
 
53
 * @cdk.set     qsar-descriptors
 
54
 * @cdk.dictref qsar-descriptors:partialTChargeMMFF94
 
55
 * @see MMFF94PartialCharges
 
56
 */
 
57
public class PartialTChargeMMFF94Descriptor extends AbstractAtomicDescriptor {
 
58
 
 
59
        private MMFF94PartialCharges mmff;
 
60
 
 
61
 
 
62
    /**
 
63
     *  Constructor for the PartialTChargeMMFF94Descriptor object
 
64
     */
 
65
    public PartialTChargeMMFF94Descriptor() { 
 
66
        mmff = new MMFF94PartialCharges();
 
67
    }
 
68
 
 
69
 
 
70
    /**
 
71
     *  Gets the specification attribute of the PartialTChargeMMFF94Descriptor  object
 
72
     *
 
73
     *@return    The specification value
 
74
     */
 
75
    public DescriptorSpecification getSpecification() {
 
76
        return new DescriptorSpecification(
 
77
            "http://www.blueobelisk.org/ontologies/chemoinformatics-algorithms/#partialTChargeMMFF94",
 
78
            this.getClass().getName(),
 
79
            "$Id: PartialTChargeMMFF94Descriptor.java 5855 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) egonw $",
 
80
            "The Chemistry Development Kit");
 
81
    }
 
82
 
 
83
 
 
84
    /**
 
85
     * This descriptor does not have any parameter to be set.
 
86
     */
 
87
    public void setParameters(Object[] params) throws CDKException {
 
88
        // no parameters
 
89
    }
 
90
 
 
91
 
 
92
    /**
 
93
     *  Gets the parameters attribute of the PartialTChargeMMFF94Descriptor
 
94
     *  object
 
95
     *
 
96
     *@return    The parameters value
 
97
     *@see #setParameters
 
98
     */
 
99
    public Object[] getParameters() {
 
100
        return null;
 
101
    }
 
102
 
 
103
 
 
104
    /**
 
105
     *  The method returns partial charges assigned to an heavy atom through MMFF94 method.
 
106
     *  It is needed to call the addExplicitHydrogensToSatisfyValency method from the class tools.HydrogenAdder.
 
107
     *
 
108
     *@param  atom             The IAtom for which the DescriptorValue is requested
 
109
     *@param  ac                AtomContainer
 
110
     *@return                   an array of doubles with partial charges of [heavy, proton_1 ... proton_n]
 
111
     *@exception  CDKException  Possible Exceptions
 
112
     */
 
113
    public DescriptorValue calculate(IAtom atom, IAtomContainer ac) throws CDKException {
 
114
        DoubleResult aphaPartialCharge;
 
115
        try {
 
116
                mmff.assignMMFF94PartialCharges(ac);
 
117
                IAtom target = atom;
 
118
                aphaPartialCharge = new DoubleResult(((Double)target.getProperty("MMFF94charge")).doubleValue());
 
119
        } catch (Exception ex1) {
 
120
                    throw new CDKException("Problems with assignMMFF94PartialCharges due to " + ex1.toString(), ex1);
 
121
        }
 
122
        return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), aphaPartialCharge);
 
123
    }
 
124
 
 
125
 
 
126
    /**
 
127
     *  Gets the parameterNames attribute of the PartialTChargeMMFF94Descriptor
 
128
     *  object
 
129
     *
 
130
     * @return    The parameterNames value
 
131
     */
 
132
    public String[] getParameterNames() {
 
133
        return new String[0];
 
134
    }
 
135
 
 
136
 
 
137
    /**
 
138
     *  Gets the parameterType attribute of the PartialTChargeMMFF94Descriptor
 
139
     *  object
 
140
     *
 
141
     *@param  name  Description of the Parameter
 
142
     *@return       The parameterType value
 
143
     */
 
144
    public Object getParameterType(String name) {
 
145
         return null;
 
146
    }
 
147
}
 
148