def test_avi_simple(self): folder = os.path.join(os.path.dirname(rmgpy.__file__),'tools','data','flux') inputFile = os.path.join(folder,'input_simple.py') chemkinFile = os.path.join(folder, 'chemkin', 'chem.inp') dictFile = os.path.join(folder, 'chemkin', 'species_dictionary.txt') settings = {'maximumNodeCount': 50, 'maximumEdgeCount': 50, 'concentrationTolerance': 1e-6, 'speciesRateTolerance': 1e-6, 'maximumNodePenWidth': 10.0, 'maximumEdgePenWidth': 10.0, 'radius': 2, 'centralReactionCount': 2, 'timeStep': 10**0.1} createFluxDiagram(inputFile, chemkinFile, dictFile, centralSpeciesList=[1], superimpose=True, settings=settings) outputdir = os.path.join(folder,'flux') simfile = os.path.join(outputdir,'1','flux_diagram.avi') speciesdir = os.path.join(folder,'species') self.assertTrue(os.path.isfile(simfile)) shutil.rmtree(outputdir) shutil.rmtree(speciesdir)
def test_avi_simple(self): folder = os.path.join(os.path.dirname(rmgpy.__file__), 'tools', 'data', 'flux') inputFile = os.path.join(folder, 'input_simple.py') chemkinFile = os.path.join(folder, 'chemkin', 'chem.inp') dictFile = os.path.join(folder, 'chemkin', 'species_dictionary.txt') settings = { 'maximumNodeCount': 50, 'maximumEdgeCount': 50, 'concentrationTolerance': 1e-6, 'speciesRateTolerance': 1e-6, 'maximumNodePenWidth': 10.0, 'maximumEdgePenWidth': 10.0, 'timeStep': 10**0.1 } createFluxDiagram(inputFile, chemkinFile, dictFile, centralSpecies='ethane', settings=settings) outputdir = os.path.join(folder, 'flux') simfile = os.path.join(outputdir, '1', 'flux_diagram.avi') speciesdir = os.path.join(folder, 'species') self.assertTrue(os.path.isfile(simfile)) shutil.rmtree(outputdir) shutil.rmtree(speciesdir)
def generateFlux(request): """ Allows user to upload a set of RMG condition files and/or chemkin species concentraiton output to generate a flux diagram video. """ from rmgpy.tools.fluxdiagram import createFluxDiagram flux = FluxDiagram() path = '' flux.deleteDir() if request.method == 'POST': flux.createDir() form = FluxDiagramForm(request.POST, request.FILES, instance=flux) if form.is_valid(): form.save() input = os.path.join(flux.path, 'input.py') chemkin = os.path.join(flux.path, 'chem.inp') dict = os.path.join(flux.path, 'species_dictionary.txt') chemkinOutput = '' if 'ChemkinOutput' in request.FILES: chemkinOutput = os.path.join(flux.path, 'chemkin_output.out') java = form.cleaned_data['Java'] settings = {} settings['maximumNodeCount'] = form.cleaned_data['MaxNodes'] settings['maximumEdgeCount'] = form.cleaned_data['MaxEdges'] settings['timeStep'] = form.cleaned_data['TimeStep'] settings['concentrationTolerance'] = form.cleaned_data[ 'ConcentrationTolerance'] settings['speciesRateTolerance'] = form.cleaned_data[ 'SpeciesRateTolerance'] createFluxDiagram(input, chemkin, dict, savePath=flux.path, java=java, settings=settings, chemkinOutput=chemkinOutput) # Look at number of subdirectories to determine where the flux diagram videos are subdirs = [ name for name in os.listdir(flux.path) if os.path.isdir(os.path.join(flux.path, name)) ] subdirs.remove('species') return render_to_response('fluxDiagram.html', { 'form': form, 'path': subdirs }, context_instance=RequestContext(request)) else: form = FluxDiagramForm(instance=flux) return render_to_response('fluxDiagram.html', { 'form': form, 'path': path }, context_instance=RequestContext(request))
def main(): inputFile, chemkinFile, dictFile, speciesPath, chemkinOutput, useJava, dflag, settings = parse_arguments( ) createFluxDiagram(inputFile, chemkinFile, dictFile, speciesPath=speciesPath, java=useJava, settings=settings, chemkinOutput=chemkinOutput, diffusionLimited=dflag)
def test_avi_liquid(self): folder = os.path.join(os.path.dirname(rmgpy.__file__), 'tools', 'data', 'flux') inputFile = os.path.join(folder, 'input_liquid.py') chemkinFile = os.path.join(folder, 'chemkin', 'chem.inp') dictFile = os.path.join(folder, 'chemkin', 'species_dictionary.txt') createFluxDiagram(inputFile, chemkinFile, dictFile, diffusionLimited=False) outputdir = os.path.join(folder, 'flux') simfile = os.path.join(outputdir, '1', 'flux_diagram.avi') speciesdir = os.path.join(folder, 'species') self.assertTrue(os.path.isfile(simfile)) shutil.rmtree(outputdir) shutil.rmtree(speciesdir)
def test_avi_liquid(self): folder = os.path.join(os.path.dirname(rmgpy.__file__), 'tools', 'data', 'flux') inputFile = os.path.join(folder, 'input_liquid.py') chemkinFile = os.path.join(folder, 'chemkin', 'chem.inp') dictFile = os.path.join(folder, 'chemkin', 'species_dictionary.txt') createFluxDiagram(inputFile, chemkinFile, dictFile, diffusionLimited=False) outputdir = os.path.join(folder, 'flux') simfile = os.path.join(outputdir, '1', 'flux_diagram.avi') speciesdir = os.path.join(folder, 'species') self.assertTrue(os.path.isfile(simfile)) shutil.rmtree(outputdir) shutil.rmtree(speciesdir)
def main(): (inputFile, chemkinFile, dictFile, speciesPath, chemkinOutput, useJava, dflag, checkDuplicates, settings, centralSpeciesList, superimpose, saveStates, readStates) = parse_arguments() createFluxDiagram(inputFile, chemkinFile, dictFile, speciesPath=speciesPath, java=useJava, settings=settings, chemkinOutput=chemkinOutput, diffusionLimited=dflag, centralSpeciesList=centralSpeciesList, superimpose=superimpose, saveStates=saveStates, readStates=readStates, checkDuplicates=checkDuplicates)
def main(): (inputFile, chemkinFile, dictFile, speciesPath, chemkinOutput, useJava, dflag, checkDuplicates, settings, centralSpeciesList, superimpose, saveStates, readStates) = parse_arguments() createFluxDiagram(inputFile, chemkinFile, dictFile, speciesPath=speciesPath, java=useJava, settings=settings, chemkinOutput=chemkinOutput, diffusionLimited=dflag, centralSpeciesList=centralSpeciesList, superimpose=superimpose, saveStates=saveStates, readStates=readStates, checkDuplicates=checkDuplicates)
def generateFlux(request): """ Allows user to upload a set of RMG condition files and/or chemkin species concentraiton output to generate a flux diagram video. """ from rmgpy.tools.fluxdiagram import createFluxDiagram flux = FluxDiagram() path = '' flux.deleteDir() if request.method == 'POST': flux.createDir() form = FluxDiagramForm(request.POST, request.FILES,instance=flux) if form.is_valid(): form.save() input = os.path.join(flux.path,'input.py') chemkin = os.path.join(flux.path,'chem.inp') dict = os.path.join(flux.path,'species_dictionary.txt') chemkinOutput = '' if 'ChemkinOutput' in request.FILES: chemkinOutput = os.path.join(flux.path,'chemkin_output.out') java = form.cleaned_data['Java'] settings = {} settings['maximumNodeCount'] = form.cleaned_data['MaxNodes'] settings['maximumEdgeCount'] = form.cleaned_data['MaxEdges'] settings['timeStep'] = form.cleaned_data['TimeStep'] settings['concentrationTolerance'] = form.cleaned_data['ConcentrationTolerance'] settings['speciesRateTolerance'] = form.cleaned_data['SpeciesRateTolerance'] createFluxDiagram(input, chemkin, dict, savePath=flux.path, java=java, settings=settings, chemkinOutput=chemkinOutput) # Look at number of subdirectories to determine where the flux diagram videos are subdirs = [name for name in os.listdir(flux.path) if os.path.isdir(os.path.join(flux.path, name))] subdirs.remove('species') return render(request, 'fluxDiagram.html', {'form': form, 'path':subdirs}) else: form = FluxDiagramForm(instance=flux) return render(request, 'fluxDiagram.html', {'form': form,'path':path})
def main(): inputFile, chemkinFile, dictFile, speciesPath, chemkinOutput, useJava, dflag, settings = parse_arguments() createFluxDiagram(inputFile, chemkinFile, dictFile, speciesPath=speciesPath, java=useJava, settings=settings, chemkinOutput=chemkinOutput, diffusionLimited=dflag)