QCJSONWriter
Date: 2019-10-22

org.jmol.adapter.writers

## Class QCJSONWriter

- java.lang.Object
- - org.jmol.util.JSONWriter
  - - org.jmol.adapter.writers.QCJSONWriter

-     public class QCJSONWriter
      extends JSONWriter

  A very experimental class for writing QCJSON files. This standard is in the process of being developed, so any of this could change at any time. All we have here is Bob Hanson's experiment with getting Jmol to save and restore structures, vibrations, and molecular orbitals. Data set Bob is using is at https://sourceforge.net/p/jmol/code/HEAD/tree/trunk/Jmol-datafiles/qcjson

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `QCJSONWriter.SparseArray`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private int` | `basisID`
    `private int[][]` | `dfCoefMaps`
    `private boolean` | `filterMOs`
    `private java.util.Map<java.lang.String,java.lang.String>` | `htBasisMap`
    `private static java.util.Map<java.lang.String,java.lang.String>` | `integrationKeyMap`
    `private java.util.Map<java.lang.String,java.lang.Object>` | `moBases`
    `private javajs.util.Lst<int[]>` | `shells`
    `private Viewer` | `vwr`

    - ### Fields inherited from class org.jmol.util.JSONWriter

      `indent, oc`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `QCJSONWriter()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `private java.lang.String` | `addBasis(java.util.Map<java.lang.String,java.lang.Object> moData)` Add a basis to the associative array moBases keyed on its hashcode
    `void` | `closeSchema()`
    `private java.lang.Object` | `fixCoefficients(double[] coeffs)` Jmol allows for a set of arrays that map coefficient indicies with nonstandard order to Gaussian/Molden order.
    `private static java.util.Map<java.lang.String,java.lang.String>` | `fixIntegration()` When an MO is calculated in Jmol, Jmol will check the integration so that it can be checked to be close to 1.0000.
    `private java.lang.String` | `formatNumber(float x)`
    `protected java.lang.Object` | `getAndCheckValue(java.util.Map<java.lang.String,java.lang.Object> map, java.lang.String key)`
    `private java.lang.Object` | `getAuxiliaryData(int modelIndex, java.lang.String key)`
    `java.lang.Object` | `getProperty(int modelIndex, java.lang.String key)`
    `private boolean` | `haveMOData(int modelIndex)`
    `private boolean` | `isVibration(int modelIndex)`
    `void` | `openSchema()`
    `void` | `set(Viewer viewer, java.io.OutputStream os)`
    `private void` | `setDFCoord(java.util.Map<java.lang.String,java.lang.Object> moData)`
    `java.lang.String` | `toString()`
    `void` | `writeAtoms(int modelIndex)`
    `void` | `writeBonds(int modelIndex)`
    `void` | `writeJob(int iJob)`
    `void` | `writeJobMetadata()`
    `void` | `writeJobs()`
    `void` | `writeJSON()`
    `void` | `writeMagic()`
    `private void` | `writeMapKeyValueUnits(java.lang.String key, java.lang.Object value, java.lang.String units)`
    `void` | `writeMOBases()`
    `private void` | `writeMOData(int modelIndex)`
    `int` | `writeModel(int modelIndex)`
    `void` | `writeModelMetadata(int modelIndex)`
    `void` | `writeModels()`
    `void` | `writeObject(java.lang.Object o)`
    `private void` | `writePrefix_Units(java.lang.String prefix, java.lang.String units)`
    `void` | `writeSchemaMetadata()`
    `void` | `writeTopology(int modelIndex)`
    `int` | `writeVibrations(int modelIndex)`

    - ### Methods inherited from class org.jmol.util.JSONWriter

      `append, arrayAdd, arrayClose, arrayOpen, closeStream, mapAddKey, mapAddKeyValue, mapAddKeyValueRaw, mapAddMapAllExcept, mapClose, mapOpen, setModifyKeys, setStream, setWriteNullAsString, writeArray, writeBoolean, writeList, writeMap, writeNull, writeNumber, writeString, writeString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### moBases

          private java.util.Map<java.lang.String,java.lang.Object> moBases

    - #### htBasisMap

          private java.util.Map<java.lang.String,java.lang.String> htBasisMap

    - #### filterMOs

          private boolean filterMOs

    - #### vwr

          private Viewer vwr

    - #### basisID

          private int basisID

    - #### shells

          private javajs.util.Lst<int[]> shells

    - #### dfCoefMaps

          private int[][] dfCoefMaps

    - #### integrationKeyMap

          private static java.util.Map<java.lang.String,java.lang.String> integrationKeyMap

  - ### Constructor Detail

    - #### QCJSONWriter

          public QCJSONWriter()

  - ### Method Detail

    - #### set

          public void set(Viewer viewer,
                          java.io.OutputStream os)

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### writeJSON

          public void writeJSON()

    - #### writeSchemaMetadata

          public void writeSchemaMetadata()

    - #### openSchema

          public void openSchema()

    - #### writeMagic

          public void writeMagic()

    - #### closeSchema

          public void closeSchema()

    - #### writeJobs

          public void writeJobs()

    - #### writeJob

          public void writeJob(int iJob)

    - #### writeJobMetadata

          public void writeJobMetadata()

    - #### writeModels

          public void writeModels()

    - #### writeModel

          public int writeModel(int modelIndex)

    - #### writeTopology

          public void writeTopology(int modelIndex)

    - #### getProperty

          public java.lang.Object getProperty(int modelIndex,
                                              java.lang.String key)

    - #### isVibration

          private boolean isVibration(int modelIndex)

    - #### writeModelMetadata

          public void writeModelMetadata(int modelIndex)

    - #### writeAtoms

          public void writeAtoms(int modelIndex)

    - #### formatNumber

          private java.lang.String formatNumber(float x)

    - #### writePrefix_Units

          private void writePrefix_Units(java.lang.String prefix,
                                         java.lang.String units)

    - #### writeBonds

          public void writeBonds(int modelIndex)

    - #### writeVibrations

          public int writeVibrations(int modelIndex)

    - #### writeMapKeyValueUnits

          private void writeMapKeyValueUnits(java.lang.String key,
                                             java.lang.Object value,
                                             java.lang.String units)

    - #### haveMOData

          private boolean haveMOData(int modelIndex)

    - #### getAuxiliaryData

          private java.lang.Object getAuxiliaryData(int modelIndex,
                                                    java.lang.String key)

    - #### writeMOData

          private void writeMOData(int modelIndex)

    - #### fixIntegration

          private static java.util.Map<java.lang.String,java.lang.String> fixIntegration()

      When an MO is calculated in Jmol, Jmol will check the integration so that it can be checked to be close to 1.0000. This integration value is saved back in the MO data, but it is not a standard key. (As though anything is here!) So we set a key mapping to replace it.
      Returns:
        the "integration" key map

    - #### getAndCheckValue

          protected java.lang.Object getAndCheckValue(java.util.Map<java.lang.String,java.lang.Object> map,
                                                      java.lang.String key)

      Overrides:
        `getAndCheckValue` in class `JSONWriter`

    - #### fixCoefficients

          private java.lang.Object fixCoefficients(double[] coeffs)

      Jmol allows for a set of arrays that map coefficient indicies with nonstandard order to Gaussian/Molden order. Here we do the conversion upon writing so that the order is always Gaussian/Molden order.
      Parameters:
        `coeffs` -
      Returns:

    - #### setDFCoord

          private void setDFCoord(java.util.Map<java.lang.String,java.lang.Object> moData)

    - #### addBasis

          private java.lang.String addBasis(java.util.Map<java.lang.String,java.lang.Object> moData)

      Add a basis to the associative array moBases keyed on its hashcode
      Parameters:
        `moData` -
      Returns:
        ID for this basis.

    - #### writeMOBases

          public void writeMOBases()

    - #### writeObject

          public void writeObject(java.lang.Object o)

      Overrides:
        `writeObject` in class `JSONWriter`