int main(int argc,char ** argv){
  if(argc < 3){
    std::vector<float> histogram=extract_features("in.jpg");
    save_histogram("in.jpg","out.txt", histogram);
  }else{
    std::vector<float> histogram=extract_features(argv[1]);
    save_histogram(argv[1],argv[2], histogram);
    std::cout << argv[2]<<"\n";
  }
  return 0;
}
Beispiel #2
0
int main(){
    FILE *output, *xyzfile;
    output = fopen("output.data","w");
    xyzfile = fopen("trajectory.xyz", "w");
    setup_histogram();
    setup_system(new_argons);
    // Comment out one of the two lines, they should be equivalent to
    // each other.
    setup_system(old_argons);
    // memcpy(&old_argons, &new_argons, sizeof(new_argons));
    print_startup_info();
    /* Don't attempt a vol move every n steps
        frenkel smit pg 119 */
    srand(time(NULL));
    print_XYZ(old_argons, NULL);
    printf("\n*****************\n");
    printf("Equilibration run\n");
    printf("*****************\n\n");
    fprintf(output,"Energy \t Vol \t L\n");
    for(size_t n_equil = 0; n_equil < NUM_EQUIL; n_equil++){
        if(random()*(NA+1)+1<= NA){
            translational_move();
        }
        else{
            volume_move();
        }
    }
    printf("\nStats run\n");
    printf("*****************\n\n");
    float temp_E = 0.0;
    float count = 0.0;
    float percent1 = 0.0;
    float percent2 = 0.0;
    accepted_vol_moves = 0.0;
    accepted_trans_moves = 0.0;
    for(size_t n_stats = 0; n_stats < NUM_STATS; n_stats++){
        temp_E = total_energy(old_argons);
        count +=1.0;
        percent1 = accepted_vol_moves/total_vol_moves;
        percent2 = accepted_trans_moves/total_trans_moves;
        printf("%g\t%g\t%g\t%g\t%g\t%g\t%g\n",L,total_energy(old_argons)*6.022E23/NA,currdensity,total_vol_moves,total_trans_moves,percent1,percent2);
        if(random()*(NA+1)+1<= NA){
            translational_move();
        }
        else{
            volume_move();
        }
        if(n_stats % SAMPLE_FREQ == 0){
            make_histogram();
            temp_E = total_energy(old_argons);
            currdensity = (NA*39.948/6.022E23)/powf(L*100.0,3);
            fprintf(output,"%g\t%g\t%g\n", temp_E, powf(L,3),L);
            avg_E += temp_E/((float)NUM_STATS / SAMPLE_FREQ);
            avg_L += L/((float)NUM_STATS/ SAMPLE_FREQ);
        }
        print_XYZ(old_argons, xyzfile);
    }
    save_histogram();
    printf("Avg E %g\n", avg_E);
    printf("Avg L %g\n", avg_L);
    printf("\nXYZ OF ARGS\n");
    printf("*****************\n\n");
    print_XYZ(old_argons, NULL);
    fclose(output);
    fclose(xyzfile);
    printf("\n\n\nSuccessful Termination\n" );
    return 0;
}