private IChemFile readChemFile ( IChemFile chemFile ) throws CDKException , IOException { IChemSequence sequence = chemFile . getBuilder ( ) . newInstance ( IChemSequence . class ) ; IChemModel model = null ; String line = input . readLine ( ) ; String levelOfTheory ; String description ; int modelCounter = 0 ; // Find first set of coordinates by skipping all before "Standard orientation" while ( input . ready ( ) && ( line != null ) ) { if ( line . indexOf ( "Standard orientation:" ) >= 0 ) { // Found a set of coordinates model = chemFile . getBuilder ( ) . newInstance ( IChemModel . class ) ; readCoordinates ( model ) ; break ; } line = input . readLine ( ) ; } if ( model != null ) { // Read all other data line = input . readLine ( ) . trim ( ) ; while ( input . ready ( ) && ( line != null ) ) { if ( line . indexOf ( ' ' ) == 0 ) { // Found the route section // Memorizing this for the description of the chemmodel lastRoute = line ; modelCounter = 0 ; } else if ( line . indexOf ( "Standard orientation:" ) >= 0 ) { // Found a set of coordinates // Add current frame to file and create a new one. if ( ! readOptimizedStructureOnly . isSet ( ) ) { sequence . addChemModel ( model ) ; } else { logger . info ( "Skipping frame, because I was told to do" ) ; } fireFrameRead ( ) ; model = chemFile . getBuilder ( ) . newInstance ( IChemModel . class ) ; modelCounter ++ ; readCoordinates ( model ) ; } else if ( line . indexOf ( "SCF Done:" ) >= 0 ) { // Found an energy model . setProperty ( CDKConstants . REMARK , line . trim ( ) ) ; } else if ( line . indexOf ( "Harmonic frequencies" ) >= 0 ) { // Found a set of vibrations // readFrequencies(frame); } else if ( line . indexOf ( "Total atomic charges" ) >= 0 ) { readPartialCharges ( model ) ; } else if ( line . indexOf ( "Magnetic shielding" ) >= 0 ) { // Found NMR data readNMRData ( model , line ) ; } else if ( line . indexOf ( "GINC" ) >= 0 ) { // Found calculation level of theory levelOfTheory = parseLevelOfTheory ( line ) ; logger . debug ( "Level of Theory for this model: " + levelOfTheory ) ; description = lastRoute + ", model no. " + modelCounter ; model . setProperty ( CDKConstants . DESCRIPTION , description ) ; } else { //logger.debug("Skipping line: " + line); } line = input . readLine ( ) ; } // Add last frame to file sequence . addChemModel ( model ) ; fireFrameRead ( ) ; } chemFile . addChemSequence ( sequence ) ; return chemFile ; }
Read the Gaussian98 output .