Class CrystalReader

  • All Implemented Interfaces:
    javajs.api.GenericLineReader

    public class CrystalReader
    extends AtomSetCollectionReader
    A reader of OUT and OUTP files for CRYSTAL http://www.crystal.unito.it/
    Version:
    1.4 for a specific model in the set, use load "xxx.out" n as for all readers, where n is an integer > 0 for final optimized geometry use load "xxx.out" 0 (that is, "read the last model") as for all readers for conventional unit cell -- input coordinates only, use load "xxx.out" filter "conventional" to NOT load vibrations, use load "xxx.out" FILTER "novibrations" to load just the input deck exactly as indicated, use load "xxx.out" FILTER "input" now allows reading of frequencies and atomic values with conventional as long as this is not an optimization.
    Author:
    Pieremanuele Canepa, Room 104, FM Group School of Physical Sciences, Ingram Building, University of Kent, Canterbury, Kent, CT2 7NH United Kingdom, pc229@kent.ac.uk
    • Field Detail

      • isVersion3

        private boolean isVersion3
      • isPrimitive

        private boolean isPrimitive
      • isPolymer

        private boolean isPolymer
      • isSlab

        private boolean isSlab
      • isMolecular

        private boolean isMolecular
      • haveCharges

        private boolean haveCharges
      • inputOnly

        private boolean inputOnly
      • isLongMode

        private boolean isLongMode
      • getLastConventional

        private boolean getLastConventional
      • havePrimitiveMapping

        private boolean havePrimitiveMapping
      • isProperties

        private boolean isProperties
      • ac

        private int ac
      • atomIndexLast

        private int atomIndexLast
      • atomFrag

        private int[] atomFrag
      • primitiveToIndex

        private int[] primitiveToIndex
      • nuclearCharges

        private float[] nuclearCharges
      • vCoords

        private javajs.util.Lst<java.lang.String> vCoords
      • energy

        private java.lang.Double energy
      • ptOriginShift

        private javajs.util.P3 ptOriginShift
      • primitiveToCryst

        private javajs.util.M3 primitiveToCryst
      • directLatticeVectors

        private javajs.util.V3[] directLatticeVectors
      • spaceGroupName

        private java.lang.String spaceGroupName
      • primitiveVolume

        private float primitiveVolume
      • primitiveDensity

        private float primitiveDensity
      • vPrimitiveMapping

        private javajs.util.Lst<java.lang.String> vPrimitiveMapping
    • Constructor Detail

      • CrystalReader

        public CrystalReader()
    • Method Detail

      • checkLine

        protected boolean checkLine()
                             throws java.lang.Exception
        Overrides:
        checkLine in class AtomSetCollectionReader
        Returns:
        true if need to read new line
        Throws:
        java.lang.Exception
      • setDirect

        private boolean setDirect()
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • readTransformationMatrix

        private void readTransformationMatrix()
                                       throws java.lang.Exception
        Read transform matrix primitive to conventional.
        Throws:
        java.lang.Exception
      • readShift

        private boolean readShift()
        Read the origin shift
        Returns:
        true
      • setPrimitiveVolumeAndDensity

        private void setPrimitiveVolumeAndDensity()
        Read the primitive cell volume and density. Not sure why we are rounding here.
      • readHeader

        private boolean readHeader()
                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • readLatticeParams

        private void readLatticeParams​(boolean isNewSet)
                                throws java.lang.Exception
        Read the lattice parameters.
        Parameters:
        isNewSet -
        Throws:
        java.lang.Exception
      • readPrimitiveMapping

        private void readPrimitiveMapping()
                                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • setPrimitiveMapping

        private boolean setPrimitiveMapping()
                                     throws java.lang.Exception
        Create arrays that maps primitive atoms to conventional atoms in a 1:1 fashion. Creates int[] primitiveToIndex -- points to model-based atomIndex
        Returns:
        TRUE if coordinates have been created
        Throws:
        java.lang.Exception
      • readAtoms

        private boolean readAtoms()
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • fixAtomName

        private static java.lang.String fixAtomName​(java.lang.String s)
        MN33 becomes Mn33
        Parameters:
        s -
        Returns:
        fixed atom name
      • getAtomicNumber

        private int getAtomicNumber​(java.lang.String token)
      • readCoordLines

        private void readCoordLines()
                             throws java.lang.Exception
        Read coordinates, either input or crystallographic, just saving their lines in a vector for now.
        Throws:
        java.lang.Exception
      • createAtomsFromCoordLines

        private void createAtomsFromCoordLines()
                                        throws java.lang.Exception
        Now create atoms from the coordinate lines.
        Throws:
        java.lang.Exception
      • newAtomSet

        private void newAtomSet()
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • setEnergy

        private void setEnergy()
      • readPartialCharges

        private boolean readPartialCharges()
                                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • readTotalAtomicCharges

        private boolean readTotalAtomicCharges()
                                        throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getAtomIndexFromPrimitiveIndex

        private int getAtomIndexFromPrimitiveIndex​(int iPrim)
      • readFreqFragments

        private boolean readFreqFragments()
                                   throws java.lang.Exception
        Select only specific atoms for frequency generation. (See freq_6for_001.out)
        Returns:
        true
        Throws:
        java.lang.Exception
      • readFrequencies

        private boolean readFrequencies()
                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • setFreqValue

        private void setFreqValue​(float freq,
                                  java.lang.String[] data)
      • readGradient

        private boolean readGradient()
                              throws java.lang.Exception
        Read minimization measures
        Returns:
        true
        Throws:
        java.lang.Exception
      • readData

        private boolean readData​(java.lang.String name,
                                 int nfields)
                          throws java.lang.Exception
        For spin and magnetic moment data, read the data block and save it as property_spin or propert_magneticMoment.
        Parameters:
        name -
        nfields -
        Returns:
        true
        Throws:
        java.lang.Exception
      • getQuadrupoleTensors

        private boolean getQuadrupoleTensors()
                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • readBornChargeTensors

        private boolean readBornChargeTensors()
                                       throws java.lang.Exception
        Throws:
        java.lang.Exception