Class SimSpace

java.lang.Object
com.molecular_java.SimSpace

public class SimSpace extends Object
A class for containment of important parameters, constants and I/O files to process the simulation. It has only one constructor, which is called from the main method and uses a name of simulation to get the input file (with the same name as the name of a simulation) and to create the output files. In postprocessing of the data got from the simulation it also has the data file and avg file readers to count the errors and to make a log file.
  • Field Details

    • simulationName

      public String simulationName
      Simulation name.
    • inputFolder

      public String inputFolder
      Input folder path.
    • outputFolder

      public String outputFolder
      Output folder path.
    • inputFileName

      public String inputFileName
      Name of the input file.
    • dataFileName

      public String dataFileName
      Name of the data file.
    • JSONInput

      public org.json.JSONObject JSONInput
      Input file reader.
    • dataFileReader

      public BufferedReader dataFileReader
      Data file reader. In csv format.
    • avgFileReader

      public BufferedReader avgFileReader
      Avgs for postprocessing. A reader.
    • dataFile

      public MyWriter dataFile
      Data file writer.
    • xyzFile

      public MyWriter xyzFile
      xyz file writer. In xyz format.
    • avgFile

      public MyWriter avgFile
      avg file writer.
    • logFile

      public MyWriter logFile
      Dog file writer. It has information from the input file stored in, Dvg file content and errors
    • tclScript

      public MyWriter tclScript
      tcl script for the simulation.
    • dataFileHeader

      public String dataFileHeader
      A header for the data file.
    • dataFileNrOfColumns

      public int dataFileNrOfColumns
      Number of columns of the data file.
    • random

      public Random random
      A Random object used in the simulations.
    • watches

      public MyWatches watches
      Object used for time meassurement. See the MyWatches class for further information.
    • typeOfSimulation

      public String typeOfSimulation
      Defines which type of simulation we are going to make. Only Pivot-ChainMoves is implemented now!
    • typeOfPotential

      public String typeOfPotential
      Defines which type of potential we want to use. However, only "Lennard-Jones" potential is realistic and useable now.
    • potentialMatrix

      public double[][] potentialMatrix
      A matrix of pairwise potentials between AAs.
    • fSequence

      public String fSequence
      FASTA sequence of the simulated peptide.
    • balls

      public ArrayList<Ball> balls
      An array which contains balls in the simulation space.
    • nrOfBalls

      public int nrOfBalls
      Number of balls in the simulation space.
    • numberOfCycles

      public int numberOfCycles
      Number of cycles of the simulation.
    • skippedCycles

      public int skippedCycles
      Specifies how many cycles are not count to averages and are not also used for the error estimation.
    • temperatureInit

      public Double temperatureInit
      Parameter of the simulation which specifies how easily the unprobable stays will be accepted. In physics it is used for count of beta factor: 1/(Temperature*Boltzmann's constant). This is used for Boltzmann's factor for the MC decision step. Gives initial state for "simulated annealing technique".
    • temperatureFinal

      public Double temperatureFinal
      Parameter of the simulation which specifies how easily the unprobable stays will be accepted. In physics it is used for count of beta factor: 1/(Temperature*Boltzmann's constant). This is used for Boltzmann's factor for the MC decision step. Gives final state for "simulated annealing technique".
    • springConst

      public Double springConst
      Parameter of the spring bond potential count.
    • rangeOfAngleForRotation

      public Double rangeOfAngleForRotation
      Parameter of the simulation which specifies how much the chain of balls can be rotated in one step.
    • lengthOfBond

      public Double lengthOfBond
      Specifies how long are the bonds between the balls.
    • bendingConst

      public Double bendingConst
      Constant for bending potential.
    • bendingAngleOffsetCos

      public Double bendingAngleOffsetCos
      Cosinus of angle of bond. Used in bending potential count.
    • bendingPotentialTable

      public Double[][] bendingPotentialTable
      Table with potential values (index 1) for given angle values (index 0).
    • optimalDihedralAngle

      public Double optimalDihedralAngle
      Meassured "optimal" dihedral angle. Used in dihedral angle count by "atan2" method.
    • optimalSinDihedralAngle

      public Double optimalSinDihedralAngle
      Meassured "optimal" dihedral angle. Used in dihedral angle count by "sin" method.
    • constantDihedralAngle

      public Double constantDihedralAngle
      Constant used in formula to count dihedral angle potential by "atan2" method.
    • constantSinDihedralAngle

      public Double constantSinDihedralAngle
      Constant used in formula to count dihedral angle potential by "sin" method.
    • dihedralPotentialTable

      public Double[][] dihedralPotentialTable
      Table with potential values (index 1) for given angle values (index 0).
    • noteFreq

      public int noteFreq
      Specifies how often the XYZ positions will be noted.
    • DATAFreq

      public int DATAFreq
      Specifies how often the DATA will be noted.
    • resNumberOfCycles

      public int resNumberOfCycles
      How many active cycles do we have
      See Also:
    • v

      public SimRunVars v
      Contains variables which are changed, but also important during the simulation and in postprocessing.
    • st

      public StepVars st
      Contains variables important for each step.
    • st_new

      public StepVars st_new
      Contains new variables for each step.
    • inputFile

      public BufferedReader inputFile
      Reader for the input file. See input file specification in user docs!
  • Constructor Details

    • SimSpace

      public SimSpace(String InputFolderName, String OutputFolderName, String SimulationName) throws IOException, NumberFormatException, OperationNotSupportedException
      The constructor gets a name of the simulation, opens input files and output files and loads parameters from the input file. It also initializes objects needed for the simulation as the Random object or MyWatches, which are very important for the simulation run.
      Parameters:
      InputFolderName - the name of the input folder
      OutputFolderName - the name of the output folder
      SimulationName - the name of simulation
      Throws:
      IOException - if the input file is missing or is loaded incorrectly
      NumberFormatException - if the numbers in the input file are not formatted correctly
      OperationNotSupportedException - if the simulation box got wrong parameters
    • SimSpace

      public SimSpace()
      Only for testing. Vars to be initialized later.
  • Method Details

    • makeTclScript

      public void makeTclScript() throws IOException
      Throws:
      IOException - occurs if there is some error with I/O
    • restorePozitionsFromXYZ

      public void restorePozitionsFromXYZ(String restoreFileName) throws IOException
      This method is called if option "--restore" is given as an argument. It takes [input folder name][simulation name].restore.xyz file with pozitions of the balls given in xyz format (the number of balls in xyz and in the input fasta file must match) and sets their positions. Made for purpose of very long simulation, in which unwanted break is probable.
      Parameters:
      restoreFileName - name of the file which contains the XYZ values for the structure to be restored.
      Throws:
      IOException - if it is not worked with the file system properly.
    • loadPotentialFromCSV

      public Double[][] loadPotentialFromCSV(String inPotFileName) throws IOException
      Method which takes a filename of potential csv matrix as an argument and gives a table with the values as the output. For specification on the input file see please the user docs / README.md
      Parameters:
      inPotFileName - is the filepath to a csv file
      Returns:
      2 dimensional array, [0] are the values of angle in rads and [1] the concord values of potential in the simulation units.
      Throws:
      IOException - if it is not worked with the file properly.