Class IonTools

java.lang.Object
_global.tri.oxidationstates.util.IonTools

public class IonTools extends Object
This class contains some utility methods for identifying and working with polyatomic ions.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    compareStructures(matsci.structure.Structure structure1, matsci.structure.Structure structure2, boolean ignoreOxidationStates)
    Returns true if two structures are equivalent based on the standard mapping parameters set in setMappingParams(_global.tri.structure.mapper.GeneralStructureMapper), and false otherwise.
    static matsci.structure.Structure
    findRepresentativeStructure(List<matsci.structure.Structure> structures, int numSamples, boolean ignoreOxidationStates)
    From a list of given structures, finds the one that is closest to the mean of random subset of the others based on the sum of the scores of the maps between the structures.
    static matsci.structure.Structure
    Reads an ion structure from a file written in the format defined by {2link writeIonStructure()}.
    static matsci.structure.Structure
    makeRepresentativeStructure(String dirName, int numSamples)
    Randomly samples POSCAR-formatted files from the given directory and creates an "average" structure from those files.
    static void
    setMappingParams(_global.tri.structure.mapper.GeneralStructureMapper mapper)
    Sets standard structure comparison parameters for the structure mapper
    static void
    writeIonStructure(matsci.structure.Structure ion, String ionFileName, String description)
    Writes an ion structure to a special type of POSCAR-formatted file that contains information about the lattice vector periodicity in the first line of the file.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • IonTools

      public IonTools()
  • Method Details

    • makeRepresentativeStructure

      public static matsci.structure.Structure makeRepresentativeStructure(String dirName, int numSamples)
      Randomly samples POSCAR-formatted files from the given directory and creates an "average" structure from those files.
      Parameters:
      dirName - The directory containing the files to be sampled.
      numSamples - The number of files to use to create the average structure. Files are sampled without replacement.
      Returns:
      the average structure
    • compareStructures

      public static boolean compareStructures(matsci.structure.Structure structure1, matsci.structure.Structure structure2, boolean ignoreOxidationStates)
      Returns true if two structures are equivalent based on the standard mapping parameters set in setMappingParams(_global.tri.structure.mapper.GeneralStructureMapper), and false otherwise.
      Parameters:
      structure1 - One of the structures to be compared.
      structure2 - One of the structures to be compared.
      ignoreOxidationStates - True if oxidation states should be ignored when making the comparison (Fe2+ and Fe3+ are the same), and false otherwise (Fe2+ and Fe3+ are different).
      Returns:
      true if two structures are equivalent based on the standard mapping parameters set in setMappingParams(_global.tri.structure.mapper.GeneralStructureMapper), and false otherwise.
    • findRepresentativeStructure

      public static matsci.structure.Structure findRepresentativeStructure(List<matsci.structure.Structure> structures, int numSamples, boolean ignoreOxidationStates)
      From a list of given structures, finds the one that is closest to the mean of random subset of the others based on the sum of the scores of the maps between the structures. If not such structure can be found (usually because there are no reasonable maps between any one structure and all other structures), return null.
      Parameters:
      structures - The set of structures for which we will calculate the average.
      numSamples - The number of files to use to create the average structure. Structures are sampled without replacement.
      ignoreOxidationStates - True if oxidation states should be ignored when making the comparison (Fe2+ and Fe3+ are the same), and false otherwise (Fe2+ and Fe3+ are different).
      Returns:
      The average structure
    • setMappingParams

      public static void setMappingParams(_global.tri.structure.mapper.GeneralStructureMapper mapper)
      Sets standard structure comparison parameters for the structure mapper
      Parameters:
      mapper - The mapper for which we are setting the standard parameters.
    • writeIonStructure

      public static void writeIonStructure(matsci.structure.Structure ion, String ionFileName, String description)
      Writes an ion structure to a special type of POSCAR-formatted file that contains information about the lattice vector periodicity in the first line of the file.
      Parameters:
      ion - The structure file will be written for this ion.
      ionFileName - The name of the file to write.
      description - A description string to be added to the file, along with the information about lattice vector periodicity.
    • loadIonStructureFromFile

      public static matsci.structure.Structure loadIonStructureFromFile(String path)
      Reads an ion structure from a file written in the format defined by {2link writeIonStructure()}. Sets the lattice vector periodicity appropriately, as defined in the first line of the file.
      Parameters:
      path - The path to the file to be read.
      Returns:
      The structure read from the file, with lattice vector periodicity set as specified in the file.