1.0-northcote/cs/Sharpen/DataFormatters/CsvDataFormatter.cs
/// <summary>
/// Exports the counterpoise correction calculation data in comma-separated values format (CSV)
/// </summary>
/// <param name="encounter">Instance of class implementing <see cref="IEncounter"/> containing the calculation data.</param>
/// <param name="stream">Stream to write CSV formatted data into.</param>
Exports the counterpoise correction calculation data in comma-separated values format (CSV)
Exports the counterpoise correction calculation data in comma - separated values format ( CSV )
public void ExportData(IEncounter encounter, Stream stream)
        {
            StreamWriter csv = new StreamWriter(stream);
            csv.Write(encounter.Description + "\n");
            csv.Write("DIMER BASIS /au");
            csv.Write("\nDimer,");
            if (encounter.EnergyCount >= 1)
            {
                csv.Write(encounter.Dimer.ToString());
            }
            csv.Write("\nMonomer A,");
            if (encounter.EnergyCount >= 2)
            {
                csv.Write(encounter.MonomerADimerBasis.ToString());
            }
            csv.Write("\nMonomer B,");
            if (encounter.EnergyCount >= 3)
            {
                csv.Write(encounter.MonomerBDimerBasis.ToString());
            }
            csv.Write("\nMONOMER BASIS /au");
            csv.Write("\nMonomer A,");
            if (encounter.EnergyCount >= 4)
            {
                csv.Write(encounter.MonomerAMonomerBasis.ToString());
            }
            csv.Write("\nMonomer B,");
            if (encounter.EnergyCount == 5)
            {
                csv.Write(encounter.MonomerBMonomerBasis.ToString());
            }
            csv.Write("\nINTERACTION ENERGY");
            csv.Write("\n/au,");
            if (encounter.EnergyCount >= 3)
            {
                csv.Write(encounter.InteractionEnergyHartrees.ToString());
            }
            csv.Write("\n/kJ/mol,");
            if (encounter.EnergyCount >= 3)
            {
                csv.Write(encounter.InteractionEnergyKjmol.ToString());
            }
            csv.Write("\nBINDING CONSTANT");
            csv.Write("\n/1,");
            if (encounter.EnergyCount >= 3)
            {
                csv.Write(encounter.BindingConstant.ToString());
            }
            csv.Close();
        }
public void ExportData ( IEncounter encounter , Stream stream ) { StreamWriter csv = new StreamWriter ( stream ) ; csv . Write ( encounter . Description + " \n " ) ; csv . Write ( " " ) ; csv . Write ( " \n " ) ; if ( encounter . EnergyCount >= 1 ) { csv . Write ( encounter . Dimer . ToString ( ) ) ; } csv . Write ( " \n " ) ; if ( encounter . EnergyCount >= 2 ) { csv . Write ( encounter . MonomerADimerBasis . ToString ( ) ) ; } csv . Write ( " \n " ) ; if ( encounter . EnergyCount >= 3 ) { csv . Write ( encounter . MonomerBDimerBasis . ToString ( ) ) ; } csv . Write ( " \n " ) ; csv . Write ( " \n " ) ; if ( encounter . EnergyCount >= 4 ) { csv . Write ( encounter . MonomerAMonomerBasis . ToString ( ) ) ; } csv . Write ( " \n " ) ; if ( encounter . EnergyCount == 5 ) { csv . Write ( encounter . MonomerBMonomerBasis . ToString ( ) ) ; } csv . Write ( " \n " ) ; csv . Write ( " \n " ) ; if ( encounter . EnergyCount >= 3 ) { csv . Write ( encounter . InteractionEnergyHartrees . ToString ( ) ) ; } csv . Write ( " \n " ) ; if ( encounter . EnergyCount >= 3 ) { csv . Write ( encounter . InteractionEnergyKjmol . ToString ( ) ) ; } csv . Write ( " \n " ) ; csv . Write ( " \n " ) ; if ( encounter . EnergyCount >= 3 ) { csv . Write ( encounter . BindingConstant . ToString ( ) ) ; } csv . Close ( ) ; }
Exports the counterpoise correction calculation data in comma-separated values format (CSV)
Exports the counterpoise correction calculation data in comma - separated values format ( CSV )
encounter
IEncounter
Instance of class implementing  containing the calculation data.
Instance of class implementing containing the calculation data .
stream
Stream
Stream to write CSV formatted data into.
Stream to write CSV formatted data into .