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