if server:
    path_to_exec_file, num_mpi_threads, path_to_maxent = parameters.get_server_run(
    )
else:
    path_to_exec_file, num_mpi_threads, path_to_maxent = parameters.get_local_run(
    )

#############################################
#                                           #
#        SPECIFICATION OF A MODEL           #
#                                           #
#############################################
parameters.set_model_parameters()
lattice_type, beta, U, hartree_shift, Nk, num_of_neighbours, t, Coulomb, mu, particle_hole_symm, \
sweeps, time_limit, delta_mix, lambda_mix, max_it_num, start_it =  parameters.get_model_parameters()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#                                                             #
#    C T - H Y B    S E G M E N T   C A L C U L A T I O N     #
#                                                             #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# run CT-HYB SEGMENT solver
number_of_fermionic_freqs = 1024
number_of_fermionic_freqs_for_fourier = 1000  # Because of noise we cut the tail of Delta (fermionic hybr. function)
# off and make a Fouriet transform into the \tau - space by the first frequencies with smooth data.
number_of_bosonic_frequencies = 1024
number_of_discrete_tau_points = 4096  # Friedrich - 4096

start_time = time.time()
           
                KG.write(str(np.round(k_x, 6)))
                KG.write('\t')
                KG.write(str(np.round(k_y,6)))
                KG.write('\t')
                KG.write(str(np.round(interaction[i],6)))
                KG.write('\n')
                i += 1
    GM.close()
    MK.close()
    KG.close()
    
    return interaction, kpoints_coordinates

"""
    main part
"""

filename = 'Xw.dat'
freq, X_w = iteration_cycle.read_real_function(filename)
number_of_real_points = len(X_w)

parameters.set_model_parameters()
lattice_type, beta, U, hartree_shift, Nk, num_of_neighbours, t, V, mu, particle_hole_symm, sweeps, time_limit,  delta_mix, lambda_mix, number_of_iterations, start_from_it = \
parameters.get_model_parameters()
# 1. Selection G - M - K - G
test, kpoints_coordinates = interaction_GMKG('test', Nk, lattice_type, V)


    
if server:
    path_to_exec_file, num_mpi_threads, path_to_maxent = parameters.get_server_run(
    )
else:
    path_to_exec_file, num_mpi_threads, path_to_maxent = parameters.get_local_run(
    )

#################################################
#        SPECIFICATION OF THE MODEL             #
# (1) Copy the file set_parameters_change.py    #
# (2) Change the name as parameters.py      #
# (3) Set parameters                            #
#################################################
parameters.set_model_parameters()
lattice_type, beta, U, hartree_shift, Nk, num_of_neighbours, t, Coulomb, mu, particle_hole_symm, \
sweeps, time_limit, delta_mix, lambda_mix, number_of_max_it, start_it =  parameters.get_model_parameters()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#                                                             #
#    C T - H Y B    S E G M E N T   C A L C U L A T I O N     #
#                                                             #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# run CT-HYB SEGMENT solver
number_of_fermionic_freqs = 1024
number_of_fermionic_freqs_for_fourier = 1024  # Because of noise we cut the tail of Delta (fermionic hybr. function)
# off and make a Fouriet transform into the \tau - space by the first frequencies with smooth data.
number_of_bosonic_frequencies = 1024
number_of_discrete_tau_points = 4096  # Friedrich - 4096

start_time = time.time()