// configuration-dependent startup static char *config_tests( void ) { // malloc our gauge field and initialise our lattice geometry lat = NULL ; if( ( lat = allocate_lat( ) ) == NULL ) { fprintf( stderr , "[CONFIG-UNIT] Gauge field allocation failure\n" ) ; return NULL ; } init_navig( lat ) ; // randomly generate an SU(NC) field random_suNC( lat ) ; // allocate gauge transformed fields glat = NULL ; if( ( glat = allocate_lat( ) ) == NULL ) { fprintf( stderr , "[CONFIG-UNIT] Gauge field 2 allocation failure\n" ) ; return NULL ; } init_navig( glat ) ; size_t i , mu ; for( i = 0 ; i < LVOLUME ; i++ ) { for( mu = 0 ; mu < ND ; mu++ ) { equiv( glat[i].O[mu] , lat[i].O[mu] ) ; } } // assumes gtrans works properly random_gtrans( glat ) ; // test gauge invariant stuff mu_run_test( av_plaquette_test ) ; mu_run_test( polyakov_test ) ; free( lat ) ; free( glat ) ; return 0 ; }
// read a file, has to be out of order because it is called by the others struct site* read_file( struct head_data *HEAD_DATA , const char *config_in ) { // some additional information #ifdef CONDOR_MODE fprintf( stdout , "[PAR] CONDOR_MODE selected .... \n" ) ; #else fprintf( stdout , "[PAR] NOT_CONDOR_MODE selected .... " "(same-architecture caching used) \n" ) ; #endif /// here we include the usual stuff look at header for global stuff // open our configuration FILE *infile = fopen( config_in , "r" ) ; if( infile == NULL ) { // need to check what we are doing if( Latt.head == UNIT_GAUGE || Latt.head == RANDOM_CONFIG || Latt.head == INSTANTON ) { fprintf( stdout , "[IO] %s is empty but that is ok \n" , config_in ) ; } else { fprintf( stderr , "[IO] error opening file :: %s\n" , config_in ) ; return NULL ; } } fprintf( stdout , "[IO] reading file %s\n" , config_in ) ; // initialise the configuration number to zero struct head_data tmp ; if( read_header( infile , &tmp , GLU_TRUE ) == GLU_FAILURE ) { fprintf( stderr , "[IO] Header reading failure\n" ) ; fclose( infile ) ; return NULL ; } // initialise geometry so that we can use LVOLUME and stuff init_latt( ) ; // check for having enough memory for the gauge field if( have_memory_gauge( ) == GLU_FAILURE ) { fclose( infile ) ; return NULL ; } // malloc our gauge field and initialise our lattice geometry struct site *lat = NULL ; if( ( lat = allocate_lat( ) ) == NULL ) { fprintf( stderr , "[IO] Gauge field allocation failure\n" ) ; return NULL ; } #ifdef SINGLE_PREC fprintf( stdout , "[PREC] Single-precision storage for the gauge fields\n" ) ; #endif const int check = get_config_SUNC( infile , lat , tmp ) ; // read in the configuration ... if( check == GLU_FAILURE ) { fprintf( stderr , "[IO] File read error ... Leaving \n" ) ; fclose( infile ) ; free( lat ) ; return NULL ; } // look at scidac header again to get the checksums // this is taken from the bottom of the file if( Latt.head == SCIDAC_HEADER || Latt.head == ILDG_SCIDAC_HEADER || Latt.head == ILDG_BQCD_HEADER ) { get_header_data_SCIDAC( infile , &tmp ) ; } // have a look at some available checks if( checks( lat , check , tmp ) == GLU_FAILURE ) { fclose( infile ) ; free( lat ) ; return NULL ; } // set the header info *HEAD_DATA = tmp ; // free it if it was opened if( infile != NULL ) { fclose( infile ) ; } // and finally set the header data into a constant struct return lat ; }