Esempio n. 1
0
 def run_exists(self, runcmd, output, check_database=True):
     if os.path.exists("%s/parameter.cfg" % output):
         sp1 = system_parameter.system_parameter()
         sp1.read_file("%s/parameter.cfg" % output)
         if sp1.get_system() == None:
             return False
         else:
             sp2 = system_parameter.system_parameter()
             sp2.read_cmd(runcmd)
             results_exists = os.path.exists("%s/results" % output)
             return system_equal(sp1, sp2) and results_exists
     elif check_database:
         sp = system_parameter.system_parameter()
         sp.read_cmd(runcmd)
         return database_exists(sp)
     else:
         return False
Esempio n. 2
0
	def run_exists(self, runcmd, output, check_database=True):
		if os.path.exists("%s/parameter.cfg" % output):
			sp1=system_parameter.system_parameter()
			sp1.read_file("%s/parameter.cfg" % output)
			if sp1.get_system()==None:
				return False
			else:
				sp2=system_parameter.system_parameter()
				sp2.read_cmd(runcmd)
				results_exists=os.path.exists("%s/results" % output)
				return system_equal(sp1, sp2) and results_exists
		elif check_database:
			sp=system_parameter.system_parameter()
			sp.read_cmd(runcmd)
			return database_exists(sp)
		else:
			return False
Esempio n. 3
0
def main():

	usage="""Config file can (must) contain:"

	Necessary Parameter:
	
	system			:	System name (e.g. Bulk-EuGdO, see 'run.py list')
	ni			:	Charge carrier concentation in inner layers

	Parameter (=Default values):
	
	np=1			:	Number of processes for MPI
	M=None 			:	Number of outer material layer
	N=1			:	Number of inner material layer
	ncr=None		:	Charge carrier concentation in outer layers
	dW=None			:	Work function difference

	temperatures=None	:	Tuple which contains the temperatures
	findtc=False		:	Find Tc automatically, Start with 'temperatures'
	tsteps=None		:	List with decreasing time steps for findtc routine
	deltaM=None		:	Magnetisation tolerance for findtc routine

	output=None		:	Alternative output folder
	input=None		:	Alternative input folder
	initial_input=None	:	Alternative initial input
	inputFlag=True		:	Search for suitable input
	check_database=False	:	Check database for existing results
	source=None		:	Source for suitable input 
					('local', 'remote', None(both), 'local-remote'
					 or 'remote-local'. The latter prefers remote over local input)
	input_system_name=None	:	Alternative input system (only relevant if source!=local)	
	isoDeltaFlag=True	:	Add isolated energy shifts in heterostr. case
	updatedbFlag=True	:	Update database after successful run
	iteration_parameter=''	:	Additional/Alternative iteration parameter
	get_iterpara=None	:	Function which determines default iter. param.
	log='run'		:	Name of the log files
	verbose=True		:	Send email after every successful run
	[email protected]..	:	Alternative email address

	Note: Type run.py list for a list of available system types.
	
	"""
	
	parser = argparse.ArgumentParser(description='Run euo programm', formatter_class=argparse.RawTextHelpFormatter)
	parser.add_argument('config', help=usage)
	args = parser.parse_args()

	if (args.config=='list'):
		sp=system_parameter.system_parameter()
		sp.print_physical_systems()
		exit(0)

	# add current working directory to system path
	sys.path.append(os.getcwd())
	# copy config file to temporary file to avoid syntax problems
	cfg_file_name="config_temp.py"
	cfg_name=cfg_file_name.rsplit('.py',1)[0]
	shutil.copyfile(args.config, cfg_file_name)

	# default values
	M=None
	N=1
	np=1
	ncr=None
	dW=None
	output=None
	input=None
	inputFlag=True
	isoDeltaFlag=True
	updatedbFlag=True
	initial_input=None
	iteration_parameter=''
	get_iterpara=None
	check_database=False
	source=None
	input_system_name=None
	log='run'
	verbose=True
	temperatures=None
	findtc=False
	tsteps=None
	deltaM=None
	email="*****@*****.**"
	#email="*****@*****.**"

	# import parameter from file
	##exec('from %s import *' % cfg_name) in globals(), locals()
	exec('from %s import *' % cfg_name)
	os.remove(cfg_file_name)
	os.remove(cfg_file_name + "c")
	#l=[np, system, N, M, ni, ncr, dW, output, input, initial_input, inputFlag, isoDeltaFlag, updatedbFlag, iteration_parameter, get_iterpara, check_database, source, log, verbose, findtc, tsteps, deltaM] 
	#for x in l:
	#	print x

	# init euorun class
	erun=euorun.euorun(np, system, N, M, ni, ncr, dW, output, input, initial_input, inputFlag, isoDeltaFlag, updatedbFlag, iteration_parameter, get_iterpara, check_database, source, input_system_name, log, verbose, email)

	# run 
	if findtc==True:
		#print "findTc"
		erun.findtc(temperatures,tsteps,deltaM)
	else:
		#print "sweep"
		erun.tempsweep(temperatures)
Esempio n. 4
0
    def __init__(self,
                 np,
                 material,
                 N=5,
                 M=None,
                 ni=0.01,
                 ncr=None,
                 dW=None,
                 output=None,
                 input=None,
                 initial_input=None,
                 inputFlag=True,
                 isoDeltaFlag=True,
                 updatedbFlag=True,
                 iteration_parameter=None,
                 get_default_iteration_parameter=None,
                 check_database=False,
                 source=None,
                 input_system_name=None,
                 log='run',
                 verbose=True,
                 email='*****@*****.**',
                 mailcmd='mailx -s'):
        # number of nodes
        self.np = np
        # material name
        self.material = material
        # number of left layers
        self.N = N
        # number of right layers
        self.M = M
        # number of charge carriers in the left system
        self.ni = ni
        # number of charge carriers in the right system
        self.ncr = ncr
        # workfunction difference between left and right system
        self.dW = dW
        # initial input folder
        self.initial_input = initial_input
        # search automatically for suitable input
        self.inputFlag = inputFlag
        # add isolated delta values automatically
        self.isoDeltaFlag = isoDeltaFlag
        # update databases after succesfful runs automatically
        self.updatedbFlag = updatedbFlag
        # additional parameter (like max2, wr1, etc.)
        # user defined parameter (if not defined add nothing)
        if iteration_parameter != None:
            self.iteration_parameter = iteration_parameter
        else:
            self.iteration_parameter = ''

        # function which gives the default iteration parameter depending on the material
        # (only relevant for automatic isodelta runs)
        if get_default_iteration_parameter != None:
            self.get_default_iteration_parameter = get_default_iteration_parameter
        else:
            self.get_default_iteration_parameter = database.get_iteration_parameter

        # check database before a run, if it exists don't run again
        self.check_database = check_database
        # source for searching suitable input ('local', 'remote' or None(=both))
        self.source = source
        # alternative system name which can serve as an input (only if source!=local)
        self.input_system_name = input_system_name
        # logfile name
        self.log = log
        # email address
        self.email = email
        # send intermediate notifications
        self.verbose = verbose
        # email command
        self.mailcmd = mailcmd

        # keep an instance of the system parameter class for later use
        self.sp = system_parameter.system_parameter()
        # keep an instance of bulk database for later use
        self.bdb = database.bulk_database()
        self.bdb.download()
        # keep an instance of isolated database for later use
        self.idb = database.isolated_database()
        self.idb.download()
        # keep an instance of heterostructure database for later use
        self.hdb = database.heterostructure_database()
        self.hdb.download()

        # get material class
        self.material_class = self.sp.get_system_by_name(
            self.material).material_class

        # get mpicmd
        self.mpicmd = get_worker().mpicmd
        # get name which defines the system
        self.name = None
        if self.material_class == 'bulk':
            self.name = self.bdb.get_output(self.material, self.ni)
        elif self.material_class == 'isolated':
            self.name = self.idb.get_output(self.material, self.N, self.ni)
        else:
            self.name = self.hdb.get_output(self.material, self.N, self.M,
                                            self.ni, self.ncr, self.dW)
        # set top output folder to current working directory by default
        if output == None:
            if self.material_class == 'bulk':
                self.output = self.bdb.get_output(self.material, self.ni)
            elif self.material_class == 'isolated':
                self.output = self.idb.get_output(self.material, self.N,
                                                  self.ni)
            else:
                self.output = self.hdb.get_output(self.material, self.N,
                                                  self.M, self.ni, self.ncr,
                                                  self.dW)
        else:
            self.output = output

        # set top input search folder to output folder by default
        if input == None:
            self.input = self.output
        else:
            self.input = input
        # host
        self.host = database.get_host()
Esempio n. 5
0
	def __init__(self, np, material, N=5, M=None, ni=0.01, ncr=None, dW=None, output=None, input=None, initial_input=None, inputFlag=True, isoDeltaFlag=True, updatedbFlag=True, iteration_parameter=None, get_default_iteration_parameter=None, check_database=False, source=None, input_system_name=None, log='run', verbose=True, email='*****@*****.**', mailcmd='mailx -s'):
		# number of nodes
		self.np=np
		# material name
		self.material=material
		# number of left layers
		self.N=N
		# number of right layers
		self.M=M
		# number of charge carriers in the left system
		self.ni=ni
		# number of charge carriers in the right system
		self.ncr=ncr
		# workfunction difference between left and right system
		self.dW=dW
		# initial input folder
		self.initial_input=initial_input
		# search automatically for suitable input
		self.inputFlag=inputFlag
		# add isolated delta values automatically 
		self.isoDeltaFlag=isoDeltaFlag
		# update databases after succesfful runs automatically
		self.updatedbFlag=updatedbFlag
		# additional parameter (like max2, wr1, etc.)
		# user defined parameter (if not defined add nothing)
		if iteration_parameter!=None:
			self.iteration_parameter=iteration_parameter
		else:
			self.iteration_parameter=''

		# function which gives the default iteration parameter depending on the material 
		# (only relevant for automatic isodelta runs)
		if get_default_iteration_parameter!=None:
			self.get_default_iteration_parameter=get_default_iteration_parameter
		else:
			self.get_default_iteration_parameter=database.get_iteration_parameter
	
		# check database before a run, if it exists don't run again
		self.check_database=check_database
		# source for searching suitable input ('local', 'remote' or None(=both))
		self.source=source
		# alternative system name which can serve as an input (only if source!=local)
		self.input_system_name=input_system_name
		# logfile name
		self.log=log
		# email address
		self.email=email
		# send intermediate notifications
		self.verbose=verbose
		# email command
		self.mailcmd=mailcmd

		# keep an instance of the system parameter class for later use
		self.sp=system_parameter.system_parameter()
		# keep an instance of bulk database for later use
		self.bdb=database.bulk_database()
		self.bdb.download()
		# keep an instance of isolated database for later use
		self.idb=database.isolated_database()
		self.idb.download()
		# keep an instance of heterostructure database for later use
		self.hdb=database.heterostructure_database()
		self.hdb.download()
		
		# get material class
		self.material_class=self.sp.get_system_by_name(self.material).material_class

		# get mpicmd
		self.mpicmd=get_worker().mpicmd
		# get name which defines the system
		self.name=None
		if self.material_class=='bulk':
			self.name=self.bdb.get_output(self.material, self.ni)
		elif self.material_class=='isolated':
			self.name=self.idb.get_output(self.material, self.N, self.ni)
		else:
			self.name=self.hdb.get_output(self.material, self.N, self.M, self.ni, self.ncr, self.dW)
		# set top output folder to current working directory by default
		if output==None:
			if self.material_class=='bulk':
				self.output=self.bdb.get_output(self.material, self.ni)
			elif self.material_class=='isolated':
				self.output=self.idb.get_output(self.material, self.N, self.ni)
			else:
				self.output=self.hdb.get_output(self.material, self.N, self.M, self.ni, self.ncr, self.dW)
		else:
			self.output=output
	
		# set top input search folder to output folder by default
		if input==None:
			self.input=self.output
		else:
			self.input=input
		# host
		self.host=database.get_host()