def compile_cadd(compiletype,compilepath,clean,builddir=builddir): buildpath = compilepath + builddir if compiletype not in compiletypes: raise ValueError('Undefined compile type') if clean: cmakecommand = 'cmake .. -DCMAKE_BUILD_TYPE={0}'.format(str.upper(compiletype)) bashcommands = ['make distclean',cmakecommand,'make'] else: bashcommands = ['make'] for bashcommand in bashcommands: process = Popen(bashcommand.split(),stdout=PIPE,stderr=PIPE,cwd=buildpath) err = mc.read_write_process(process) if err: raise mc.SubprocessError('Compiling the executable',err)
def run_cadd(exefile,lammpsoutput=False,cleanup=True,simname=None,inputpath=paths.inputpath,runpath=paths.runpath,outputpath=paths.outputpath): if simname is None: simname = get_simname(inputpath) make_main_file(simname,inputpath) copy_input_files(inputpath,runpath) bashcommand = './{0}'.format(exefile) process = Popen([bashcommand],stdout=PIPE,stderr=PIPE,cwd=runpath) err = mc.read_write_process(process) if err: raise mc.SubprocessError('Running the executable',err) copy_output_files(outputpath,runpath) if mc.convert_arg_to_logical(cleanup): clean_up_files(runpath,exefile) if mc.convert_arg_to_logical(lammpsoutput): lammps_output(outputpath)
def compile_cadd(compiletype, compilepath, clean, builddir=builddir): buildpath = compilepath + builddir if compiletype not in compiletypes: raise ValueError('Undefined compile type') if clean: cmakecommand = 'cmake .. -DCMAKE_BUILD_TYPE={0}'.format( str.upper(compiletype)) bashcommands = ['make distclean', cmakecommand, 'make'] else: bashcommands = ['make'] for bashcommand in bashcommands: process = Popen(bashcommand.split(), stdout=PIPE, stderr=PIPE, cwd=buildpath) err = mc.read_write_process(process) if err: raise mc.SubprocessError('Compiling the executable', err)
def run_cadd( exefile, lammpsoutput=False, cleanup=True, simname=None, inputpath=paths.inputpath, runpath=paths.runpath, outputpath=paths.outputpath, ): if simname is None: simname = get_simname(inputpath) make_main_file(simname, inputpath) copy_input_files(inputpath, runpath) bashcommand = "./{0}".format(exefile) process = Popen([bashcommand], stdout=PIPE, stderr=PIPE, cwd=runpath) err = mc.read_write_process(process) if err: raise mc.SubprocessError("Running the executable", err) copy_output_files(outputpath, runpath) if mc.convert_arg_to_logical(cleanup): clean_up_files(runpath, exefile) if mc.convert_arg_to_logical(lammpsoutput): lammps_output(outputpath)