Exemplo n.º 1
0
def run_eos_wf(codename, pseudo_family, element):
	print "Workfunction node pk: {}".format(registry.current_calc_node)
	#Instantiate a JobCalc process and create basic structure
	JobCalc = PwCalculation.process()
	s0 = create_diamond_fcc(Str(element))
	eos=[]
	scale_facs = (0.98, 0.99, 1.0, 1.02, 1.04)
	for factor in  scale_facs:
		s = rescale(s0,Float(factor))
		inputs = generate_scf_input_params(
			s, str(codename), str(pseudo_family))
		print "Running a scf for {} with scale factor {}".format(
			element, factor)
	calc_results = run(JobCalc,**inputs)
	eos.append(get_info(calc_results))
	#Return information to plot the EOS
	ParameterData = DataFactory("parameter")
	return {'initial_structure': s0,'result': ParameterData(dict={'eos_data': eos})}
    def report(self, ctx):
        """
        Output final quantities
        """
        from aiida.orm import DataFactory
        self.out("steps", DataFactory('parameter')(dict={
            'steps': ctx.steps,
            'step0': ctx.step0}))
        self.out("structure", ctx.last_structure)
        

if __name__ == "__main__":
    import argparse

    parser = argparse.ArgumentParser(description='Energy calculation example.')
    parser.add_argument('--pseudo', type=str, dest='pseudo', required=True,
                        help='The pseudopotential family')
    parser.add_argument('--code', type=str, dest='code', required=True,
                        help='The codename to use')

    structure = create_diamond_fcc(element=Str('Si'))
    
    print "Initial structure:", structure

    args = parser.parse_args()
    wf_results = run(PressureConvergence, structure=structure, code=Str(args.code), pseudo_family=Str(args.pseudo), volume_tolerance=Float(0.1))
    print "Workflow results:"
    print wf_results

Exemplo n.º 3
0
                    label, ctx[label]['output_parameters'].dict.energy)


if __name__ == "__main__":
    import argparse

    parser = argparse.ArgumentParser(description='Equation of states example.')
    parser.add_argument('--structure', type=int, dest='structure_pk',
                        help='The structure pk to use.', required=True)
    parser.add_argument('--range', type=str, dest='range',
                        help='The scale range of the equation of states '
                             'calculation written as [start]:[end]:[delta]',
                             default='0.96:1.04:0.02')
    parser.add_argument('--pseudo', type=str, dest='pseudo',
                        help='The pseudopotential family', required=True)
    parser.add_argument('--code', type=str, dest='code',
                        help='The codename to use', required=True)

    args = parser.parse_args()
    start, end, delta = args.range.split(':')

    # Get the structure from the calculation
    # run(EquationOfStates, structure=load_node(args.structure_pk),
    #     start=Float(start), end=Float(end), delta=Float(delta),
    #     code=Str(args.code), pseudo_family=Str(args.pseudo))
    run(EquationOfStates, structure=load_node(args.structure_pk),
        start=Float(start), end=Float(end), delta=Float(delta),
        code=Str(args.code), pseudo_family=Str(args.pseudo))


Exemplo n.º 4
0
    def s6(self, ctx):
        print "s6"

    #        f = async(slow)
    #        return Wait(f)

    def cond2(self, ctx):
        return ctx.w < 10

    def cond3(self, ctx):
        return True

    def s7(self, ctx):
        print " s7"
        ctx.w += 1
        print "w=", ctx.w

    def s8(self, ctx):
        print "s8"

    def s9(self, ctx):
        print "s9, end"

    def s11(self, ctx):
        pass


if __name__ == '__main__':
    run(W)
        return ResultToContext(**calcs)

    def return_results(self, ctx):
        eos = []
        for label in labels:
            eos.append(get_info(ctx[label]))

        #Return information to plot the EOS
        ParameterData = DataFactory("parameter")
        retdict = {
                'initial_structure': ctx.s0,
                'result': ParameterData(dict={'eos_data': eos})
	       }
        for k, v in retdict.iteritems():
            self.out(k, v)

if __name__ == "__main__":
    import argparse

    parser = argparse.ArgumentParser(description='Equation of states example.')
    parser.add_argument('--pseudo', type=str, dest='pseudo',
                        help='The pseudopotential family', required=True)
    parser.add_argument('--code', type=str, dest='code',
                        help='The codename to use', required=True)

    args = parser.parse_args()
  
    # Get the structure from the calculation
    run(EquationOfStates, element=Str("Si"),
        code=Str(args.code), pseudo_family=Str(args.pseudo))
Exemplo n.º 6
0
        self.out("structure", ctx.last_structure)


if __name__ == "__main__":
    import argparse

    parser = argparse.ArgumentParser(description='Energy calculation example.')
    parser.add_argument('--pseudo',
                        type=str,
                        dest='pseudo',
                        required=True,
                        help='The pseudopotential family')
    parser.add_argument('--code',
                        type=str,
                        dest='code',
                        required=True,
                        help='The codename to use')

    structure = create_diamond_fcc(element=Str('Si'), alat=Float(5.2))

    print "Initial structure:", structure

    args = parser.parse_args()
    wf_results = run(PressureConvergence,
                     structure=structure,
                     code=Str(args.code),
                     pseudo_family=Str(args.pseudo),
                     volume_tolerance=Float(0.1))
    print "Workflow results:"
    print wf_results
Exemplo n.º 7
0
def run_scf(structure, codename, pseudo_family):
    JobCalc = PwCalculation.process()
    inputs = generate_scf_input_params(structure, codename, pseudo_family)
    return run(JobCalc, **inputs)