private void readNMRData ( IChemModel model , String labelLine ) throws CDKException { List < IAtomContainer > containers = ChemModelManipulator . getAllAtomContainers ( model ) ; if ( containers . size ( ) == 0 ) { // nothing to store the results into return ; } // otherwise insert in the first AC IAtomContainer ac = containers . get ( 0 ) ; // Determine label for properties String label ; if ( labelLine . indexOf ( "Diamagnetic" ) >= 0 ) { label = "Diamagnetic Magnetic shielding (Isotropic)" ; } else if ( labelLine . indexOf ( "Paramagnetic" ) >= 0 ) { label = "Paramagnetic Magnetic shielding (Isotropic)" ; } else { label = "Magnetic shielding (Isotropic)" ; } int atomIndex = 0 ; for ( int i = 0 ; i < atomCount ; ++ i ) { try { String line = input . readLine ( ) . trim ( ) ; while ( line . indexOf ( "Isotropic" ) < 0 ) { if ( line == null ) { return ; } line = input . readLine ( ) . trim ( ) ; } StringTokenizer st1 = new StringTokenizer ( line ) ; // Find Isotropic label while ( st1 . hasMoreTokens ( ) ) { if ( st1 . nextToken ( ) . equals ( "Isotropic" ) ) { break ; } } // Find Isotropic value while ( st1 . hasMoreTokens ( ) ) { if ( st1 . nextToken ( ) . equals ( "=" ) ) break ; } double shielding = Double . valueOf ( st1 . nextToken ( ) ) . doubleValue ( ) ; logger . info ( "Type of shielding: " + label ) ; ac . getAtom ( atomIndex ) . setProperty ( CDKConstants . ISOTROPIC_SHIELDING , new Double ( shielding ) ) ; ++ atomIndex ; } catch ( IOException | NumberFormatException exc ) { logger . debug ( "failed to read line from gaussian98 file where I expected one." ) ; } } }
Reads NMR nuclear shieldings .