/* This file contains the main program that
 *  is included in all MD++ programs
 */

#ifdef _USETCL
Tcl_Parser_Init(sim);
#endif//_USETCL

#ifdef _PARALLEL
int main_master(int argc, char *argv[]);
int main_slave(int argc, char *argv[]);

int main(int argc, char *argv[])
{
    sim.ParallelInit(&argc,&argv);

    if(sim.myDomain==0)
        main_master(argc,argv);
    else
        main_slave(argc,argv);

    MPI_Finalize();
    return 0;
}
int main_slave(int argc, char *argv[])
{
    sim.initvars();
    
    sim.WaitForCommand();
    return 0;
}
#else
#define main_master main
#endif //_PARALLEL


/* This is the main program for single processor run */
int main_master(int argc, char *argv[])
{
    sim.initvars();
    
#ifndef _USETCL
    sim.parse(SCParser::getfilehandler(argc,argv));
#else
    Tcl_Main_Wrapper(argc, argv);
#endif//_USETCL
    return 0;    
}

