def generate_lems_file(self, nml_file_name, nml_doc):
<EOL>if '<STR_LIT>' in self.simulation_config:<EOL><INDENT>gen_spike_saves_for_all_somas = True<EOL><DEDENT>target = nml_doc.networks[<NUM_LIT:0>].id<EOL>sim_id = '<STR_LIT>'%target<EOL>duration = self.simulation_config['<STR_LIT>']['<STR_LIT>']<EOL>dt = self.simulation_config['<STR_LIT>']['<STR_LIT>']<EOL>lems_file_name = '<STR_LIT>'%sim_id<EOL>target_dir = "<STR_LIT>"<EOL>gen_saves_for_quantities = {}<EOL>gen_plots_for_quantities = {}<EOL>if '<STR_LIT>' in self.simulation_config:<EOL><INDENT>if '<STR_LIT>' in self.simulation_config['<STR_LIT>']:<EOL><INDENT>mp = self.simulation_config['<STR_LIT>']['<STR_LIT>']<EOL>node_set = self.node_set_mappings[mp['<STR_LIT>']]<EOL>for nml_pop in node_set:<EOL><INDENT>comp = self.nml_pop_vs_comps[nml_pop]<EOL>ids = node_set[nml_pop]<EOL>display = '<STR_LIT>'%nml_pop<EOL>file_name = '<STR_LIT>'%nml_pop<EOL>for id in ids:<EOL><INDENT>quantity = '<STR_LIT>'%(nml_pop,id,comp,'<STR_LIT:v>')<EOL>if not nml_pop in self.nml_pops_having_locations:<EOL><INDENT>quantity = '<STR_LIT>'%(nml_pop,id,'<STR_LIT:v>')<EOL><DEDENT>if not display in gen_plots_for_quantities:<EOL><INDENT>gen_plots_for_quantities[display] = []<EOL><DEDENT>gen_plots_for_quantities[display].append(quantity)<EOL>if not file_name in gen_saves_for_quantities:<EOL><INDENT>gen_saves_for_quantities[file_name] = []<EOL><DEDENT>gen_saves_for_quantities[file_name].append(quantity)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>generate_lems_file_for_neuroml(sim_id, <EOL>nml_file_name, <EOL>target, <EOL>duration, <EOL>dt, <EOL>lems_file_name,<EOL>target_dir,<EOL>include_extra_files = self.nml_includes,<EOL>gen_plots_for_all_v = False,<EOL>plot_all_segments = False,<EOL>gen_plots_for_quantities = gen_plots_for_quantities,   <EOL>gen_saves_for_all_v = False,<EOL>save_all_segments = False,<EOL>gen_saves_for_quantities = gen_saves_for_quantities,  <EOL>gen_spike_saves_for_all_somas = gen_spike_saves_for_all_somas,<EOL>report_file_name = REPORT_FILE,<EOL>copy_neuroml = True,<EOL>verbose=True)<EOL>return lems_file_name<EOL>
Generate a LEMS file to use in simulations of the NeuroML file