From: <ha...@us...> - 2012-02-15 21:38:02
|
Revision: 16801 http://jmol.svn.sourceforge.net/jmol/?rev=16801&view=rev Author: hansonr Date: 2012-02-15 21:37:55 +0000 (Wed, 15 Feb 2012) Log Message: ----------- JCAMPDX reader: vibraionScale <ModelData id="1" type="XYZVIB" baseModel="acetophenone" vibrationScale=".1"> scales down actual vibrations to better level. Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/more/JcampdxReader.java trunk/Jmol/src/org/jmol/adapter/smarter/Atom.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/more/JcampdxReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/more/JcampdxReader.java 2012-02-15 21:22:55 UTC (rev 16800) +++ trunk/Jmol/src/org/jmol/adapter/readers/more/JcampdxReader.java 2012-02-15 21:37:55 UTC (rev 16801) @@ -31,6 +31,7 @@ import java.util.List; import org.jmol.adapter.readers.molxyz.MolReader; +import org.jmol.adapter.smarter.Atom; import org.jmol.adapter.smarter.AtomSetCollection; import org.jmol.adapter.smarter.AtomSetCollectionReader; import org.jmol.adapter.smarter.Bond; @@ -203,6 +204,7 @@ modelIdList += key; String baseModel = getAttribute(line, "baseModel"); String modelType = getAttribute(line, "type").toLowerCase(); + float vibScale = Parser.parseFloat(getAttribute(line, "vibrationScale")); if (modelType.equals("xyzvib")) modelType = "xyz"; else if (modelType.length() == 0) @@ -228,6 +230,12 @@ if (baseModel.length() != 0) setBonding(a, baseModel); } + if (!Float.isNaN(vibScale)) { + Logger.info("jdx applying vibrationScale of " + vibScale + " to " + a.getAtomCount() + " atoms"); + Atom[] atoms = a.getAtoms(); + for (int i = a.getAtomCount(); --i >= 0; ) + atoms[i].scaleVector(vibScale); + } Logger.info("jdx model=" + modelID + " type=" + a.getFileTypeName()); return a; } Modified: trunk/Jmol/src/org/jmol/adapter/smarter/Atom.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/smarter/Atom.java 2012-02-15 21:22:55 UTC (rev 16800) +++ trunk/Jmol/src/org/jmol/adapter/smarter/Atom.java 2012-02-15 21:37:55 UTC (rev 16801) @@ -288,4 +288,12 @@ return isValidElementSymbolNoCaseSecondChar(chFirst, chSecond); } + public void scaleVector(float vibScale) { + if (Float.isNaN(vectorX)) + return; + vectorX *= vibScale; + vectorY *= vibScale; + vectorZ *= vibScale; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |