343def SuperChicInitialize(Init, stdin=None):
344
345 logger.info("Starting SuperChic Initialization")
346
347 os.makedirs('inputs', exist_ok=True)
348 os.makedirs('evrecs', exist_ok=True)
349 os.makedirs('outputs', exist_ok=True)
350 if not os.path.exists("param_card.dat"):
351 if os.path.exists(Init.superchicpath+"/share/doc/SuperChic/Cards/param_card.dat"):
352 shutil.copyfile(Init.superchicpath+"/share/doc/SuperChic/Cards/param_card.dat","param_card.dat")
353 else:
354 raise Exception('Unexpected error in superchic init execution: probably absent param_card.dat')
355 if not os.path.exists("ident_card.dat"):
356 if os.path.exists(Init.superchicpath+"/share/doc/SuperChic/Cards/ident_card.dat"):
357 shutil.copyfile(Init.superchicpath+"/share/doc/SuperChic/Cards/ident_card.dat","ident_card.dat")
358 else:
359 raise Exception('Unexpected error in superchic init execution: probably absent ident_card.dat')
360
361 try:
362 inputDAT = open('input.DAT')
363
364 except IOError:
365 raise Exception("problem with file IO; potentially input.DAT not created correctly")
366 else:
367
368 try:
369 rc = run_command(Init.superchicpath+"/bin/init", inputDAT)
370
371 except OSError:
372 raise Exception("init executable or file not found")
373
374 except Exception:
375 raise Exception("Non-OSError or IOError in init execution block")
376
377 if rc:
378 raise Exception('Unexpected error in superchic init execution')
379
380 return
381
382