int main(int argc, char *argv[]){
	input_parameters_t *in_para;
	in_para = (input_parameters_t *)malloc(sizeof(input_parameters_t));
	display_msg("Reading the configure file \n");
	load_parameters_from_file(in_para,argv[1]);

    char *crossover_file_name = NULL;
    int ind, ind_ref_1, ind_ref_2, cros_choose;

    //Setting crossover file name 
    crossover_file_name = Malloc(char, MAX_FILE_NAME);
    strcpy(crossover_file_name, "pop_crossover.pdb");

    primary_seq_t *primary_sequence; // Primary Sequence of Protein
    
    protein_t *population_p; // main population
    protein_t *new_population; // main population

    //Loading Fasta file
    primary_sequence = _load_amino_seq(in_para->seq_protein_file_name);

	//Allocating PDB ATOMS of population_p
    population_p = allocateProtein(&in_para->size_population);
    new_population  = allocateProtein(&in_para->size_population);   

    //Loading initial population and allocating atom and topology
    load_initial_population_file(population_p, &in_para->size_population, 
        in_para->path_local_execute,in_para->initial_pop_file_name,
        primary_sequence);
    //Only to initialize new_population
    load_initial_population_file(new_population, &in_para->size_population, 
        in_para->path_local_execute,in_para->initial_pop_file_name,
        primary_sequence);
    initialize_protein_population_atoms(new_population, &in_para->size_population);

    //Checking what crossover will be applied
    cros_choose = 0;
    while ( (cros_choose <= 0) || (cros_choose > MAX_CROS)){
        printf ("Enter type of  crossover 1 - 1-Point ");
        scanf ("%d",&cros_choose);            
    }

    for (ind = 0; ind < in_para->size_population; ind++){
        ind_ref_1 = 0;
        ind_ref_2 = 1;
        if (cros_choose == 1){
            crossover_one_point(&new_population[ind], &population_p[ind_ref_1], &population_p[ind_ref_2]);
        }        
    }

    save_population_file(new_population, in_para->path_local_execute, crossover_file_name, &in_para->size_population);

	deAllocateload_parameters(in_para);

	display_msg("Done 2PG Crossover \n");
	return 0;
}
int main(int argc, char *argv[]) {
    input_parameters_t in_param;

    display_msg("Reading the configure file \n");
    load_parameters_from_file(&in_param,argv[1]);

    build_initial_population(&in_param);

    deAllocateload_parameters(&in_param);

    display_msg("Done Build Initial Population !!! \n");
    return 0;
}
int main(int argc, char *argv[]){
	input_parameters_t in_param;
	display_msg("Reading the configure file \n");
	load_parameters_from_file(&in_param,argv[1]);

	if (in_param.number_fitness == 1){
		ea_mono(&in_param);
	}else{
		fatal_error("In mono-objective, NumberObjective option must be 1. Please, check it. \n");
	}

	deAllocateload_parameters(&in_param);

	display_msg("Done EA Mono !!! \n");
	return 0;
}
int main(int argc, char *argv[]){
	input_parameters_t in_param;
	display_msg("Reading the configure file \n");
	load_parameters_from_file(&in_param,argv[1]);

	/*Represents extension of files that will be looked in directory*/
	char *ext = NULL;
	/*Represents how many files there is in directory*/
	int num_files;
	/*Represents file names that are in directory and have target extension*/
	owner_file_t *file_names = NULL;

	protein_t *population_p= NULL; // main population of protein
	solution_t *solutions_p= NULL; // main solution
	dominance_t *dominance= NULL; // main of dominance
	ea_nsga2_t *nsga2_solutions_p= NULL; // main of front


/**************** START GETTING FILE NAMES *************************/
	ext = Malloc(char, 4);
	strcpy(ext, "pdb");
	num_files = how_many_files_directory_by_extension(in_param.path_local_execute, ext);
	file_names = allocate_file_t(&num_files, &in_param.number_fitness);
	insert_files_directory_by_extension(file_names, in_param.path_local_execute, ext);
	free(ext);
/**************** FINISHED GETTING FILE NAMES *************************/


/**************** START GETTING THE OBJECTIVES *************************/	
	init_gromacs_execution();
/*
	// RUN PDB2GMX IN ALL FILES FOR PATTERN OF ATOM NAMES 
	display_msg("Run of pdb2gmx for pattern of atom names\n");
	for (int ind = 0; ind < num_files; ind ++){
		call_pdb2gmx_for_pattern_atom_names(file_names[ind].file_name, in_param.path_local_execute, in_param.path_gromacs_programs, in_param.force_field);
		clean_gromacs_simulation(in_param.path_local_execute);
	}	
	// FINISHED RUN PDB2GMX 
*/
	population_p = allocateProtein(&num_files);
	solutions_p = allocate_solution(&num_files, &in_param.number_fitness);        
	for (int ind = 0; ind < num_files; ind ++){
		printf("Computing Objectives of %s\n", file_names[ind].file_name);
		char *path_PDB_file_name = path_join_file(in_param.path_local_execute, file_names[ind].file_name);
		int num_atom = get_num_atom(path_PDB_file_name);		
		population_p[ind].p_atoms = allocate_pdbatom(&num_atom);		
		load_pdb_file_without_num_atom(population_p[ind].p_atoms, NULL,	path_PDB_file_name);
		int num_res = get_number_residues_from_atom(population_p[ind].p_atoms, &num_atom);
		population_p[ind].p_topol = allocateTop_Global(&num_res, &num_atom);		
		renumerate_residue_number(population_p[ind].p_atoms, &num_atom);		
		build_topology_individual(&population_p[ind]);		
		solutions_p[ind].representation = &population_p[ind];
		get_gromacs_objectives_of_solution(&solutions_p[ind], &in_param, &ind);
		desAllocateTop_Global(population_p[ind].p_topol);
		desAllocate_pdbatom(population_p[ind].p_atoms);
		free(path_PDB_file_name);
	}	
	finish_gromacs_execution();
	//Deleting temporary files
	system("rm PROT_IND_*.pdb");
/**************** FINISHED GETTING THE OBJECTIVES *************************/

/**************** START GETTING FRONT *************************/
	in_param.size_population = num_files;
	nsga2_solutions_p = allocate_nsga2_without_allocation_of_representation(&in_param);	
	//Setting identification
	for (int i = 0; i < num_files; i++){
		nsga2_solutions_p[i].sol->ID = i+1;
	}

    //Setting dominance
	dominance = allocate_dominance(&num_files);
	set_dominance(dominance, solutions_p, &num_files);

	//Coping values of dominance
	for (int ind = 0; ind < num_files; ind++){
		// Indicates number of solutions that are dominated by me
		file_names[ind].number_solutions_are_dominated = dominance[ind].max_dominated;
	}	

	//Coping values of objective
	for (int ind = 0; ind < num_files; ind++){
		for (int ob = 0; ob < in_param.number_fitness; ob++)	
			nsga2_solutions_p[ind].sol->obj_values[ob] = solutions_p[ind].obj_values[ob];
	}

    //Setting front based on dominance concept
    compute_fronts(nsga2_solutions_p, dominance, &num_files);

    //Coping values from nsga2_solutions_p to owner_file_t
	for (int ind = 0; ind < num_files; ind++){
		//Coping objectives
		for (int ob = 0; ob < in_param.number_fitness; ob++){	
			file_names[ind].obj_values[ob] = nsga2_solutions_p[ind].sol->obj_values[ob];
		}
		file_names[ind].front = nsga2_solutions_p[ind].front;
	}
	desallocate_dominance(dominance, &num_files);
	desallocate_solution_nsga2(nsga2_solutions_p, &num_files);
/**************** FINISHED GETTING FRONT *************************/

/**************** START GETTING FINAL RESULTS *************************/
    //Sorting solutions
    sorting_solutions_by_front_dominance(file_names, &num_files, &in_param.number_fitness);

    //Saving file
	save_analysis_files(file_names, &num_files, &in_param.number_fitness, in_param.fitness_energies);
/**************** FINISHED FINAL RESULTS *************************/

	desalocate_file_t(file_names, &num_files);
    desallocate_solution(solutions_p, &num_files);
    desallocateProtein(population_p, &num_files);	
	deAllocateload_parameters(&in_param);
	display_msg("Done !!! \n");
	return 0;
}
int main(int argc, char *argv[]){
	input_parameters_t *in_para;
	in_para = (input_parameters_t *)malloc(sizeof(input_parameters_t));
	display_msg("Reading the configure file \n");
	load_parameters_from_file(in_para,argv[1]);

	FILE *f_angle = NULL;
    primary_seq_t *primary_sequence; // Primary Sequence of Protein
    protein_t *population_p = NULL;
    float angle, angle_d;
    int num_res_first, chi, max_chi;
    int num_residue_choose_2;
    char *file_name, *file_name_aux;
    int num_frame, num_rotacoes, p, r, one;
    int kind_of_rotation;
    char *name_kid_of_rotation;
    protein_t *frame_rot; //frame for rotation
    protein_t *rotated_frames; //frames that were rotated

    //Allocating variables
    file_name = Malloc(char, 600);
    file_name_aux = Malloc(char, 600);
    name_kid_of_rotation = Malloc(char, 15);
    //Assing varible using for allocating 
    one = 1;
    num_frame = 1;

    //Loading Fasta file
    primary_sequence = _load_amino_seq(in_para->seq_protein_file_name);

	//Allocating PDB ATOMS of population_p
    population_p = allocateProtein(&one);    

    //Loading initial population and allocating atom and topology
    load_initial_population_file(population_p, &one, 
        in_para->path_local_execute,in_para->initial_pop_file_name,
        primary_sequence);

    //Allocating frame
    frame_rot = allocateProtein(&num_frame);
    frame_rot->p_atoms = allocate_pdbatom(&population_p[0].p_topol->numatom);
    copy_protein(frame_rot, &population_p[0]);
    //Getting data to rotate
    printf ("Enter number of rotation: ");
    scanf ("%d",&num_rotacoes);        
    num_res_first = 0;
    while ( (num_res_first <= 0) || (num_res_first > population_p[0].p_topol->numres)){
        printf ("Enter number of residue for rotating: 1 to %d ", population_p[0].p_topol->numres);
        scanf ("%d",&num_res_first);            
    }
    angle_d = 0;
    while ( (angle_d <= 0) || (angle_d > 360)){
        printf ("Enter value of angle for rotating: 0 to 360 (degree) ");
        scanf ("%f",&angle_d);                    
    }    
    angle = degree2radians(&angle_d);
    kind_of_rotation = 0;
    while ( (kind_of_rotation <= 0) || (kind_of_rotation > 4)){
        printf ("Enter kid of rotating: 1 - PHI 2 - PSI 3 - OMEGA 4 - Side Chain ");
        scanf ("%d",&kind_of_rotation);                    
    }
    //Assing name of kind of rotation    
    if (kind_of_rotation == 1){
        strcpy(name_kid_of_rotation, "PHI");
    }else if (kind_of_rotation == 2){
        strcpy(name_kid_of_rotation, "PSI");
    }else if (kind_of_rotation == 3){
        strcpy(name_kid_of_rotation, "OMEGA");
    }if (kind_of_rotation == 4){
        strcpy(name_kid_of_rotation, "Side_Chain");
    }
    //Checking side chain rotation 
    if (kind_of_rotation == 4){
        char *res_name;
        res_name = Malloc(char, MAX_CHI);
        get_res_name_from_res_num(res_name, &num_res_first, population_p[0].p_atoms, &population_p[0].p_topol->numatom);        
        max_chi = get_number_chi(res_name);
        chi = 0;
        if (max_chi > 0){
            //Choose a chi of residue. It must be started 1 untill number of residue
             if (max_chi == 1){
                chi = 1;
             }else{                
                while ( (chi <= 0) || (chi > max_chi) ){                        
                    printf ("Enter Side Chain 1 to %d ", max_chi);
                    scanf ("%d",&chi);                    
                }
            }                    
        }else{
            printf("No side chain for your selected residue (Name %s Number %i). Please choose another residue\n",res_name, num_res_first);
            exit(1);
        }        
        free(res_name);
    }