def calculate_forces(self): """ starts a Fleur calculation which calculates forces. """ # get converged calculation # create new calculation with l_f =T, gff allow for relaxation of certain # atomtyps or species # dont copy broyden files, copy cdn1? # run fleur self.ctx.loop_count2 = self.ctx.loop_count2 + 1 last_calc2 = self.ctx.last_calc2 # be careful, test if convergence success or not... fleurinp = last_calc2.get('fleurinp', None) if fleurinp: fleurinp_new = fleurinp.copy() else: # warning fleurinp_new = None print 'no fleurinp data was found in last_calc2' if False: # TODO something other specified in wf parameters change_dict = {'l_f': True} else: # relax every atom in all direction specified in inp.xml change_dict = {'l_f': True} # for calculation of forces fleurinp_new.set_inpchanges(change_dict) #fleurinp_new.store()# needed? remote = last_calc2.get('remote_folder', None) # run fleur FleurProcess = FleurCalculation.process() inputs = FleurCalculation.process().get_inputs_template() #inputs.parent_folder = remote inputs.code = self.inputs.fleur inputs.fleurinpdata = fleurinp_new inputs.parent_folder = remote # we need to copy cnd1 inputs._options.resources = {"num_machines": 1} inputs._options.max_wallclock_seconds = 30 * 60 # if code local use #if self.inputs.fleur.is_local(): # inputs._options.computer = computer #else: # inputs._options.queue_name = 'th1' inputs._options.withmpi = False # for now print 'Relax structure with Fleur, cycle: {}'.format( self.ctx.loop_count2) future = self.submit(FleurProcess, inputs) self.ctx.calcs.append(future) return ToContext(last_calc2=future)
def run_fleur(self): ''' run a fleur calculation ''' FleurProcess = FleurCalculation.process() inputs = {} inputs = self.get_inputs_fleur() #print inputs future = submit(FleurProcess, **inputs) print 'run Fleur in band workflow' return ToContext(last_calc=future)
from aiida_fleur.calculation.fleurinputgen import FleurinputgenCalculation from aiida_fleur.calculation.fleur import FleurCalculation from aiida_fleur.tools.common_fleur_wf import get_inputs_fleur, get_inputs_inpgen __copyright__ = (u"Copyright (c), 2016, Forschungszentrum Jülich GmbH, " "IAS-1/PGI-1, Germany. All rights reserved.") __license__ = "MIT license, see LICENSE.txt file" __version__ = "0.27" __contributors__ = "Jens Broeder" RemoteData = DataFactory('remote') StructureData = DataFactory('structure') ParameterData = DataFactory('parameter') #FleurInpData = DataFactory('fleurinp.fleurinp') FleurInpData = DataFactory('fleur.fleurinp') FleurProcess = FleurCalculation.process() FleurinpProcess = FleurinputgenCalculation.process() class fleur_scf_wc(WorkChain): """ This workflow converges a FLEUR calculation (SCF). It converges the charge density and optional the total energy Two paths are possible: (1) Start from a structure and run the inpgen first (2) Start from a Fleur calculation, with optional remoteData :Params: wf_parameters: parameterData node, :Params: structure : structureData node,
'max_wallclock_seconds': 180, 'resources': { 'num_machines': 1 }, 'withmpi': False, #'computer': computer } inp = {'structure': s, 'parameters': parameters, 'code': code} f = run(JobCalc, _options=attrs, **inp) fleurinp = f['fleurinpData'] fleurinpd = load_node(fleurinp.pk) # now run a Fleur calculation ontop of an inputgen calculation code = Code.get_from_string(codename2) JobCalc = FleurCalculation.process() attrs = {'max_wallclock_seconds': 180, 'resources': {'num_machines': 1}} inp1 = {'code': code, 'fleurinpdata': fleurinpd} #'parent' : parent_calc, f1 = run(JobCalc, _options=attrs, **inp1) ''' # You can also run Fleur from a Fleur calculation and apply some changes to the input file. #parent_id = JobCalc.pk #parentcalc = FleurCalculation.get_subclass_from_pk(parent_id) fleurinp = f1['fleurinpData'] fleurinpd = load_node(fleurinp.pk).copy() fleurinpd.set_changes({'dos' : T}) inp2 = {'code' : code, 'fleurinpdata' : fleurinpd}#'parent' : parent_calc, f2 = run(JobCalc, _options=attrs, **inp2) '''