Esempio n. 1
0
// perform a heatbath
int
hb_update( struct site *lat ,
           const struct hb_info HBINFO ,
           const char *traj_name ,
           const GLU_output storage ,
           const char *output_details ,
           const GLU_bool continuation )
{
    // counters
    size_t i ;

    // seed the parallel RNG
    char str[ 256 ] ;

    // strip the number in the infile if it has one
    char *pch = strtok( (char*)traj_name , "." ) ;

    sprintf( str , "%s.%zu.rand" , pch , Latt.flow ) ;
    if( continuation == GLU_FALSE ) {
        fprintf( stdout , "[UPDATE] initialising par_rng from pool\n" ) ;
        if( initialise_par_rng( NULL ) == GLU_FAILURE ) {
            return GLU_FAILURE ;
        }
    } else {
        fprintf( stdout , "[UPDATE] restarting from a previous trajectory\n" ) ;
        if( initialise_par_rng( str ) == GLU_FAILURE ) {
            return GLU_FAILURE ;
        }
    }

    // initialise the draughtboard
    struct draughtboard db ;
    if( init_cb( &db , LVOLUME , ND ) == GLU_FAILURE ) {
        return GLU_FAILURE ;
    }

    // this guy appears throughout the HB algorithm
    const double inverse_beta = NC/(HBINFO.beta) ;

    // give us some information
    fprintf( stdout , "[UPDATE] Performing %zu HB-OR iterations\n" ,
             HBINFO.iterations ) ;
    fprintf( stdout , "[UPDATE] Themalising for %zu iterations\n" ,
             HBINFO.therm ) ;
    fprintf( stdout , "[UPDATE] %zu over-relaxations per heatbath\n" ,
             HBINFO.Nor ) ;
    fprintf( stdout , "[UPDATE] Saving every %zu iteration(s)\n" ,
             HBINFO.Nsave ) ;
    fprintf( stdout , "[UPDATE] Using beta = %1.12f \n" , HBINFO.beta ) ;

    // thermalise
    start_timer( ) ;

    for( i = 0 ; i < HBINFO.therm ; i++ ) {
        update_lattice( lat , inverse_beta , db , HBINFO.Nor ) ;
        if( !(i&15) ) {
            fprintf( stdout , "\n[UPDATE] config %zu done \n" , i ) ;
            print_time() ;
        }
    }
    print_time( ) ;

    // iterate the number of runs
    const size_t start = Latt.flow ;
    for( i = Latt.flow ; i < HBINFO.iterations ; i++ ) {

        // perform a hb-OR step
        update_lattice( lat , inverse_beta , db , HBINFO.Nor ) ;

        // set the lattice flow
        // if we are saving the data print out the plaquette and write a file
        if( i%HBINFO.Nmeasure == 0 ) {
            // write out the plaquette
            fprintf( stdout , "[UPDATE] %zu :: {P} %1.12f \n" ,
                     i , av_plaquette( lat ) ) ;
            // write the temporal polyakov loop, (re,im) |L|
            const double complex L = poly( lat , ND-1 ) / ( LCU * NC ) ;
            fprintf( stdout , "[UPDATE] {L} ( %f , %f ) %f \n" ,
                     creal( L ) , cimag( L ) , cabs( L ) ) ;
        }

        // if we hit a save point we write out the configuration
        if( i%HBINFO.Nsave == 0 && i != start ) {
            // write a configuration
            sprintf( str , "%s.%zu" , traj_name , i ) ;
            write_configuration( lat , str , storage , output_details ) ;
            // write out the rng state
            sprintf( str , "%s.rand" , str ) ;
            write_par_rng_state( str ) ;
        }
        Latt.flow = i + 1 ;
    }

    // free the draughtboard
    free_cb( &db ) ;

    // tell us how long this generation took
    print_time() ;

    // free the rng
    free_par_rng( ) ;

    return GLU_SUCCESS ;
}
Esempio n. 2
0
#endif
  return ;
}

// Coulomb gauge fixing code
size_t
Coulomb( struct site *__restrict lat , 
	 const double accuracy , 
	 const size_t iter )
{
  double splink , tlink ;
  all_links( lat , &splink , &tlink ) ;

  fprintf( stdout , "[GF] Initial Tlink :: %1.15f || Slink :: %1.15f \n"
	   "[GF] Plaquette :: %1.15f \n", 
	   tlink , splink , av_plaquette( lat ) ) ; 
  
  // put an ifdef guard here as SD requires none of this ...
#ifdef HAVE_FFTW3_H

  if( parallel_ffts( ) == GLU_FAILURE ) {
    fprintf( stderr , "Problem with initialising the OpenMP"
	     " FFTW routines \n" ) ;
    return GLU_FAILURE ;
  }

  fftw_plan *forward  = malloc( ( TRUE_HERM ) * sizeof( fftw_plan ) ) ; 
  fftw_plan *backward = malloc( ( TRUE_HERM ) * sizeof( fftw_plan ) ) ; 
  GLU_complex **out   = fftw_malloc( ( TRUE_HERM ) * sizeof( GLU_complex* ) ) ; 
  GLU_complex **in    = fftw_malloc( ( TRUE_HERM ) * sizeof( GLU_complex* ) ) ;