Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/* $RCSfile$
* $Author: hansonr $
* $Date: 2007-03-30 11:40:16 -0500 (Fri, 30 Mar 2007) $
* $Revision: 7273 $
*
* Copyright (C) 2007 Miguel, Bob, Jmol Development
*
* Contact: [email protected]
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* The JVXL file format
* --------------------
*
* as of 3/29/07 this code is COMPLETELY untested. It was hacked out of the
* Jmol code, so there is probably more here than is needed.
*
*
*
* see http://www.stolaf.edu/academics/chemapps/jmol/docs/misc/JVXL-format.pdf
*
* The JVXL (Jmol VoXeL) format is a file format specifically designed
* to encode an isosurface or planar slice through a set of 3D scalar values
* in lieu of a that set. A JVXL file can contain coordinates, and in fact
* it must contain at least one coordinate, but additional coordinates are
* optional. The file can contain any finite number of encoded surfaces.
* However, the compression of 300-500:1 is based on the reduction of the
* data to a SINGLE surface.
*
*
* The original Marching Cubes code was written by Miguel Howard in 2005.
* The classes Parser, ArrayUtil, and TextFormat are condensed versions
* of the classes found in org.jmol.util.
*
* All code relating to JVXL format is copyrighted 2006/2007 and invented by
* Robert M. Hanson,
* Professor of Chemistry,
* St. Olaf College,
* 1520 St. Olaf Ave.
* Northfield, MN. 55057.
*
* Implementations of the JVXL format should reference
* "Robert M. Hanson, St. Olaf College" and the opensource Jmol project.
*
*
* implementing marching squares; see
* http://www.secam.ex.ac.uk/teaching/ug/studyres/COM3404/COM3404-2006-Lecture15.pdf
*
* lines through coordinates are identical to CUBE files
* after that, we have a line that starts with a negative number to indicate this
* is a JVXL file:
*
* line1: (int)-nSurfaces (int)edgeFractionBase (int)edgeFractionRange
* (nSurface lines): (float)cutoff (int)nBytesData (int)nBytesFractions
*
* definition1
* edgedata1
* fractions1
* colordata1
* ....
* definition2
* edgedata2
* fractions2
* colordata2
* ....
*
* definitions: a line with detail about what sort of compression follows
*
* edgedata: a list of the count of vertices ouside and inside the cutoff, whatever
* that may be, ordered by nested for loops for(x){for(y){for(z)}}}.
*
* nOutside nInside nOutside nInside...
*
* fractions: an ascii list of characters represting the fraction of distance each
* encountered surface point is along each voxel cube edge found to straddle the
* surface. The order written is dictated by the reader algorithm and is not trivial
* to describe. Each ascii character is constructed by taking a base character and
* adding onto it the fraction times a range. This gives a character that can be
* quoted EXCEPT for backslash, which MAY be substituted for by '!'. Jmol uses the
* range # - | (35 - 124), reserving ! and } for special meanings.
*
* colordata: same deal here, but with possibility of "double precision" using two bytes.
*
*
*
* THIS READER
* -----------
*
* This is a first attempt at a generic JVXL file reader and writer class.
* It is an extraction of Jmol org.jmol.viewer.Isosurface.Java and related pieces.
*
* The goal of the reader is to be able to read CUBE-like data and
* convert that data to JVXL file data.
*
*
*/
package org.jmol.jvxl.readers;
import javax.vecmath.AxisAngle4f;
import javax.vecmath.Matrix3f;
import javax.vecmath.Point3f;
import javax.vecmath.Point4f;
import javax.vecmath.Vector3f;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import org.jmol.atomdata.RadiusData;
import org.jmol.jvxl.data.VolumeData;
import org.jmol.util.ColorEncoder;
import org.jmol.util.ContactPair;
import org.jmol.util.Escape;
import org.jmol.util.Logger;
import org.jmol.viewer.JmolConstants;
public class Parameters {
public final static int STATE_UNINITIALIZED = 0;
public final static int STATE_INITIALIZED = 1;
public final static int STATE_DATA_READ = 2;
public final static int STATE_DATA_COLORED = 3;
int state = STATE_UNINITIALIZED;
public int testFlags = 0;
boolean logMessages = false;
boolean logCompression = false;
boolean logCube = false;
public boolean isSilent = false;
float assocCutoff = 0.3f; // fraction along the edge to use as a cutoff for averaging of normals
final static int NO_ANISOTROPY = 1 << 5;
final static int IS_SILENT = 1 << 6;
final public static int IS_SOLVENTTYPE = 1 << 7;
final static int HAS_MAXGRID = 1 << 8;
final static int IS_POINTMAPPABLE = 1 << 9;
final static int IS_SLABBABLE = 1 << 10;
public int dataType;
int surfaceType;
final static int SURFACE_NONE = 0;
//getSurface only:
final static int SURFACE_SPHERE = 1 | IS_SILENT;
final static int SURFACE_ELLIPSOID2 = 2 | IS_SILENT;
final static int SURFACE_ELLIPSOID3 = 3 | IS_SILENT;
final static int SURFACE_LOBE = 4 | IS_SILENT;
final static int SURFACE_LCAOCARTOON = 5 | IS_SILENT;
final static public int SURFACE_LONEPAIR = 6 | IS_SILENT;
final static public int SURFACE_RADICAL = 7 | IS_SILENT;
final static int SURFACE_FUNCTIONXY = 8;
final static int SURFACE_FUNCTIONXYZ = 9;
// getSurface or mapColor:
final static int SURFACE_SOLVENT = 11 | IS_SOLVENTTYPE | NO_ANISOTROPY | IS_SLABBABLE ;
final static int SURFACE_SASURFACE = 12 | IS_SOLVENTTYPE | NO_ANISOTROPY | IS_SLABBABLE;
final static int SURFACE_MOLECULARORBITAL = 13 | NO_ANISOTROPY | HAS_MAXGRID | IS_POINTMAPPABLE | IS_SLABBABLE;
final static int SURFACE_ATOMICORBITAL = 14 | HAS_MAXGRID | IS_SLABBABLE;
final static int SURFACE_MEP = 16 | NO_ANISOTROPY | HAS_MAXGRID | IS_SLABBABLE;
final static int SURFACE_MLP = 17 | NO_ANISOTROPY | HAS_MAXGRID | IS_SLABBABLE;
final static int SURFACE_MOLECULAR = 19 | IS_SOLVENTTYPE | NO_ANISOTROPY | IS_SLABBABLE;
final static int SURFACE_NCI = 20 | NO_ANISOTROPY | HAS_MAXGRID | IS_POINTMAPPABLE | IS_SLABBABLE;
final static int SURFACE_INTERSECT = 21 | NO_ANISOTROPY | HAS_MAXGRID | IS_SLABBABLE;
// mapColor only:
final static int SURFACE_NOMAP = 21 | IS_SOLVENTTYPE | NO_ANISOTROPY | IS_SLABBABLE;
final static int SURFACE_PROPERTY = 22 | IS_SOLVENTTYPE | NO_ANISOTROPY | IS_SLABBABLE;
void initialize() {
addHydrogens = false;
allowVolumeRender = true;
atomRadiusData = null;
atomIndex = -1;
blockCubeData = false; // Gaussian standard, but we allow for multiple surfaces one per data block
boundingBox = null;
bsExcluded = new BitSet[4];
bsIgnore = null;
bsSelected = null;
bsSolvent = null;
calculationType = "";
center = new Point3f(Float.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE);
colorBySign = colorByPhase = colorBySets = false;
colorDensity = false;
colorEncoder = null;
colorNeg = defaultColorNegative;
colorNegLCAO = defaultColorNegativeLCAO;
colorPos = defaultColorPositive;
colorPosLCAO = defaultColorPositiveLCAO;
colorRgb = Integer.MIN_VALUE;
colorSchemeTranslucent = false;
contactPair = null;
contourIncrements = null;
contoursDiscrete = null;
contourColixes = null;
contourFromZero = true;
cutoff = Float.MAX_VALUE;
cutoffAutomatic = true;
dataXYReversed = false;
distance = Float.MAX_VALUE;
doFullMolecular = false;
envelopeRadius = 10f;
fileIndex = 1;
readAllData = true;
fileName = "";
fullyLit = false;
func = null;
functionInfo = null;
iAddGridPoints = false;
insideOut = false;
intersection = null;
isAngstroms = false;
isBicolorMap = isCutoffAbsolute = isPositiveOnly = false;
isCavity = false;
isColorReversed = false;
isSquared = false;
isContoured = false;
isEccentric = isAnisotropic = false;
isPeriodic = false;
isSilent = false;
logCube = logCompression = false;
logMessages = Logger.debugging;
mappedDataMin = Float.MAX_VALUE;
mep_calcType = -1;
minSet = 0;
modelIndex = -1;
nContours = 0;
pocket = null;
propertyDistanceMax = Integer.MAX_VALUE;
propertySmoothing = false;
propertySmoothingPower = 4;
rangeDefined = false;
rangeAll = false;
rangeSelected = false;
resolution = Float.MAX_VALUE;
scale = Float.NaN;
scale3d = 0;
sigma = Float.NaN;
slabInfo = null;
solventExtendedAtomRadius = 0;
state = STATE_INITIALIZED;
testFlags = 0;
thePlane = null;
theProperty = null;
thisContour = -1;
title = null;
usePropertyForColorRange = true; // except for MEP and MLP
vertexSource = null;
volumeData = null;
}
String calculationType = "";
//solvent/molecular-related:
public RadiusData atomRadiusData;
boolean addHydrogens;
float solventRadius;
float solventExtendedAtomRadius;
boolean propertySmoothing;
int propertySmoothingPower = 4;
float envelopeRadius;
float cavityRadius;
boolean isCavity;
Boolean pocket; //three states: TRUE, FALSE, and NULL
int minSet;
public List