def write_nh_simspec_file(sim_name, sim_parms, sims_to_run, results_to_save, output_dir): '''Writes the Nano-Hive Sim specification file, which is an XML file that describes the simulation environment, plugin selection and plugin parameters. ''' # The Nano-Hive Sim Spec file has 4 different sections that must be written in the following order: # 1. Header Section # 2. Physical Interaction Plugin(s) Section # 3. Results Plugin(s) Section # 4. Footer Section. # Mark 050915. simspec_fname = get_nh_simspec_filename(sim_name) workflow_fname = get_nh_workflow_filename(sim_name) mmp_fname = get_nh_mmp_filename(sim_name) f = open(simspec_fname, 'w') # Open Nano-Hive Sim Spec file. sp = sim_parms write_nh_header(f, sp.desc, sp.iterations, sp.spf, sp.temp, workflow_fname, mmp_fname) # Need to ask Brian about conditions for Bond record to be written. if 0: write_nh_bond_calc_rec(f) # Physical Interaction Plugins ######################################## if "MPQC_ESP" in sims_to_run: write_nh_mpqc_esp_plane_rec(f, sp.esp_image, output_dir) if "MPQC_GD" in sims_to_run: write_nh_mpqc_gd_rec(f) if "AIREBO" in sims_to_run: write_nh_airebo_rec(f) # Results Plugins ######################################## if "MEASUREMENTS_TO_FILE" in results_to_save: write_nh_measurements_to_file_results_rec(f, output_dir) if "POVRAYVIDEO" in results_to_save: write_nh_povrayvideo_results_rec(f, sim_name, output_dir) if "NETCDF" in results_to_save: write_nh_netcdf_results_rec(f, output_dir) # Footer ######################################## write_nh_footer(f) f.close()
def write_nh_simspec_file(sim_name, sim_parms, sims_to_run, results_to_save, output_dir): """ Writes the Nano-Hive Sim specification file, which is an XML file that describes the simulation environment, plugin selection and plugin parameters. """ # The Nano-Hive Sim Spec file has 4 different sections that must be written in the following order: # 1. Header Section # 2. Physical Interaction Plugin(s) Section # 3. Results Plugin(s) Section # 4. Footer Section. # Mark 050915. simspec_fname = get_nh_simspec_filename(sim_name) workflow_fname = get_nh_workflow_filename(sim_name) mmp_fname = get_nh_mmp_filename(sim_name) f = open(simspec_fname,'w') # Open Nano-Hive Sim Spec file. sp = sim_parms write_nh_header(f, sp.desc, sp.iterations, sp.spf, sp.temp, workflow_fname, mmp_fname) # Need to ask Brian about conditions for Bond record to be written. if 0: write_nh_bond_calc_rec(f) # Physical Interaction Plugins ######################################## if "MPQC_ESP" in sims_to_run: write_nh_mpqc_esp_plane_rec(f, sp.esp_image, output_dir) if "MPQC_GD" in sims_to_run: write_nh_mpqc_gd_rec(f) if "AIREBO" in sims_to_run: write_nh_airebo_rec(f) # Results Plugins ######################################## if "MEASUREMENTS_TO_FILE" in results_to_save: write_nh_measurements_to_file_results_rec(f, output_dir) if "POVRAYVIDEO" in results_to_save: write_nh_povrayvideo_results_rec(f, sim_name, output_dir) if "NETCDF" in results_to_save: write_nh_netcdf_results_rec(f, output_dir) # Footer ######################################## write_nh_footer(f) f.close()
def write_nh_workflow_file(sim_name): """ Writes the Nano-Hive Workflow file, which is a TCL script used by Nano-Hive to run the simulation. It describes the workflow of the simulation. """ workflow_fname = get_nh_workflow_filename(sim_name) f = open(workflow_fname,'w') f.write ('NH_Import $inFile\n\n') f.write ('NH_Calculate 0 $traverser\n') f.write ('NH_Calculate 0 $espImage $traverser\n') f.write ('NH_Intermediate 0 $simResult\n\n') f.write ('NH_Final $simResult\n') f.close()
def write_nh_workflow_file(sim_name): '''Writes the Nano-Hive Workflow file, which is a TCL script used by Nano-Hive to run the simulation. It describes the workflow of the simulation. ''' workflow_fname = get_nh_workflow_filename(sim_name) f = open(workflow_fname, 'w') f.write('NH_Import $inFile\n\n') f.write('NH_Calculate 0 $traverser\n') f.write('NH_Calculate 0 $espImage $traverser\n') f.write('NH_Intermediate 0 $simResult\n\n') f.write('NH_Final $simResult\n') f.close()