Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: joelib/desc/types/ElectronAffinity.java


1   ///////////////////////////////////////////////////////////////////////////////
2   //  Filename: $RCSfile: ElectronAffinity.java,v $
3   //  Purpose:  Electron affinity.
4   //  Language: Java
5   //  Compiler: JDK 1.4
6   //  Authors:  Joerg K. Wegner
7   //  Version:  $Revision: 1.7 $
8   //            $Date: 2003/08/19 13:11:25 $
9   //            $Author: wegner $
10  //
11  //  Copyright (c) Dept. Computer Architecture, University of Tuebingen, Germany
12  //
13  //  This program is free software; you can redistribute it and/or modify
14  //  it under the terms of the GNU General Public License as published by
15  //  the Free Software Foundation version 2 of the License.
16  //
17  //  This program is distributed in the hope that it will be useful,
18  //  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  //  GNU General Public License for more details.
21  ///////////////////////////////////////////////////////////////////////////////
22  package joelib.desc.types;
23  
24  
25  /*==========================================================================*
26   * IMPORTS
27   *==========================================================================*/
28  import joelib.desc.DescDescription;
29  import joelib.desc.DescriptorHelper;
30  import joelib.desc.DescriptorInfo;
31  import joelib.desc.SimpleDynamicAtomProperty;
32  
33  import joelib.desc.result.DynamicArrayResult;
34  
35  import joelib.molecule.JOEAtom;
36  import joelib.molecule.JOEMol;
37  
38  import joelib.util.iterator.AtomIterator;
39  
40  import org.apache.log4j.Category;
41  
42  
43  /*==========================================================================*
44   * CLASS DECLARATION
45   *==========================================================================*/
46  
47  /**
48   * Electron affinity.
49   *
50   * @author     wegnerj
51   * @license GPL
52   * @cvsversion    $Revision: 1.7 $, $Date: 2003/08/19 13:11:25 $
53   */
54  public class ElectronAffinity extends SimpleDynamicAtomProperty
55  {
56      //~ Static fields/initializers /////////////////////////////////////////////
57  
58      /*-------------------------------------------------------------------------*
59       * public static member variables
60       *-------------------------------------------------------------------------*/
61  
62      /**
63       *  Obtain a suitable logger.
64       */
65      private static Category logger = Category.getInstance(
66              "joelib.desc.types.ElectronAffinity");
67      public static final String DESC_KEY = "Electron_affinity";
68  
69      //~ Constructors ///////////////////////////////////////////////////////////
70  
71      /*-------------------------------------------------------------------------*
72       * private variables
73       *-------------------------------------------------------------------------*/
74      /*-------------------------------------------------------------------------*
75       * constructor
76       *-------------------------------------------------------------------------*/
77  
78      /**
79       *  Constructor for the KierShape1 object
80       */
81      public ElectronAffinity()
82      {
83          if (logger.isDebugEnabled())
84          {
85              logger.debug("Initialize " + this.getClass().getName());
86          }
87  
88          descInfo = DescriptorHelper.generateDescInfo(DESC_KEY, this.getClass(),
89                  DescriptorInfo.TYPE_NO_COORDINATES, null,
90                  "joelib.desc.result.AtomDynamicResult");
91      }
92  
93      //~ Methods ////////////////////////////////////////////////////////////////
94  
95      /*-------------------------------------------------------------------------*
96       * public methods
97       *-------------------------------------------------------------------------*/
98      public Object getAtomPropertiesArray(JOEMol mol)
99      {
100         // get electron affinities for all atoms
101         JOEAtom atom;
102         AtomIterator ait = mol.atomIterator();
103         double[] eAffinity = (double[]) DynamicArrayResult.getNewArray(DynamicArrayResult.DOUBLE,
104                 mol.numAtoms());
105         int i = 0;
106 
107         while (ait.hasNext())
108         {
109             atom = ait.nextAtom();
110             eAffinity[i++] = atom.getElectronAffinity();
111         }
112 
113         return eAffinity;
114     }
115 }
116 ///////////////////////////////////////////////////////////////////////////////
117 //  END OF FILE.
118 ///////////////////////////////////////////////////////////////////////////////