// $Id: Atom.java,v 1.5 2007/02/22 19:56:33 Sasha Buzko Exp $ // // Copyright (c) 2000-2002 San Diego Supercomputer Center (SDSC), // a facility operated jointly by the University of California, // San Diego (UCSD) and General Atomics, San Diego, California, USA. // // Users and possessors of this source code are hereby granted a // nonexclusive, royalty-free copyright and design patent license to // use this code in individual software. License is not granted for // commercial resale, in whole or in part, without prior written // permission from SDSC. This source is provided "AS IS" without express // or implied warranty of any kind. // // For further information, please see: http://mbt.sdsc.edu // // History: // $Log: Atom.java,v $ // Revision 1.5 2007/02/22 19:56:33 Sasha Buzko // *** empty log message *** // // Revision 1.4 2007/02/13 19:08:41 Sasha Buzko // *** empty log message *** // // Revision 1.3 2007/02/06 05:42:00 Sasha Buzko // *** empty log message *** // // Revision 1.2 2006/10/04 18:00:58 Sasha Buzko // *** empty log message *** // // Revision 1.1 2006/05/20 17:02:06 Sasha Buzko // Updated version // // Revision 1.2 2006/05/20 04:19:46 Sasha Buzko // *** empty log message *** // // Revision 1.1 2006/04/30 20:14:05 Sasha Buzko // New version of the app // // Revision 1.1 2006/04/15 19:42:28 Sasha Buzko // Initial commit // // Revision 1.6 2006/02/24 22:26:53 Administrator // *** empty log message *** // // Revision 1.5 2006/02/20 18:03:24 Administrator // *** empty log message *** // // Revision 1.4 2005/12/12 05:05:56 Administrator // *** empty log message *** // // Revision 1.3 2005/11/26 04:36:10 Administrator // *** empty log message *** // // Revision 1.2 2005/11/13 23:44:31 Administrator // *** empty log message *** // // Revision 1.1 2005/11/13 04:35:26 Administrator // *** empty log message *** // // Revision 1.5 2003/04/30 17:48:14 moreland // Added atom serial number field. // // Revision 1.4 2003/04/23 17:15:12 moreland // Removed StructureComponentID/scid and replaced it with a "structure" field // in the StructureComponent base class. // Changed "getType" method to "getStructureComponentType" to return dynamic // SC type (ie: class name). // // Revision 1.3 2003/04/03 18:11:19 moreland // Changed field name "type" to "element" due to naming and meaning conflict. // // Revision 1.2 2002/10/24 17:54:01 moreland // Provides implementation for the improved Structure API/implementation. // // Revision 1.1.1.1 2002/07/16 18:00:18 moreland // Imported sources // // Revision 1.0 2002/06/10 23:38:39 moreland // package edu.sdsc.mbt; import edu.sdsc.mbt.util.*; import edu.sdsc.mbt.viewables.*; /** * Implements a StructureComponent container for atom data. *

* See the "PROGRAMMING NOTE" section of the StructureComponent class. *

* @see edu.sdsc.mbt.StructureComponent * @see edu.sdsc.mbt.Structure * @see edu.sdsc.mbt.StructureComponentIterator *

* @author John L. Moreland */ public class Atom extends StructureComponent implements java.lang.Cloneable, java.io.Serializable { public static short SP3 = 0; public static short SP2 = 1; public static short SP = 2; // // Constructor // /** * Creates a new Atom object and initializes the StructureComponent * "structure" field. */ public Atom( ) { } // // StructureComponent methods // /** * Copy all of the field values from the parameter object into "this". */ public void copy( StructureComponent structureComponent ) { structure = structureComponent.getStructure(); Atom atom = (Atom) structureComponent; element = atom.element; name = atom.name; number = atom.number; // altLoc = atom.altLoc; compound = atom.compound; residue_id = atom.residue_id; coordinate[0] = atom.coordinate[0]; coordinate[1] = atom.coordinate[1]; coordinate[2] = atom.coordinate[2]; // occupancy = atom.occupancy; // bfactor = atom.bfactor; backbone = atom.backbone; } /** * Clone this object. */ public Object clone( ) throws CloneNotSupportedException { return super.clone( ); } /** * This method returns the fully qualified name of this class. *

* This name is used by the StructureComponentRegistry class to enable * dynamic registration and discovery of new StructureComponent * sub-classes/types. The name is also used to create a unique integer * indentifier for each type in order to make run-time type comparisons * fast. */ private static String className = null; public static String getClassName() { if ( className == null ) className = ((new Throwable()).getStackTrace())[0].getClassName(); return className; } /** * This method returns the fully qualified name of this class. */ public String getStructureComponentType( ) { return className; } // // Atom fields // /** * The element symbol. * For example, "C", "O", "N", "H", etc. */ // public String element; // _atom_site.type_symbol - removed: waste of memory public short element = 0; public String getElement(){ return PeriodicTable.getElementSymbol(element); } public void setElement(String symbol){ element = (short)PeriodicTable.getElementNumber(symbol); } // public int atomicNumber = 1; /** * The macromolecular ID (element name). * For example, "CA", "CB", "OG1", "N", etc. */ public String name; // _atom_site.label_atom_id /** * The atom serial number. */ public int number = -1; // _atom_site.id /** * Compound 3-letter code. * For example, "VAL", "THR", "ILE", etc. */ public String compound; // _atom_site.label_comp_id public short formalCharge = 0; /** * Chain/Asymetric unit ID. * For example, "A", "B", "C", etc. */ public String chain_id; // _atom_site.label_asym_id /** * Residue/Sequence ID. * Must be a positive integer. * For example, "10", "11", "13", etc. */ public int residue_id = -1; // _atom_site.label_seq_id public Residue residue; /** * The x,y,z coordinate in angstroms. * For example, (21.023, 30.128, 12.340). */ public double coordinate[] = { 0.0, 0.0, 0.0 }; // _atom_site.Cartn_x,y,z /** * The fraction (0.0-1.0) of the atom element. * For example, "1.0", "0.5", "0.58", etc. */ // public float occupancy = 0.0f; // _atom_site.occupancy /** * Temperature B-Factor. * For example, "17.12", "26.28", etc. */ // public float bfactor = 0.0f; // _atom_site.B_iso_or_equiv /** * Radius */ // public float radius = 0.0f; /** * Whether this atom is a part of the protein backbone */ public boolean backbone = false; /** * Alternate Location Identifier (single character) * should be specified when occupancy < 1. * For example, "", "A", "B", "C", etc. *

* @see #occupancy *

*/ // public String altLoc = null; // _atom_site.label_alt_id /** * Partial Charge (-1.0 - 3.0). * For example, "0.3", "1.1", etc. */ public float partialCharge = 0.0f; // _atom_site.??? /** * Atomic orbital hybridization state. Needed for molecular mechanics calculations */ public short hybridization = SP3; /** * Force field type indicates the kind of atom depending on the atoms it's bonded to */ public String forceFieldType; /** * Inidcates whether this atom is ionized, hence which radius should be used for rendering */ // public boolean ion = false; public short render = (short)StylesPreferences.renderingMode; public short quality = (short)StylesPreferences.startupRenderingQuality; public boolean visible = true; public boolean isVisible(){ return visible; } }