From: <ha...@us...> - 2010-02-19 14:33:31
|
Revision: 12411 http://jmol.svn.sourceforge.net/jmol/?rev=12411&view=rev Author: hansonr Date: 2010-02-19 14:33:22 +0000 (Fri, 19 Feb 2010) Log Message: ----------- preliminary CRYSTAL reader -- requires CRYSTAL:: prefix in LOAD command. -- still needs testing Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-19 05:35:31 UTC (rev 12410) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-19 14:33:22 UTC (rev 12411) @@ -31,62 +31,53 @@ import java.io.BufferedReader; /** - * + * * http://www.crystal.unito.it/ - * - * @author Pieremanuele Canepa, Room 104, FM Group - * School of Physical Sciences, Ingram Building, - * University of Kent, Canterbury, Kent, - * CT2 7NH - * United Kingdom - * + * + * @author Pieremanuele Canepa, Room 104, FM Group School of Physical Sciences, + * Ingram Building, University of Kent, Canterbury, Kent, CT2 7NH United + * Kingdom + * * @version 1.0 - * - * This version works and has been well tested on several structures! * - * TODO: Needs adaptation to be more modular and flexible - * + * This version works and has been well tested on several structures! + * + * TODO: Needs adaptation to be more modular and flexible + * */ public class CrystalReader extends AtomSetCollectionReader { - private String calculationType; - public void readAtomSetCollection(BufferedReader reader) { + private boolean isPrimitive = true; + private boolean isPolymer = false; + private boolean isSlab = false; - boolean isPeriodic = true; - boolean isFractional = true; + public void readAtomSetCollection(BufferedReader reader) { + this.reader = reader; + atomSetCollection = new AtomSetCollection("Crystal", this); - atomSetCollection = new AtomSetCollection("Crystal", this); + isPrimitive = (filter == null || filter.indexOf("conv") >= 0); + atomSetCollection.setAtomSetAuxiliaryInfo("unitCellType", (isPrimitive ? "primitive" : "conventional")); try { - this.reader = reader; - discardLinesUntilContains("* CRYSTAL"); - discardLinesUntilContains("EEEEEEEEEE"); - atomSetCollection.setCollectionName(readLine().trim()); - readLine(); - calculationType = readLine().trim(); - atomSetCollection.setAtomSetAuxiliaryInfo("calculationType", calculationType); - if (calculationType.indexOf("MOLECULAR") >= 0) { - isFractional = false; - isPeriodic = false; - } + setFractionalCoordinates(readHeader()); while (readLine() != null) { - if (line.startsWith(" SPACE GROUP ") || line.startsWith(" CORRESPONDING SPACE GROUP")) { - readSpaceGroup(); + if (line.startsWith(" LATTICE PARAMETER") && + (isPrimitive && line.contains("- PRIMITIVE") || !isPrimitive && line.contains("- CONVENTIONAL"))) { + readCellParams(); continue; } - if (line.startsWith(" LATTICE PARAMETERS (ANGSTROMS AND DEGREES) - CONVENTIONAL CELL")) { - isFractional = true; - readCellParams(); - continue; + if (isPrimitive) { + if (line + .startsWith(" COORDINATES OF THE EQUIVALENT ATOMS")) { + readFractionalCoords(); + continue; + } + } else { + if (line.startsWith(" INPUT COORDINATES")) { + readInputCoords(); + continue; + } } - if (line.startsWith(" LATTICE PARAMETER (ANGSTROMS) - CONVENTIONAL CELL")) { - isFractional = true; - readPolymerCell(); - } - if (line.startsWith(" INPUT COORDINATES")) { - readAtomCoords(isFractional, isPeriodic); - continue; - } } applySymmetryAndSetTrajectory(); @@ -95,6 +86,26 @@ } } + private boolean readHeader() throws Exception { + discardLinesUntilContains("* CRYSTAL"); + discardLinesUntilContains("EEEEEEEEEE"); + atomSetCollection.setCollectionName(readLine().trim()); + readLine(); + calculationType = readLine().trim(); + isPolymer = (calculationType.equals("POLYMER CALCULATION")); + isSlab = (calculationType.equals("SLAB CALCULATION")); + atomSetCollection.setAtomSetAuxiliaryInfo("calculationType", + calculationType); + if (calculationType.indexOf("MOLECULAR") >= 0) + return false; + if (!isPrimitive) { + readLine(); + readLine(); + readSpaceGroup(); + } + return true; + } + private void readSpaceGroup() { // SPACE GROUP (CENTROSYMMETRIC) : F M 3 M String name = line.substring(line.indexOf(":") + 1).trim(); @@ -102,35 +113,61 @@ } private void readCellParams() throws Exception { + if (isPolymer) { + float a = parseFloat(line.substring(line.indexOf("CELL") + 4)); + setUnitCell(a, 1, 1, 90, 90, 90); + return; + } readLine(); String[] tokens = getTokens(readLine()); - if (calculationType.equals("SLAB CALCULATION")) { - setUnitCell(parseFloat(tokens[0]), parseFloat(tokens[1]), 1, 90, 90, - parseFloat(tokens[2])); + if (isSlab) { + setUnitCell(parseFloat(tokens[0]), parseFloat(tokens[1]), 1, + parseFloat(tokens[3]), parseFloat(tokens[4]), parseFloat(tokens[5])); } else { - setUnitCell(parseFloat(tokens[0]), parseFloat(tokens[1]), - parseFloat(tokens[2]), parseFloat(tokens[3]), parseFloat(tokens[4]), - parseFloat(tokens[5])); + setUnitCell(parseFloat(tokens[0]), parseFloat(tokens[1]), parseFloat(tokens[2]), + parseFloat(tokens[3]), parseFloat(tokens[4]), parseFloat(tokens[5])); } } - private void readPolymerCell() { - float a = parseFloat(line.substring(line.indexOf("CELL") + 4)); - setUnitCell(a, 1, 1, 90, 90, 90); - - } + /* + COORDINATES OF THE EQUIVALENT ATOMS + (X AND Y IN FRACTIONARY UNITS, Z IN ANGSTROMS) + N. ATOM EQUIV AT. N. X Y Z - /* - INPUT COORDINATES + 1 1 1 26 FE 3.33130643604E-01 1.66339516481E-01 6.03501134235E+00 + */ + private void readFractionalCoords() throws Exception { + discardLinesUntilContains("ATOM EQUIV"); + while (readLine() != null && line.indexOf("NUMBER OF SYMM") < 0) { + if (line.length() == 0) + continue; + Atom atom = atomSetCollection.addNewAtom(); + String[] tokens = getTokens(); + int atomicNumber = parseInt(tokens[3]); + float x = parseFloat(tokens[5]); + float y = parseFloat(tokens[6]); + float z = parseFloat(tokens[7]); + if (isPolymer || isSlab) { + if (x < 0) + x += 1; + if (y < 0) + y += 1; + } + setAtomCoord(atom, x, y, z); + atom.elementSymbol = getElementSymbol(atomicNumber); + } + } - ATOM AT. N. COORDINATES - 1 12 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 - 2 8 5.000000000000E-01 5.000000000000E-01 5.000000000000E-01 - */ - private void readAtomCoords(boolean isFractional, boolean isthisPeriodic) + /* + * INPUT COORDINATES + * + * ATOM AT. N. COORDINATES + * 1 12 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 + * 2 8 5.000000000000E-01 5.000000000000E-01 5.000000000000E-01 + */ + private void readInputCoords() throws Exception { - setFractionalCoordinates(isFractional); readLine(); readLine(); while (readLine() != null && line.length() > 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-19 15:20:11
|
Revision: 12414 http://jmol.svn.sourceforge.net/jmol/?rev=12414&view=rev Author: hansonr Date: 2010-02-19 15:19:56 +0000 (Fri, 19 Feb 2010) Log Message: ----------- preliminary CRYSTAL reader - still needs testing Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-19 14:41:15 UTC (rev 12413) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-19 15:19:56 UTC (rev 12414) @@ -63,7 +63,7 @@ while (readLine() != null) { if (line.startsWith(" LATTICE PARAMETER") && (isPrimitive && line.contains("- PRIMITIVE") || !isPrimitive && line.contains("- CONVENTIONAL"))) { - readCellParams(); + readCellParams(); continue; } if (isPrimitive) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-19 15:27:10
|
Revision: 12416 http://jmol.svn.sourceforge.net/jmol/?rev=12416&view=rev Author: hansonr Date: 2010-02-19 15:26:27 +0000 (Fri, 19 Feb 2010) Log Message: ----------- preliminary CRYSTAL reader - still needs testing Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-19 15:20:37 UTC (rev 12415) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-19 15:26:27 UTC (rev 12416) @@ -68,7 +68,7 @@ } if (isPrimitive) { if (line - .startsWith(" COORDINATES OF THE EQUIVALENT ATOMS")) { + .startsWith(" ATOMS IN THE ASYMMETRIC UNIT")) { readFractionalCoords(); continue; } @@ -130,24 +130,22 @@ } /* - COORDINATES OF THE EQUIVALENT ATOMS - (X AND Y IN FRACTIONARY UNITS, Z IN ANGSTROMS) - - N. ATOM EQUIV AT. N. X Y Z - - 1 1 1 26 FE 3.33130643604E-01 1.66339516481E-01 6.03501134235E+00 - */ +ATOMS IN THE ASYMMETRIC UNIT 30 - ATOMS IN THE UNIT CELL: 30 + ATOM X/A Y/B Z(ANGSTROM) + ******************************************************************************* + 1 T 26 FE 3.331306436039E-01 1.663395164811E-01 6.035011342353E+00 + 2 T 8 O -3.291645441100E-01 1.554613095970E-01 5.654299584852E+00 + */ private void readFractionalCoords() throws Exception { - discardLinesUntilContains("ATOM EQUIV"); - while (readLine() != null && line.indexOf("NUMBER OF SYMM") < 0) { - if (line.length() == 0) - continue; + readLine(); + readLine(); + while (readLine() != null && line.length() > 0) { Atom atom = atomSetCollection.addNewAtom(); String[] tokens = getTokens(); - int atomicNumber = parseInt(tokens[3]); - float x = parseFloat(tokens[5]); - float y = parseFloat(tokens[6]); - float z = parseFloat(tokens[7]); + int atomicNumber = parseInt(tokens[2]); + float x = parseFloat(tokens[4]); + float y = parseFloat(tokens[5]); + float z = parseFloat(tokens[6]); if (isPolymer || isSlab) { if (x < 0) x += 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-19 15:28:45
|
Revision: 12417 http://jmol.svn.sourceforge.net/jmol/?rev=12417&view=rev Author: hansonr Date: 2010-02-19 15:28:20 +0000 (Fri, 19 Feb 2010) Log Message: ----------- preliminary CRYSTAL reader - still needs testing Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-19 15:26:27 UTC (rev 12416) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-19 15:28:20 UTC (rev 12417) @@ -147,6 +147,7 @@ float y = parseFloat(tokens[5]); float z = parseFloat(tokens[6]); if (isPolymer || isSlab) { + // because with these we cannot use the "packed" keyword if (x < 0) x += 1; if (y < 0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-19 15:42:03
|
Revision: 12418 http://jmol.svn.sourceforge.net/jmol/?rev=12418&view=rev Author: hansonr Date: 2010-02-19 15:41:51 +0000 (Fri, 19 Feb 2010) Log Message: ----------- preliminary CRYSTAL reader - still needs testing Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-19 15:28:20 UTC (rev 12417) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-19 15:41:51 UTC (rev 12418) @@ -113,7 +113,7 @@ } private void readCellParams() throws Exception { - if (isPolymer) { + if (isPolymer && !isPrimitive) { float a = parseFloat(line.substring(line.indexOf("CELL") + 4)); setUnitCell(a, 1, 1, 90, 90, 90); return; @@ -123,6 +123,9 @@ if (isSlab) { setUnitCell(parseFloat(tokens[0]), parseFloat(tokens[1]), 1, parseFloat(tokens[3]), parseFloat(tokens[4]), parseFloat(tokens[5])); + } else if (isPolymer) { + setUnitCell(parseFloat(tokens[0]), 1, 1, + parseFloat(tokens[3]), parseFloat(tokens[4]), parseFloat(tokens[5])); } else { setUnitCell(parseFloat(tokens[0]), parseFloat(tokens[1]), parseFloat(tokens[2]), parseFloat(tokens[3]), parseFloat(tokens[4]), parseFloat(tokens[5])); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-19 16:10:51
|
Revision: 12419 http://jmol.svn.sourceforge.net/jmol/?rev=12419&view=rev Author: hansonr Date: 2010-02-19 16:10:44 +0000 (Fri, 19 Feb 2010) Log Message: ----------- polymer correction Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-19 15:41:51 UTC (rev 12418) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-19 16:10:44 UTC (rev 12419) @@ -133,12 +133,13 @@ } /* -ATOMS IN THE ASYMMETRIC UNIT 30 - ATOMS IN THE UNIT CELL: 30 - ATOM X/A Y/B Z(ANGSTROM) - ******************************************************************************* - 1 T 26 FE 3.331306436039E-01 1.663395164811E-01 6.035011342353E+00 - 2 T 8 O -3.291645441100E-01 1.554613095970E-01 5.654299584852E+00 - */ + * ATOMS IN THE ASYMMETRIC UNIT 30 - ATOMS IN THE UNIT CELL: 30 ATOM X/A Y/B + * Z(ANGSTROM) + * ***************************************************************** + * ************* 1 T 26 FE 3.331306436039E-01 1.663395164811E-01 + * 6.035011342353E+00 2 T 8 O -3.291645441100E-01 1.554613095970E-01 + * 5.654299584852E+00 + */ private void readFractionalCoords() throws Exception { readLine(); readLine(); @@ -149,13 +150,11 @@ float x = parseFloat(tokens[4]); float y = parseFloat(tokens[5]); float z = parseFloat(tokens[6]); - if (isPolymer || isSlab) { - // because with these we cannot use the "packed" keyword - if (x < 0) - x += 1; - if (y < 0) - y += 1; - } + // because with these we cannot use the "packed" keyword + if ((isPolymer || isSlab) && x < 0) + x += 1; + if (isSlab && y < 0) + y += 1; setAtomCoord(atom, x, y, z); atom.elementSymbol = getElementSymbol(atomicNumber); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-19 16:48:56
|
Revision: 12421 http://jmol.svn.sourceforge.net/jmol/?rev=12421&view=rev Author: hansonr Date: 2010-02-19 16:48:50 +0000 (Fri, 19 Feb 2010) Log Message: ----------- slab correction Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-19 16:42:28 UTC (rev 12420) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-19 16:48:50 UTC (rev 12421) @@ -121,8 +121,12 @@ readLine(); String[] tokens = getTokens(readLine()); if (isSlab) { - setUnitCell(parseFloat(tokens[0]), parseFloat(tokens[1]), -1, - parseFloat(tokens[3]), parseFloat(tokens[4]), parseFloat(tokens[5])); + if (isPrimitive) + setUnitCell(parseFloat(tokens[0]), parseFloat(tokens[1]), -1, + parseFloat(tokens[3]), parseFloat(tokens[4]), parseFloat(tokens[5])); + else + setUnitCell(parseFloat(tokens[0]), parseFloat(tokens[1]), -1, + 90, 90, parseFloat(tokens[2])); } else if (isPolymer) { setUnitCell(parseFloat(tokens[0]), -1, -1, parseFloat(tokens[3]), parseFloat(tokens[4]), parseFloat(tokens[5])); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-19 17:08:10
|
Revision: 12422 http://jmol.svn.sourceforge.net/jmol/?rev=12422&view=rev Author: hansonr Date: 2010-02-19 17:08:04 +0000 (Fri, 19 Feb 2010) Log Message: ----------- preliminary CRYSTAL reader - still needs testing -- opt filter optino Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-19 16:48:50 UTC (rev 12421) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-19 17:08:04 UTC (rev 12422) @@ -40,10 +40,17 @@ * * @version 1.0 * - * This version works and has been well tested on several structures! * - * TODO: Needs adaptation to be more modular and flexible + * for final optimized geometry use * + * load "xxx.out" filter "optimized" + * + * for conventional unit cell, use + * + * load "xxx.out" filter "conventional" + * + * TODO: vibrational frequencies + * */ public class CrystalReader extends AtomSetCollectionReader { @@ -56,13 +63,21 @@ this.reader = reader; atomSetCollection = new AtomSetCollection("Crystal", this); - isPrimitive = (filter == null || filter.indexOf("conv") >= 0); + isPrimitive = (filter == null || filter.indexOf("conv") < 0); atomSetCollection.setAtomSetAuxiliaryInfo("unitCellType", (isPrimitive ? "primitive" : "conventional")); + boolean isFinal = (filter != null && filter.indexOf("opt") >= 0); try { setFractionalCoordinates(readHeader()); + if (isFinal) { + discardLinesUntilContains("FINAL OPTIMIZED GEOMETRY"); + atomSetCollection.setCollectionName(name + " (optimized)"); + isPrimitive = true; + } while (readLine() != null) { if (line.startsWith(" LATTICE PARAMETER") && - (isPrimitive && line.contains("- PRIMITIVE") || !isPrimitive && line.contains("- CONVENTIONAL"))) { + (isFinal || isPrimitive && line.contains("- PRIMITIVE") || !isPrimitive && line.contains("- CONVENTIONAL"))) { + if (isFinal) + readLine(); readCellParams(); continue; } @@ -86,10 +101,11 @@ } } + private String name; private boolean readHeader() throws Exception { discardLinesUntilContains("* CRYSTAL"); discardLinesUntilContains("EEEEEEEEEE"); - atomSetCollection.setCollectionName(readLine().trim()); + atomSetCollection.setCollectionName(name = readLine().trim()); readLine(); calculationType = readLine().trim(); isPolymer = (calculationType.equals("POLYMER CALCULATION")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-21 22:40:17
|
Revision: 12431 http://jmol.svn.sourceforge.net/jmol/?rev=12431&view=rev Author: hansonr Date: 2010-02-21 22:40:09 +0000 (Sun, 21 Feb 2010) Log Message: ----------- Crystal reader -- removing implicit input coordinate normalization Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-21 22:04:17 UTC (rev 12430) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-21 22:40:09 UTC (rev 12431) @@ -237,12 +237,19 @@ float x = parseFloat(tokens[2]); float y = parseFloat(tokens[3]); float z = parseFloat(tokens[4]); + /* we do not do this, because we have other ways to do it + * namely, "packed" or "{555 555 1}" + * In this way, we can check those input coordinates exactly + if (x < 0) x += 1; if (y < 0) y += 1; - if (z < 0 ) + if (z < 0) z += 1; + + */ + setAtomCoord(atom, x, y, z); atom.elementSymbol = getElementSymbol(atomicNumber); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-22 00:02:26
|
Revision: 12435 http://jmol.svn.sourceforge.net/jmol/?rev=12435&view=rev Author: hansonr Date: 2010-02-22 00:02:20 +0000 (Mon, 22 Feb 2010) Log Message: ----------- version=11.9.30_dev # new feature: load "filename" 0 -- loads LAST model only (usually the optimized geometry) Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-22 00:01:33 UTC (rev 12434) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-22 00:02:20 UTC (rev 12435) @@ -44,10 +44,15 @@ * * @version 1.2 * + * for a specific model in the set, use * + * load "xxx.out" n + * + * where n is an integer > 0 + * * for final optimized geometry use * - * load "xxx.out" filter "optimized" + * load "xxx.out" 0 * * for conventional unit cell, use * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-22 00:02:48
|
Revision: 12436 http://jmol.svn.sourceforge.net/jmol/?rev=12436&view=rev Author: hansonr Date: 2010-02-22 00:02:42 +0000 (Mon, 22 Feb 2010) Log Message: ----------- version=11.9.30_dev # new feature: load "filename" 0 -- loads LAST model only (usually the optimized geometry) Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-22 00:02:20 UTC (rev 12435) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-22 00:02:42 UTC (rev 12436) @@ -54,7 +54,7 @@ * * load "xxx.out" 0 * - * for conventional unit cell, use + * for conventional unit cell -- input coordinates only, use * * load "xxx.out" filter "conventional" * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-22 00:06:18
|
Revision: 12437 http://jmol.svn.sourceforge.net/jmol/?rev=12437&view=rev Author: hansonr Date: 2010-02-22 00:06:12 +0000 (Mon, 22 Feb 2010) Log Message: ----------- version=11.9.30_dev # new feature: load "filename" 0 -- loads LAST model only (usually the optimized geometry) Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-22 00:02:42 UTC (rev 12436) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-22 00:06:12 UTC (rev 12437) @@ -85,8 +85,8 @@ protected boolean checkLine() throws Exception { if (line.startsWith(" LATTICE PARAMETER") && (isPrimitive - && (line.contains("- PRIMITIVE") || line.contains("- BOHR")) - || !isPrimitive && line.contains("- CONVENTIONAL"))) { + && (line.contains("- PRIMITIVE") || line.contains("- BOHR")) || !isPrimitive + && line.contains("- CONVENTIONAL"))) { if (!isPrimitive || doGetModel(++modelNumber)) { readCellParams(); doReadAtoms = true; @@ -101,15 +101,8 @@ } if (!doReadAtoms) return true; - if (isPrimitive && line.startsWith(" ATOMS IN THE ASYMMETRIC UNIT") - || !isPrimitive && line.startsWith(" INPUT COORDINATES")) { - if (isPrimitive) { - readFractionalCoords(); - if (isLastModel(modelNumber)) { - continuing = false; - return false; - } - } else { + if (!isPrimitive) { + if (line.startsWith(" INPUT COORDINATES")) { readInputCoords(); continuing = false; // because if we are reading the conventional cell, @@ -117,6 +110,13 @@ } return true; } + // from here on -- must be primitive + if (line.startsWith(" ATOMS IN THE ASYMMETRIC UNIT")) { + readFractionalCoords(); + if (isLastModel(modelNumber)) + continuing = false; + return true; + } if (line.indexOf(" LOCAL ATOMIC FUNCTIONS BASIS SET") >= 0) { // readBasisSet(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-22 00:09:16
|
Revision: 12438 http://jmol.svn.sourceforge.net/jmol/?rev=12438&view=rev Author: hansonr Date: 2010-02-22 00:09:10 +0000 (Mon, 22 Feb 2010) Log Message: ----------- version=11.9.30_dev # new feature: load "filename" 0 -- loads LAST model only (usually the optimized geometry) Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-22 00:06:12 UTC (rev 12437) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-22 00:09:10 UTC (rev 12438) @@ -83,6 +83,9 @@ } protected boolean checkLine() throws Exception { + // starting point for any calculation is the definition of the lattice + // parameters + // similar to the "data" statement of a CIF file if (line.startsWith(" LATTICE PARAMETER") && (isPrimitive && (line.contains("- PRIMITIVE") || line.contains("- BOHR")) || !isPrimitive @@ -95,10 +98,6 @@ } return true; } - if (line.startsWith(" TYPE OF CALCULATION")) { - calculationType = line.substring(line.indexOf(":") + 1).trim(); - return true; - } if (!doReadAtoms) return true; if (!isPrimitive) { @@ -118,14 +117,23 @@ return true; } + // Note that these following won't be read if we are opting to get a + // specific model. + + if (line.startsWith(" TYPE OF CALCULATION")) { + calculationType = line.substring(line.indexOf(":") + 1).trim(); + return true; + } if (line.indexOf(" LOCAL ATOMIC FUNCTIONS BASIS SET") >= 0) { // readBasisSet(); return true; } if (line.indexOf("A.O. POPULATION") >= 0) { + // no, that's not right.... // readMolecularOrbitals(); return true; } + if (line.startsWith(" * OPT END - CONVERGED")) { setEnergy(parseFloat(line.substring(line.indexOf(":") + 1)), true); return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-23 15:58:11
|
Revision: 12460 http://jmol.svn.sourceforge.net/jmol/?rev=12460&view=rev Author: hansonr Date: 2010-02-23 15:58:04 +0000 (Tue, 23 Feb 2010) Log Message: ----------- Crystal reader upgrades -- partial charges Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-23 15:29:00 UTC (rev 12459) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-23 15:58:04 UTC (rev 12460) @@ -70,6 +70,7 @@ private boolean isSlab = false; private boolean isMolecular = false; private boolean doReadAtoms = false; + private boolean haveCharges = false; public void readAtomSetCollection(BufferedReader reader) { readAtomSetCollection(reader, "Crystal"); @@ -131,6 +132,12 @@ calculationType = line.substring(line.indexOf(":") + 1).trim(); return true; } + + if (line.startsWith(" MULLIKEN POPULATION ANALYSIS")) { + readPartialCharges(); + return true; + } + return true; } @@ -288,4 +295,23 @@ atomSetCollection.setAtomSetName("Energy = " + energy + " Hartree"); } + /* + * MULLIKEN POPULATION ANALYSIS - NO. OF ELECTRONS 152.000000 + * + * ATOM Z CHARGE A.O. POPULATION + * + * 1 FE 26 23.991 2.000 1.920 2.057 2.057 2.057 0.384 0.674 0.674 + */ + private void readPartialCharges() throws Exception { + if (haveCharges) + return; + haveCharges = true; + discardLines(3); + Atom[] atoms = atomSetCollection.getAtoms(); + int i = atomSetCollection.getLastAtomSetAtomIndex(); + while (readLine() != null && line.length() > 3) + if (line.charAt(3) != ' ') + atoms[i++].partialCharge = parseFloat(line.substring(9, 11)) + - parseFloat(line.substring(12, 18)); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-23 19:20:52
|
Revision: 12461 http://jmol.svn.sourceforge.net/jmol/?rev=12461&view=rev Author: hansonr Date: 2010-02-23 19:20:46 +0000 (Tue, 23 Feb 2010) Log Message: ----------- crystal reader -- better readEnergy Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-23 15:58:04 UTC (rev 12460) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-23 19:20:46 UTC (rev 12461) @@ -122,8 +122,7 @@ readFractionalCoords(); return true; } - if (line.startsWith(" * OPT END - CONVERGED") - || line.startsWith("== SCF ENDED") || line.startsWith(" TOTAL ENERGY")) { + if (line.startsWith(" TOTAL ENERGY")) { readEnergy(); return true; } @@ -285,13 +284,10 @@ } private void readEnergy() { - boolean isGlobal = (line.startsWith(" * OPT END")); - String[] tokens = getTokens(line.substring(line.lastIndexOf(isGlobal ? ":" - : ")") + 1)); + String[] tokens = getTokens(line.substring(line.lastIndexOf(")") + 1)); Double energy = new Double(Double.parseDouble(tokens[0])); atomSetCollection.setAtomSetAuxiliaryInfo("Energy", energy); - if (isGlobal) - atomSetCollection.setAtomSetCollectionAuxiliaryInfo("Energy", energy); + atomSetCollection.setAtomSetCollectionAuxiliaryInfo("Energy", energy); atomSetCollection.setAtomSetName("Energy = " + energy + " Hartree"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-24 04:02:41
|
Revision: 12462 http://jmol.svn.sourceforge.net/jmol/?rev=12462&view=rev Author: hansonr Date: 2010-02-24 04:02:34 +0000 (Wed, 24 Feb 2010) Log Message: ----------- crystal reader - Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-23 19:20:46 UTC (rev 12461) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-24 04:02:34 UTC (rev 12462) @@ -80,7 +80,7 @@ throws Exception { super.initializeReader(reader, type); isPrimitive = (filter == null || filter.indexOf("conv") < 0); - atomSetCollection.setAtomSetAuxiliaryInfo("unitCellType", + atomSetCollection.setAtomSetCollectionAuxiliaryInfo("unitCellType", (isPrimitive ? "primitive" : "conventional")); setFractionalCoordinates(readHeader()); } @@ -151,7 +151,7 @@ * This is when the initial geometry is read from an external file GEOMETRY * INPUT FROM EXTERNAL FILE (FORTRAN UNIT 34) */ - if (type.equals("GEOMETRY INPUT FROM EXTERNAL FILE (FORTRAN UNIT 34)")) { + if (type.indexOf("EXTERNAL FILE") >= 0) { type = readLine().trim(); isPolymer = (type.equals("1D - POLYMER")); isSlab = (type.equals("2D - SLAB")); @@ -159,10 +159,14 @@ isPolymer = (type.equals("POLYMER CALCULATION")); isSlab = (type.equals("SLAB CALCULATION")); } - atomSetCollection.setAtomSetAuxiliaryInfo("symmetryType", type); + atomSetCollection.setAtomSetCollectionAuxiliaryInfo("symmetryType", type); if (type.indexOf("MOLECULAR") >= 0) { isMolecular = doReadAtoms = true; + readLine(); + atomSetCollection.setAtomSetCollectionAuxiliaryInfo( + "molecularCalculationPointGroup", line.substring( + line.indexOf(" OR ") + 4).trim()); return false; } if (!isPrimitive) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-24 04:07:29
|
Revision: 12463 http://jmol.svn.sourceforge.net/jmol/?rev=12463&view=rev Author: hansonr Date: 2010-02-24 04:07:21 +0000 (Wed, 24 Feb 2010) Log Message: ----------- Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-24 04:02:34 UTC (rev 12462) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-24 04:07:21 UTC (rev 12463) @@ -5,7 +5,7 @@ * * Contact: jmo...@li... * - * Copyright (C) 2009 Piero Canepa, University of Kent , UK + * Copyright (C) 2009 Piero Canepa, University of Kent, UK * * Contact: pc...@ke... or pie...@gm... * @@ -27,19 +27,16 @@ package org.jmol.adapter.readers.xtal; -import org.jmol.adapter.smarter.*; //import org.jmol.api.JmolAdapter; - +import org.jmol.adapter.smarter.*; import java.io.BufferedReader; -//import java.util.Vector; - /** - * + * * http://www.crystal.unito.it/ - * + * * @author Pieremanuele Canepa, Room 104, FM Group School of Physical Sciences, * Ingram Building, University of Kent, Canterbury, Kent, CT2 7NH United - * Kingdom + * Kingdom, pc...@ke... * * @version 1.3 * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-24 04:18:22
|
Revision: 12464 http://jmol.svn.sourceforge.net/jmol/?rev=12464&view=rev Author: hansonr Date: 2010-02-24 04:18:15 +0000 (Wed, 24 Feb 2010) Log Message: ----------- Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-24 04:07:21 UTC (rev 12463) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-24 04:18:15 UTC (rev 12464) @@ -199,6 +199,7 @@ } } + int atomIndexLast; /* * ATOMS IN THE ASYMMETRIC UNIT 30 - ATOMS IN THE UNIT CELL: 30 * ATOM X/A Y/B Z(ANGSTROM) @@ -211,6 +212,8 @@ newAtomSet(); readLine(); readLine(); + int i = atomIndexLast; + atomIndexLast = atomSetCollection.getAtomCount(); boolean doNormalizePrimitive = isPrimitive && !isMolecular && !isPolymer && !isSlab; while (readLine() != null && line.length() > 0) { Atom atom = atomSetCollection.addNewAtom(); @@ -219,6 +222,8 @@ float x = parseFloat(tokens[4]); float y = parseFloat(tokens[5]); float z = parseFloat(tokens[6]); + if (haveCharges) + atom.partialCharge = atomSetCollection.getAtom(i++).partialCharge; // because with these we cannot use the "packed" keyword if (x < 0 && (isPolymer || isSlab || doNormalizePrimitive)) x += 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-25 03:10:41
|
Revision: 12473 http://jmol.svn.sourceforge.net/jmol/?rev=12473&view=rev Author: hansonr Date: 2010-02-25 03:10:33 +0000 (Thu, 25 Feb 2010) Log Message: ----------- crystal reader - Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-25 02:48:33 UTC (rev 12472) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-25 03:10:33 UTC (rev 12473) @@ -123,6 +123,11 @@ } if (line.startsWith(" TOTAL ENERGY")) { readEnergy(); + readLine(); + if (line.startsWith(" ********")) + discardLinesUntilContains("SYMMETRY ALLOWED"); + if (line.startsWith(" TTTTTTTT")) + discardLinesUntilContains("PREDICTED ENERGY CHANGE"); return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-25 14:01:38
|
Revision: 12474 http://jmol.svn.sourceforge.net/jmol/?rev=12474&view=rev Author: hansonr Date: 2010-02-25 13:53:38 +0000 (Thu, 25 Feb 2010) Log Message: ----------- crystal reader - Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-25 03:10:33 UTC (rev 12473) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-25 13:53:38 UTC (rev 12474) @@ -232,6 +232,7 @@ Atom atom = atomSetCollection.addNewAtom(); String[] tokens = getTokens(); int atomicNumber = getAtomicNumber(tokens[2]); + atom.atomName = getAtomName(tokens[3]); float x = parseFloat(tokens[4]); float y = parseFloat(tokens[5]); float z = parseFloat(tokens[6]); @@ -249,6 +250,13 @@ } } + private String getAtomName(String s) { + String atomName = s; + if (atomName.length() > 1 && Character.isLetter(atomName.charAt(1))) + atomName = atomName.substring(0, 1) + Character.toLowerCase(atomName.charAt(1)) + atomName.substring(2); + return atomName; + } + /* * Crystal adds 100 to the atomic number when the same atom will be * described with different basis sets. It also adds 200 when ECP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-25 21:00:29
|
Revision: 12480 http://jmol.svn.sourceforge.net/jmol/?rev=12480&view=rev Author: hansonr Date: 2010-02-25 21:00:22 +0000 (Thu, 25 Feb 2010) Log Message: ----------- crystal reader - Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-25 19:21:04 UTC (rev 12479) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-25 21:00:22 UTC (rev 12480) @@ -32,6 +32,7 @@ import org.jmol.util.TextFormat; import java.io.BufferedReader; +import java.util.Vector; /** * @@ -71,6 +72,7 @@ private boolean isMolecular = false; private boolean doReadAtoms = false; private boolean haveCharges = false; + private boolean addVibrations = false; public void readAtomSetCollection(BufferedReader reader) { readAtomSetCollection(reader, "Crystal"); @@ -80,6 +82,7 @@ throws Exception { super.initializeReader(reader, type); isPrimitive = (filter == null || filter.indexOf("conv") < 0); + addVibrations = !doApplySymmetry;// && (filter != null && filter.indexOf("vib") >= 0); atomSetCollection.setAtomSetCollectionAuxiliaryInfo("unitCellType", (isPrimitive ? "primitive" : "conventional")); setFractionalCoordinates(readHeader()); @@ -142,7 +145,7 @@ return true; } - if (line.startsWith(" NORMAL MODES NORMALIZED TO CLASSICAL AMPLITUDES")) { + if (addVibrations && line.contains("MODES EIGV")) { readFrequencies(); return true; } @@ -352,6 +355,17 @@ private void readFrequencies() throws Exception { readLine(); + Vector vData = new Vector(); + while (readLine() != null && line.length() > 0) { + int i0 = parseInt(line.substring(1, 5)); + int i1 = parseInt(line.substring(6, 10)); + String irrep = line.substring(49, 52).trim(); + String intens = line.substring(59, 69); + String[] data = new String[] { irrep, intens }; + for (int i = i0; i <= i1; i++) + vData.add(data); + } + discardLines(2); while (readLine() != null && line.startsWith(" FREQ(CM**-1)")) { int frequencyCount = 0; String[] tokens = getTokens(line.substring(15)); @@ -364,25 +378,27 @@ Logger.debug((vibrationNumber + 1) + " frequency=" + frequency); } } + int iAtom0 = atomSetCollection.getAtomCount(); int atomCount = atomSetCollection.getLastAtomSetAtomCount(); - int iAtom0 = atomSetCollection.getAtomCount() - atomCount; boolean[] ignore = new boolean[frequencyCount]; for (int i = 0; i < frequencyCount; i++) { - ignore[i] = !doGetVibration(++vibrationNumber); - // The last model should be cloned because we might - // have done an optimization with HSSEND=.TRUE. + String[] data = (String[]) vData.get(vibrationNumber); + ignore[i] = (!doGetVibration(++vibrationNumber) || data == null); if (ignore[i]) continue; cloneLastAtomSet(); atomSetCollection.setAtomSetName(frequencies[i] + " cm-1"); atomSetCollection.setAtomSetProperty("Frequency", frequencies[i] + " cm-1"); + atomSetCollection.setAtomSetProperty("IR Intensity", data[1] + + " KM/Mole"); + atomSetCollection.setAtomSetProperty("vibrationalSymmetry", data[0]); } - discardLinesUntilBlank(); + readLine(); fillFrequencyData(iAtom0, atomCount, ignore, false, 14, 10); readLine(); } - + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pie...@us...> - 2010-02-27 17:58:48
|
Revision: 12496 http://jmol.svn.sourceforge.net/jmol/?rev=12496&view=rev Author: pierocanepa Date: 2010-02-27 17:58:42 +0000 (Sat, 27 Feb 2010) Log Message: ----------- new feature: add symmetry of vibration modes within the CrystalReader Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-27 17:58:04 UTC (rev 12495) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-27 17:58:42 UTC (rev 12496) @@ -145,7 +145,7 @@ return true; } - if (addVibrations && line.contains("MODES EIGV")) { + if (addVibrations && line.contains("* CALCULATION OF PHONON FREQUENCIES")) { readFrequencies(); return true; } @@ -354,6 +354,7 @@ } private void readFrequencies() throws Exception { + discardLinesUntilContains("MODES EIGV"); readLine(); Vector vData = new Vector(); while (readLine() != null && line.length() > 0) { @@ -361,11 +362,23 @@ int i1 = parseInt(line.substring(6, 10)); String irrep = line.substring(49, 52).trim(); String intens = line.substring(59, 69).replace(')', ' ').trim(); - String[] data = new String[] { irrep, intens }; + + // not all crystal calculations include intensities values + // this feature is activated when the keyword INTENS is on the input + if (intens == null) + intens = "not available"; + + String irActivity = line.substring(55, 58).trim(); + String ramanActivity = line.substring(71, 73).trim(); + + String[] data = new String[] { irrep, intens, irActivity, ramanActivity }; for (int i = i0; i <= i1; i++) vData.add(data); } - discardLines(2); + + discardLinesUntilContains("NORMAL MODES NORMALIZED TO CLASSICAL AMPLITUDES"); + readLine(); + while (readLine() != null && line.startsWith(" FREQ(CM**-1)")) { int frequencyCount = 0; String[] tokens = getTokens(line.substring(15)); @@ -387,19 +400,31 @@ if (ignore[i]) continue; cloneLastAtomSet(); - atomSetCollection.setAtomSetName(data[0] + " " + frequencies[i] + " cm-1 (" + data[1] + " KM/Mole)"); + + String activity = ", IR: " + data[2] + ", Raman: " + data[3]; + atomSetCollection.setAtomSetName(data[0] + " " + frequencies[i] + + " cm-1 (" + data[1] + " km/Mole)" + activity); atomSetCollection.setAtomSetProperty("Frequency", frequencies[i] + " cm-1"); atomSetCollection.setAtomSetProperty("IR Intensity", data[1] - + " KM/Mole"); + + " km/Mole"); atomSetCollection.setAtomSetProperty("vibrationalSymmetry", data[0]); + + if (data[2] == "A") + data[2] = "active"; + data[2] = "inactive"; + + if (data[3] == "A") + data[3] = "active"; + data[3] = "inactive"; + + atomSetCollection.setAtomSetProperty("IR activity ", data[2]); + atomSetCollection.setAtomSetProperty("Raman activity ", data[3]); } readLine(); fillFrequencyData(iAtom0, atomCount, ignore, false, 14, 10); readLine(); } - } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pie...@us...> - 2010-02-27 22:24:13
|
Revision: 12503 http://jmol.svn.sourceforge.net/jmol/?rev=12503&view=rev Author: pierocanepa Date: 2010-02-27 22:24:07 +0000 (Sat, 27 Feb 2010) Log Message: ----------- Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-27 21:29:37 UTC (rev 12502) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-27 22:24:07 UTC (rev 12503) @@ -27,7 +27,7 @@ package org.jmol.adapter.readers.xtal; -import org.jmol.adapter.smarter.*; +import org.jmol.adapter.smarter.*; import org.jmol.util.Logger; import org.jmol.util.TextFormat; @@ -35,9 +35,9 @@ import java.util.Vector; /** - * + * * http://www.crystal.unito.it/ - * + * * @author Pieremanuele Canepa, Room 104, FM Group School of Physical Sciences, * Ingram Building, University of Kent, Canterbury, Kent, CT2 7NH United * Kingdom, pc...@ke... @@ -61,10 +61,12 @@ * load "xxx.out" filter "conventional" * * to NOT load vibrations, use - * + * * load "xxx.out" FILTER "novibrations" - * * + * TODO: fix frequency reader for fragment case + * + * */ public class CrystalReader extends AtomSetCollectionReader { @@ -143,17 +145,17 @@ calculationType = line.substring(line.indexOf(":") + 1).trim(); return true; } - + if (line.startsWith(" MULLIKEN POPULATION ANALYSIS")) { readPartialCharges(); return true; } - + if (addVibrations && line.contains("* CALCULATION OF PHONON FREQUENCIES")) { readFrequencies(); return true; } - + return true; } @@ -162,7 +164,7 @@ setEnergy(); super.finalizeReader(); } - + private boolean readHeader() throws Exception { discardLinesUntilContains("* CRYSTAL"); discardLinesUntilContains("EEEEEEEEEE"); @@ -226,12 +228,13 @@ } int atomIndexLast; + /* - * ATOMS IN THE ASYMMETRIC UNIT 30 - ATOMS IN THE UNIT CELL: 30 - * ATOM X/A Y/B Z(ANGSTROM) - * ***************************************************************** - * 1 T 26 FE 3.332220233571E-01 1.664350001467E-01 5.975038441891E+00 - * 2 T 8 O -3.289334452690E-01 1.544678332212E-01 5.601153565811E+00 + * ATOMS IN THE ASYMMETRIC UNIT 30 - ATOMS IN THE UNIT CELL: 30 ATOM X/A Y/B + * Z(ANGSTROM) + * ***************************************************************** 1 T 26 FE + * 3.332220233571E-01 1.664350001467E-01 5.975038441891E+00 2 T 8 O + * -3.289334452690E-01 1.544678332212E-01 5.601153565811E+00 */ private void readFractionalCoords() throws Exception { if (isMolecular) @@ -240,7 +243,8 @@ readLine(); int i = atomIndexLast; atomIndexLast = atomSetCollection.getAtomCount(); - boolean doNormalizePrimitive = isPrimitive && !isMolecular && !isPolymer && !isSlab; + boolean doNormalizePrimitive = isPrimitive && !isMolecular && !isPolymer + && !isSlab; while (readLine() != null && line.length() > 0) { Atom atom = atomSetCollection.addNewAtom(); String[] tokens = getTokens(); @@ -267,17 +271,17 @@ private String getAtomName(String s) { String atomName = s; if (atomName.length() > 1 && Character.isLetter(atomName.charAt(1))) - atomName = atomName.substring(0, 1) + Character.toLowerCase(atomName.charAt(1)) + atomName.substring(2); + atomName = atomName.substring(0, 1) + + Character.toLowerCase(atomName.charAt(1)) + atomName.substring(2); return atomName; - } + } /* - * Crystal adds 100 to the atomic number when the same atom will be - * described with different basis sets. It also adds 200 when ECP - * are used: + * Crystal adds 100 to the atomic number when the same atom will be described + * with different basis sets. It also adds 200 when ECP are used: * - * 1 T 282 PB 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 - * 2 T 16 S -5.000000000000E-01 -5.000000000000E-01 -5.000000000000E-01 + * 1 T 282 PB 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 2 T 16 + * S -5.000000000000E-01 -5.000000000000E-01 -5.000000000000E-01 */ private int getAtomicNumber(String token) { int atomicNumber = parseInt(token); @@ -289,10 +293,9 @@ /* * INPUT COORDINATES * - * ATOM AT. N. COORDINATES - * 1 12 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 - * 2 8 5.000000000000E-01 5.000000000000E-01 5.000000000000E-01 - * + * ATOM AT. N. COORDINATES 1 12 0.000000000000E+00 0.000000000000E+00 + * 0.000000000000E+00 2 8 5.000000000000E-01 5.000000000000E-01 + * 5.000000000000E-01 */ private void readInputCoords() throws Exception { readLine(); @@ -325,10 +328,11 @@ } private Double energy; + private void readEnergy() { - line = TextFormat.simpleReplace(line, "( ","("); + line = TextFormat.simpleReplace(line, "( ", "("); String[] tokens = getTokens(); - energy = new Double(Double.parseDouble(tokens[2])); + energy = new Double(Double.parseDouble(tokens[2])); setEnergy(); } @@ -357,7 +361,10 @@ atoms[i++].partialCharge = parseFloat(line.substring(9, 11)) - parseFloat(line.substring(12, 18)); } - + + private float[] frequencies; + private String[] data; + private void readFrequencies() throws Exception { discardLinesUntilContains("MODES EIGV"); readLine(); @@ -380,15 +387,15 @@ for (int i = i0; i <= i1; i++) vData.add(data); } - + discardLinesUntilContains("NORMAL MODES NORMALIZED TO CLASSICAL AMPLITUDES"); readLine(); - + int lastAtomCount = -1; while (readLine() != null && line.startsWith(" FREQ(CM**-1)")) { int frequencyCount = 0; String[] tokens = getTokens(line.substring(15)); - float[] frequencies = new float[tokens.length]; + frequencies = new float[tokens.length]; for (int i = 0; i < tokens.length; i++) { float frequency = parseFloat(tokens[i]); frequencies[frequencyCount] = frequency; @@ -400,32 +407,14 @@ boolean[] ignore = new boolean[frequencyCount]; int iAtom0 = 0; for (int i = 0; i < frequencyCount; i++) { - String[] data = (String[]) vData.get(vibrationNumber); + data = (String[]) vData.get(vibrationNumber); ignore[i] = (!doGetVibration(++vibrationNumber) || data == null); if (ignore[i]) continue; lastAtomCount = cloneLastAtomSet(atomCount); if (i == 0) iAtom0 = atomSetCollection.getLastAtomSetAtomIndex(); - String activity = ", IR: " + data[2] + ", Raman: " + data[3]; - atomSetCollection.setAtomSetName(data[0] + " " + frequencies[i] - + " cm-1 (" + data[1] + " km/Mole)" + activity); - atomSetCollection.setAtomSetProperty("Frequency", frequencies[i] - + " cm-1"); - atomSetCollection.setAtomSetProperty("IR Intensity", data[1] - + " km/Mole"); - atomSetCollection.setAtomSetProperty("vibrationalSymmetry", data[0]); - - if (data[2] == "A") - data[2] = "active"; - data[2] = "inactive"; - - if (data[3] == "A") - data[3] = "active"; - data[3] = "inactive"; - - atomSetCollection.setAtomSetProperty("IR activity ", data[2]); - atomSetCollection.setAtomSetProperty("Raman activity ", data[3]); + setFreqValue(i); } readLine(); fillFrequencyData(iAtom0, atomCount, lastAtomCount, ignore, false, 14, 10); @@ -433,4 +422,17 @@ } } + private void setFreqValue(int i) { + String activity = ", IR: " + data[2] + ", Ram. " + data[3]; + atomSetCollection.setAtomSetName(data[0] + " " + + TextFormat.formatDecimal(frequencies[i], 2) + " cm-1 (" + + TextFormat.formatDecimal(Float.parseFloat(data[1]), 0) + " km/Mole)" + + activity); + atomSetCollection.setAtomSetProperty("Frequency", frequencies[i] + " cm-1"); + atomSetCollection.setAtomSetProperty("IR Intensity", data[1] + " km/Mole"); + atomSetCollection.setAtomSetProperty("vibrationalSymmetry", data[0]); + atomSetCollection.setAtomSetProperty("IR activity ", data[2]); + atomSetCollection.setAtomSetProperty("Raman activity ", data[3]); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2010-02-28 14:28:04
|
Revision: 12514 http://jmol.svn.sourceforge.net/jmol/?rev=12514&view=rev Author: hansonr Date: 2010-02-28 14:27:58 +0000 (Sun, 28 Feb 2010) Log Message: ----------- Crystal reader set up for freqAtomCount Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-28 14:26:28 UTC (rev 12513) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-02-28 14:27:58 UTC (rev 12514) @@ -410,6 +410,7 @@ discardLinesUntilContains("MODES EIGV"); readLine(); Vector vData = new Vector(); + int freqAtomCount = atomCount; while (readLine() != null && line.length() > 0) { int i0 = parseInt(line.substring(1, 5)); int i1 = parseInt(line.substring(6, 10)); @@ -458,7 +459,7 @@ setFreqValue(i); } readLine(); - fillFrequencyData(iAtom0, atomCount, lastAtomCount, ignore, false, 14, 10); + fillFrequencyData(iAtom0, freqAtomCount, lastAtomCount, ignore, false, 14, 10); readLine(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pie...@us...> - 2010-03-03 16:16:38
|
Revision: 12546 http://jmol.svn.sourceforge.net/jmol/?rev=12546&view=rev Author: pierocanepa Date: 2010-03-03 16:16:32 +0000 (Wed, 03 Mar 2010) Log Message: ----------- Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-03-03 13:47:10 UTC (rev 12545) +++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2010-03-03 16:16:32 UTC (rev 12546) @@ -144,7 +144,7 @@ return true; } - if (addVibrations && line.contains("* CALCULATION OF PHONON FREQUENCIES")) { + if (addVibrations && line.contains("FRQFRQFRQFRQFRQFRQFRQFRQ")) { readFrequencies(); return true; } @@ -396,14 +396,47 @@ - parseFloat(line.substring(12, 18)); } + private float[] frequencies; private String[] data; private void readFrequencies() throws Exception { + discardLines(3); + readLine(); + /* + * FREQUENCIES COMPUTED ON A FRAGMENT OF 36 ATOMS + * 2 ( 8 O ) 3 ( 8 O ) 4 ( 8 O ) 85 ( 8 O ) 86 ( 8 O ) + * 87( 8 O ) 89( 6 C ) 90( 8 O ) 91( 8 O ) 92( 1 H ) + * 93( 1 H ) 94( 6 C ) 95( 1 H ) 96( 8 O ) 97( 1 H ) + * 98( 8 O ) 99( 6 C ) 100( 8 O ) 101( 8 O ) 102( 1 H ) + * 103( 1 H ) 104( 6 C ) 105( 1 H ) 106( 8 O ) 107( 8 O ) + * 108( 1 H ) 109( 6 C ) 110( 1 H ) 111( 8 O ) 112( 8 O ) + * 113( 1 H ) 114( 6 C ) 115( 1 H ) 116( 8 O ) 117( 8 O ) + * 118( 1 H ) + *INFORMATION **** INPFREQ **** ANALYSIS OF THE VIBRATIONAL MODES + * + */ + int numAtomsFrag = 0; + boolean fragment = false; + if (line.contains("FRAGMENT")) { + fragment = true; + numAtomsFrag = parseInt(line.substring(39, 44)); + int[] atomFrag = new int[numAtomsFrag]; + String Sfrag = ""; + while (readLine() != null && line.indexOf("INFORMATION **** INPFREQ") < 0) + Sfrag += line; + Sfrag = TextFormat.simpleReplace(Sfrag, "(", " ("); + String[] tokens = getTokens(Sfrag); + for (int i = 0, pos = 0; i < numAtomsFrag; i++, pos += 5) + atomFrag[i] = parseInt(tokens[pos]); + } + discardLinesUntilContains("MODES EIGV"); readLine(); Vector vData = new Vector(); int freqAtomCount = atomCount; + if(fragment == true) + freqAtomCount = numAtomsFrag; while (readLine() != null && line.length() > 0) { int i0 = parseInt(line.substring(1, 5)); int i1 = parseInt(line.substring(6, 10)); @@ -422,10 +455,9 @@ for (int i = i0; i <= i1; i++) vData.add(data); } - + discardLinesUntilContains("NORMAL MODES NORMALIZED TO CLASSICAL AMPLITUDES"); readLine(); - int lastAtomCount = -1; while (readLine() != null && line.startsWith(" FREQ(CM**-1)")) { int frequencyCount = 0; @@ -456,6 +488,7 @@ readLine(); } } + private void setFreqValue(int i) { String activity = ", IR: " + data[2] + ", Ram. " + data[3]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |