コード例 #1
0
    def run_zeopp(self):

        self.report("Running workchain for structure {}".format(
            self.inputs.structure.filename))

        label = "zeopp"
        inputs = {}
        inputs['_label'] = label
        inputs['_description'] = "Sampling accessible pore surface with zeo++"
        inputs['code'] = self.inputs.zeopp_code
        inputs['structure'] = self.inputs.structure

        NetworkParameters = DataFactory('zeopp.parameters')
        network_dict = {
            'cssr': True,
            'ha': True,
            'vsa': [1.8, 1.8, 1000],
            'sa': [1.8, 1.8, 1000],
        }
        inputs['parameters'] = NetworkParameters(dict=network_dict)
        inputs['_options'] = self.default_options

        NetworkCalculation = CalculationFactory('zeopp.network')
        future = submit(NetworkCalculation.process(), **inputs)
        self.report(
            "pk: {} | Submitted zeo++ calculation for structure {}".format(
                future.pid, self.inputs.structure.filename))

        return ToContext(**{label: Outputs(future)})
コード例 #2
0
def generate_lammps_params(structure, settings, type=None, pressure=0.0):
    """
    Generate the input paramemeters needed to run a calculation for LAMMPS

    :param structure: StructureData object
    :param settings: ParametersData object containing a dictionary with the LAMMPS parameters
    :return: Calculation process object, input dictionary
    """

    try:
        code = settings.dict.code[type]
    except:
        code = settings.dict.code

    plugin = Code.get_from_string(code).get_attr('input_plugin')
    LammpsCalculation = CalculationFactory(plugin)
    inputs = LammpsCalculation.process().get_inputs_template()
    inputs.code = Code.get_from_string(code)

    # machine
    inputs._options.resources = settings.dict.machine['resources']
    inputs._options.max_wallclock_seconds = settings.dict.machine[
        'max_wallclock_seconds']

    inputs.structure = structure
    inputs.potential = ParameterData(dict=settings.dict.potential)

    # if code.get_input_plugin_name() == 'lammps.optimize':
    if type == 'optimize':
        print('optimize inside')

        lammps_parameters = dict(settings.dict.parameters)
        lammps_parameters.update({'pressure': pressure})  # pressure kb
        inputs.parameters = ParameterData(dict=lammps_parameters)

    return LammpsCalculation.process(), inputs
コード例 #3
0
ファイル: __init__.py プロジェクト: kdeeg/aiidalab-epfl-lsmo
 def run_ddec_point_charges(self):
     """Compute ddec point charges from precomputed charge-density."""
     charge_density = self.ctx.charge_density_calc['remote_folder']
     #options['prepend_text'] = "export OMP_NUM_THREADS=12"
     inputs = {
         'code'                   : self.inputs.ddec_code,
         'parameters'             : self.inputs.ddec_parameters,
         'charge_density_folder'  : charge_density,
         '_options'               : self.inputs.ddec_options.get_dict(),
         '_label'                 : "run_pointcharges_ddec",
     }
     # Create the calculation process and launch it
     DdecCalculation = CalculationFactory('ddec')
     process = DdecCalculation.process()
     future  = submit(process, **inputs)
     self.report("pk: {} | Running ddec to compute point charges based on the charge-density")
     return ToContext(ddec_calc=Outputs(future))
コード例 #4
0
    def run_pore_surface(self):

        zeopp_out = self.ctx.zeopp

        label = "pore_surface"
        inputs = {}
        inputs['_label'] = label
        inputs[
            '_description'] = "Subsampling pore surface & formation of supercell"
        inputs['code'] = self.inputs.pore_surface_code
        inputs['parameters'] = get_pore_surface_parameters(
            zeopp_out['output_parameters'])
        inputs['surface_sample'] = zeopp_out['surface_sample_vsa']
        inputs['structure'] = zeopp_out['structure_cssr']
        inputs['_options'] = self.default_options

        PoreSurfaceCalculation = CalculationFactory('phtools.surface')
        future = submit(PoreSurfaceCalculation.process(), **inputs)
        self.report("pk: {} | Submitted pore_surface for structure {}".format(
            future.pid, inputs['structure']))

        return ToContext(**{label: Outputs(future)})
コード例 #5
0
ファイル: process.py プロジェクト: chrisjsewell/aiida_core
    def test_process_type_with_entry_point(self):
        """
        For a process with a registered entry point, the process_type will be its formatted entry point string
        """
        from aiida.orm import CalculationFactory, Code

        code = Code()
        code.set_remote_computer_exec((self.computer, '/bin/true'))
        code.store()

        parameters = ParameterData(dict={})
        template = ParameterData(dict={})
        options = {
            'resources': {
                'num_machines': 1,
                'tot_num_mpiprocs': 1
            },
            'max_wallclock_seconds': 1,
        }

        inputs = {
            'code': code,
            'parameters': parameters,
            'template': template,
            'options': options,
        }

        entry_point = 'simpleplugins.templatereplacer'
        calculation = CalculationFactory(entry_point)
        job_process = calculation.process()
        process = job_process(inputs=inputs)

        expected_process_type = 'aiida.calculations:{}'.format(entry_point)
        self.assertEqual(process.calc.process_type, expected_process_type)

        # Verify that load_process_class on the calculation node returns the original entry point class
        recovered_process = process.calc.load_process_class()
        self.assertEqual(recovered_process, calculation)
コード例 #6
0
    def run_rips_complex(self):
        distance_matrix_out = self.ctx.distance_matrix

        label = "rips_complex"
        inputs = {}
        inputs['_label'] = label
        inputs[
            '_description'] = "Computing the distance matrix for surface point cloud"
        inputs['code'] = self.inputs.rips_code
        #inputs['distance_matrix'] = distance_matrix_out['distance_matrix']
        inputs['remote_folder'] = distance_matrix_out['remote_folder']

        Parameters = DataFactory('gudhi.rdm')
        inputs['parameters'] = Parameters(dict={'max-edge-length': 4.2})
        inputs['_options'] = self.default_options

        RipsDistanceMatrixCalculation = CalculationFactory('gudhi.rdm')
        future = submit(RipsDistanceMatrixCalculation.process(), **inputs)
        self.report(
            "pk: {} | Submitted rips calculation for structure {}".format(
                future.pid, self.inputs.structure.filename))

        return ToContext(**{label: Outputs(future)})
コード例 #7
0
    def run_distance_matrix(self):

        pore_surface_out = self.ctx.pore_surface

        label = "distance_matrix"
        inputs = {}
        inputs['_label'] = label
        inputs[
            '_description'] = "Computing the distance matrix for surface point cloud"
        inputs['code'] = self.inputs.distance_matrix_code
        inputs['surface_sample'] = pore_surface_out['surface_sample']
        inputs['cell'] = pore_surface_out['cell']
        inputs['_options'] = self.default_options

        self.out("pore_surface", pore_surface_out['surface_sample'])

        DistanceMatrixCalculation = CalculationFactory('phtools.dmatrix')
        future = submit(DistanceMatrixCalculation.process(), **inputs)
        self.report(
            "pk: {} | Submitted distance_matrix for structure {}".format(
                future.pid, self.inputs.structure.filename))

        return ToContext(**{label: Outputs(future)})
コード例 #8
0
         "MoleculeName"                  : "methane",
         "MoleculeDefinition"            : "TraPPE",
         "MolFraction"                   : 1.0,
         "TranslationProbability"        : 1.0,
         "RotationProbability"           : 1.0,
         "ReinsertionProbability"        : 1.0,
         "SwapProbability"               : 1.0,
         "CreateNumberOfMolecules"       : 0,
    }],
})

# Calculation resources
options = {
    "resources": {
        "num_machines": 1,                 # run on 1 node
        "tot_num_mpiprocs": 1,             # use 1 process
        "num_mpiprocs_per_machine": 1,
    },
    "max_wallclock_seconds": 1 * 60 * 60,  # 1h walltime
    "max_memory_kb": 2000000,              # 2GB memory
    "queue_name": "molsim",                # slurm partition to use
    "withmpi": False,                      # we run in serial mode
}

submit(RaspaCalculation.process(),
    code=test_and_get_code("raspa@bazis", expected_code_type='raspa'),
    structure=load_node("<uuid>"),
    parameters=parameters,
    _options=options
)
コード例 #9
0
def generate_qe_params(structure, settings, pressure=0.0, type=None):
    """
    Generate the input parameters needed to run a calculation for PW (Quantum Espresso)

    :param structure:  StructureData object containing the crystal structure
    :param machine:  ParametersData object containing a dictionary with the computational resources information
    :param settings:  ParametersData object containing a dictionary with the INCAR parameters
    :return: Calculation process object, input dictionary
    """

    try:
        code = settings.dict.code[type]
    except:
        code = settings.dict.code

    plugin = Code.get_from_string(code).get_attr('input_plugin')
    PwCalculation = CalculationFactory(plugin)
    inputs = PwCalculation.process().get_inputs_template()

    # code
    inputs.code = Code.get_from_string(code)

    # structure
    inputs.structure = structure

    # machine
    inputs._options.resources = settings.dict.machine['resources']
    inputs._options.max_wallclock_seconds = settings.dict.machine[
        'max_wallclock_seconds']

    # Parameters
    parameters = dict(settings.dict.parameters)

    parameters['CONTROL'] = {'calculation': 'scf'}

    if type == 'optimize':
        parameters['CONTROL'].update({
            'calculation': 'vc-relax',
            'tstress': True,
            'tprnfor': True,
            'etot_conv_thr': 1.e-8,
            'forc_conv_thr': 1.e-8
        })
        parameters['CELL'] = {
            'press': pressure,
            'press_conv_thr': 1.e-3,
            'cell_dynamics': 'bfgs',  # Quasi-Newton algorithm
            #   'cell_dofree': 'all'
        }  # Degrees of movement
        parameters['IONS'] = {'ion_dynamics': 'bfgs', 'ion_nstepe': 10}

    if type == 'forces':
        parameters['CONTROL'].update({
            'tstress': True,
            'tprnfor': True,
            'etot_conv_thr': 1.e-8,
            'forc_conv_thr': 1.e-8
        })

    if type == 'born_charges':  # in development (not really usable)
        parameters['CONTROL'].update({
            'tstress': True,
            'tprnfor': True,
            'etot_conv_thr': 1.e-8,
            'forc_conv_thr': 1.e-8
        })

        #parameters['INPUTPH'] = {'epsil': True,
        #                         'zeu': True}  # Degrees of movement

    inputs.parameters = ParameterData(dict=parameters)

    # Kpoints
    kpoints = KpointsData()
    kpoints.set_cell_from_structure(structure)
    kpoints.set_kpoints_mesh_from_density(settings.dict.kpoints_density)

    inputs.kpoints = kpoints

    inputs.pseudo = get_pseudos_qe(structure, settings.dict.pseudos_family)

    return PwCalculation.process(), inputs
コード例 #10
0
def generate_vasp_params(structure, settings, type=None, pressure=0.0):
    """
    Generate the input paramemeters needed to run a calculation for VASP

    :param structure:  StructureData object containing the crystal structure
    :param settings:  ParametersData object containing a dictionary with the INCAR parameters
    :return: Calculation process object, input dictionary
    """
    try:
        code = settings.dict.code[type]
    except:
        code = settings.dict.code

    plugin = Code.get_from_string(code).get_attr('input_plugin')

    VaspCalculation = CalculationFactory(plugin)

    inputs = VaspCalculation.process().get_inputs_template()

    # code
    inputs.code = Code.get_from_string(code)

    # structure
    inputs.structure = structure

    # machine
    inputs._options.resources = settings.dict.machine['resources']
    inputs._options.max_wallclock_seconds = settings.dict.machine[
        'max_wallclock_seconds']
    # inputs._options._parser_name = 'vasp.pymatgen'
    # Use for all the set functions in calculation.
    # inputs._options = dict(inputs._options)
    # inputs._options['_parser_name'] = 'vasp.pymatgen'

    # INCAR (parameters)
    incar = dict(settings.dict.parameters)

    if type == 'optimize':
        incar.update({
            'PREC': 'Accurate',
            'ISTART': 0,
            'IBRION': 2,
            'ISIF': 3,
            'LWAVE': '.FALSE.',
            'LCHARG': '.FALSE.',
            'EDIFF': -1e-08,
            'EDIFFG': -1e-08,
            'ADDGRID': '.TRUE.',
            'LREAL': '.FALSE.',
            'PSTRESS': pressure
        })  # unit: kb -> kB

        if not 'NSW' in incar:
            incar.update({'NSW': 100})

    elif type == 'optimize_constant_volume':
        incar.update({
            'PREC': 'Accurate',
            'ISTART': 0,
            'IBRION': 2,
            'ISIF': 4,
            'NSW': 100,
            'LWAVE': '.FALSE.',
            'LCHARG': '.FALSE.',
            'EDIFF': 1e-08,
            'EDIFFG': -1e-08,
            'ADDGRID': '.TRUE.',
            'LREAL': '.FALSE.'
        })

    elif type == 'forces':
        incar.update({
            'PREC': 'Accurate',
            'ISYM': 0,
            'ISTART': 0,
            'IBRION': -1,
            'NSW': 1,
            'LWAVE': '.FALSE.',
            'LCHARG': '.FALSE.',
            'EDIFF': 1e-08,
            'ADDGRID': '.TRUE.',
            'LREAL': '.FALSE.'
        })

    elif type == 'born_charges':
        incar.update({
            'PREC': 'Accurate',
            'LEPSILON': '.TRUE.',
            'ISTART': 0,
            'IBRION': 1,
            'NSW': 0,
            'LWAVE': '.FALSE.',
            'LCHARG': '.FALSE.',
            'EDIFF': 1e-08,
            'ADDGRID': '.TRUE.',
            'LREAL': '.FALSE.'
        })

    inputs.parameters = ParameterData(dict=incar)

    # POTCAR (pseudo potentials)
    inputs.paw = get_pseudos_vasp(structure,
                                  settings.dict.pseudos_family,
                                  folder_path=settings.dict.family_folder)

    # KPOINTS
    kpoints = KpointsData()
    kpoints.set_cell_from_structure(structure)

    if 'kpoints_density' in settings.get_dict():
        kpoints.set_kpoints_mesh_from_density(settings.dict.kpoints_density)

    elif 'kpoints_mesh' in settings.get_dict():
        if 'kpoints_offset' in settings.get_dict():
            kpoints_offset = settings.dict.kpoints_offset
        else:
            kpoints_offset = [0.0, 0.0, 0.0]

        kpoints.set_kpoints_mesh(settings.dict.kpoints_mesh,
                                 offset=kpoints_offset)
    else:
        raise InputValidationError(
            'no kpoint definition in input. Define either kpoints_density or kpoints_mesh'
        )

    inputs.kpoints = kpoints

    return VaspCalculation.process(), inputs
コード例 #11
0
def test_bands(siesta_develop):
    """Test workfunction runs and outputs results in serial mode."""
    from aiida.orm import Code, DataFactory, CalculationFactory
    from aiida.orm.data.base import Float, Str

    SiestaCalculation = CalculationFactory('siesta.siesta')
    PsfData = DataFactory('siesta.psf')
    StructureData = DataFactory('structure')
    ParameterData = DataFactory('parameter')
    KpointsData = DataFactory('array.kpoints')

    codename = 'siesta@develop'
    code = Code.get_from_string(codename)

    inputs = SiestaCalculation.process().get_inputs_template()
    inputs.code = code
    inputs._options.resources = {
        "num_machines": 1,
        "num_mpiprocs_per_machine": 1,
    }
    inputs._options.max_wallclock_seconds = 30 * 60

    # Define MgO structure
    alat = 4.117  # MgO lattice constant, Angstroms
    cell = create_FCC_structure(alat)  # Creating MgO FCC-cell
    structure = StructureData(cell=cell)  # Creating structure from cell
    # Placing basis atoms
    structure.append_atom(position=(0.000 * alat, 0.000 * alat, 0.000 * alat),
                          symbols=['Mg'])
    structure.append_atom(position=(0.500 * alat, 0.500 * alat, 0.500 * alat),
                          symbols=['O'])
    inputs.structure = structure

    # Pseudopotentials
    # from aiida_siesta.data.psf import get_pseudos_from_structure
    # inputs.pseudo = get_pseudos_from_structure(structure, "test_psf_family")
    raw_pseudos = [
        ("Mg.psf", 'Mg'),
        ("O.psf", 'O'),
    ]
    pseudo_dict = {}
    for fname, kind in raw_pseudos:
        absname = os.path.realpath(
            os.path.join(os.path.dirname(__file__), '..', 'pseudos', fname))
        pseudo, created = PsfData.get_or_create(absname, use_first=True)

        if created:
            print "Created the pseudo for {}".format(kind)
        else:
            print "Using the pseudo for {} from DB: {}".format(kind, pseudo.pk)
        # Attach pseudo node to the calculation
        pseudo_dict[kind] = pseudo

    inputs.pseudo = pseudo_dict

    # K-points mesh
    kpoints_mesh = KpointsData()
    kpoints_mesh.set_kpoints_mesh([6, 6, 6], [0.5, 0.5, 0.5])
    inputs.kpoints = kpoints_mesh

    # Bands' k-points
    bandskpoints = KpointsData()
    bandskpoints.set_cell(structure.cell, structure.pbc)
    bandskpoints.set_kpoints_path([
        ('K', 'G', 39),
        ('G', 'X', 37),
        ('X', 'W', 19),
        ('W', 'L', 27),
        ('L', 'G', 32),
    ])
    inputs.bandskpoints = bandskpoints

    # Calculation parameters
    parameters = ParameterData(
        dict={
            'xc-functional': 'LDA',
            'xc-authors': 'CA',
            'spin-polarized': False,
            'meshcutoff': '200 Ry',
            'max-scfiterations': 50,
            'xml-write': True,
        })
    inputs.parameters = parameters

    # Create and run Siesta calculation process
    from aiida.work.run import run

    JobCalc = SiestaCalculation.process()
    result = run(JobCalc, **inputs)

    assert result['bands_array'] is not None
コード例 #12
0
def generate_phonopy_params(structure,
                            ph_settings,
                            force_sets=None,
                            force_constants=None,
                            nac_data=None,
                            bands=None):
    """
    Generate inputs parameters needed to do a remote phonopy calculation

    :param structure: StructureData Object that constains the crystal structure unit cell
    :param ph_settings: ParametersData object containing a dictionary with the phonopy input data
    :param force_sets: ForceSetssData object containing the atomic forces and displacement information
    :return: Calculation process object, input dictionary
    """

    try:
        code = Code.get_from_string(ph_settings.dict.code['fc2'])
    except:
        code = Code.get_from_string(ph_settings.dict.code)

    plugin = code.get_attr('input_plugin')
    PhonopyCalculation = CalculationFactory(plugin)

    # The inputs
    inputs = PhonopyCalculation.process().get_inputs_template()

    # code
    inputs.code = code

    # structure
    inputs.structure = structure

    # parameters
    inputs.parameters = ph_settings

    # resources
    inputs._options.resources = ph_settings.dict.machine['resources']
    inputs._options.max_wallclock_seconds = ph_settings.dict.machine[
        'max_wallclock_seconds']

    # data_sets
    inputs.data_sets = force_sets

    # data_sets
    if force_sets is not None:
        inputs.data_sets = force_sets

    # force constants
    if force_constants is not None:
        inputs.force_constants = force_constants

    # non-analytical corrections
    if nac_data is not None:
        inputs.nac_data = nac_data

    # bands
    if bands is not None:
        inputs.bands = bands

    if force_constants is None and force_sets is None:
        Exception('Either force sets or force constants must be set!')

    return PhonopyCalculation.process(), inputs
コード例 #13
0
class TestProcessBuilder(AiidaTestCase):
    def setUp(self):
        super(TestProcessBuilder, self).setUp()
        self.assertIsNone(Process.current())
        self.calculation_class = CalculationFactory(
            'simpleplugins.templatereplacer')
        self.process_class = self.calculation_class.process()
        self.builder = self.process_class.get_builder()

    def tearDown(self):
        super(TestProcessBuilder, self).tearDown()
        self.assertIsNone(Process.current())

    def test_process_builder_attributes(self):
        """
        Check that the builder has all the input ports of the process class as attributes
        """
        for name, port in self.process_class.spec().inputs.iteritems():
            self.assertTrue(hasattr(self.builder, name))

    def test_process_builder_set_attributes(self):
        """
        Verify that setting attributes in builder works
        """
        label = 'Test label'
        description = 'Test description'

        self.builder.label = label
        self.builder.description = description

        self.assertEquals(self.builder.label, label)
        self.assertEquals(self.builder.description, description)

    def test_workchain(self):
        """
        Verify that the attributes of the TestWorkChain can be set but defaults are not there
        """
        builder = TestWorkChain.get_builder()
        builder.a = Int(2)
        builder.b = Float(2.3)
        builder.c.d = Bool(True)
        self.assertEquals(builder, {
            'a': Int(2),
            'b': Float(2.3),
            'c': {
                'd': Bool(True)
            }
        })

    def test_invalid_setattr_raises(self):
        """
        Verify that __setattr__ cannot be called on a terminal Port
        """
        builder = TestWorkChain.get_builder()
        with self.assertRaises(AttributeError):
            builder.a.b = 3

    def test_dynamic_getters_value(self):
        """
        Verify that getters will return the actual value
        """
        builder = TestWorkChain.get_builder()
        builder.a = Int(2)
        builder.b = Float(2.3)
        builder.c.d = Bool(True)

        # Verify that the correct type is returned by the getter
        self.assertTrue(isinstance(builder.a, Int))
        self.assertTrue(isinstance(builder.b, Float))
        self.assertTrue(isinstance(builder.c.d, Bool))

        # Verify that the correct value is returned by the getter
        self.assertEquals(builder.a, Int(2))
        self.assertEquals(builder.b, Float(2.3))
        self.assertEquals(builder.c.d, Bool(True))

    def test_dynamic_getters_doc_string(self):
        """
        Verify that getters have the correct docstring
        """
        builder = TestWorkChain.get_builder()
        self.assertEquals(builder.__class__.a.__doc__,
                          str(TestWorkChain.spec().inputs['a']))
        self.assertEquals(builder.__class__.b.__doc__,
                          str(TestWorkChain.spec().inputs['b']))
        self.assertEquals(builder.__class__.c.__doc__,
                          str(TestWorkChain.spec().inputs['c']))
        self.assertEquals(builder.c.__class__.d.__doc__,
                          str(TestWorkChain.spec().inputs['c']['d']))

    def test_code_get_builder(self):
        """
        Test that the get_builder method of Code returns a builder
        where the code is already set.
        """
        from aiida.orm import Code

        code1 = Code()
        # This also sets the code as a remote code
        code1.set_remote_computer_exec((self.computer, '/bin/true'))
        code1.label = 'test_code1'
        code1.set_input_plugin_name('simpleplugins.templatereplacer')
        code1.store()

        # Check that I can get a builder
        builder = code1.get_builder()
        self.assertEquals(builder.code.pk, code1.pk)

        # Check that I can set the parameters
        builder.parameters = ParameterData(dict={})

        # Check that it complains for an unknown input
        with self.assertRaises(AttributeError):
            builder.unknown_parameter = 3

        # Check that it complains if the type is not the correct one
        # (for the simpleplugins.templatereplacer, it should be a
        # ParameterData)
        with self.assertRaises(ValueError):
            builder.parameters = Int(3)
コード例 #14
0
ファイル: base.py プロジェクト: wes-amat/aiida-vasp
def get_vasp_proc():
    vasp_cls = CalculationFactory('vasp.vasp')
    if builder_interface(vasp_cls):
        return vasp_cls
    return vasp_cls.process()
コード例 #15
0
def generate_phono3py_params(structure,
                             parameters,
                             force_sets,
                             nac_data=None,
                             fc2=None,
                             fc3=None,
                             grid_point=None,
                             grid_data=None):
    """
    Generate inputs parameters needed to do a remote phonopy calculation

    :param structure: StructureData Object that constains the crystal structure unit cell
    :param parameters: ParametersData object containing a dictionary with the phonopy input data
    :param force_sets: ForceSetsData object containing the atomic forces and displacement information
    :param nac_data: NacData object containing the dielectric tensor and Born effective charges info
    :param fc2: ForceConstantsData object containing the 2nd order force constants
    :param fc3: ForceConstantsData object containing the 3rd order force constants
    :param grid_point: List containing the grid points to calculate (in distributed calculation)
    :return: Calculation process object, input dictionary
    """

    try:
        code = Code.get_from_string(parameters.dict.code['fc3'])
    except:
        code = Code.get_from_string(parameters.dict.code)

    plugin = code.get_attr('input_plugin')
    PhonopyCalculation = CalculationFactory(plugin)

    # The inputs
    inputs = PhonopyCalculation.process().get_inputs_template()

    # code
    inputs.code = code

    # structure
    inputs.structure = structure

    # Parameters
    if grid_point is not None:
        parameters_dic = parameters.get_dict()
        parameters_dic.update({'grid_point': np.array(grid_point).tolist()})
        parameters = ParameterData(dict=parameters_dic)

    if grid_data is not None:
        inputs.grid_data = grid_data

    inputs.parameters = parameters

    # resources
    inputs._options.resources = parameters.dict.machine['resources']
    inputs._options.max_wallclock_seconds = parameters.dict.machine[
        'max_wallclock_seconds']

    # data_sets & force constants
    if force_sets is not None:
        inputs.data_sets = force_sets
    if fc2 is not None:
        inputs.force_constants = fc2
    if fc3 is not None:
        inputs.force_constants_3 = fc3

    # non-analytical corrections
    if nac_data is not None:
        inputs.nac_data = nac_data

    return PhonopyCalculation.process(), inputs
コード例 #16
0
def run_eos(structure,
            element="Si",
            code='qe-pw-6.2.1@localhost',
            pseudo_family='GBRV_lda'):
    return run(PressureConvergence,
               structure=structure,
               code=Str(code),
               pseudo_family=Str(pseudo_family),
               volume_tolerance=Float(0.1))


# Set up the factories
ParameterData = DataFactory("parameter")
KpointsData = DataFactory("array.kpoints")
PwProcess = PwCalculation.process()


def get_first_deriv(stress):
    """
    Return the energy first derivative from the stress
    """
    from numpy import trace
    # Get the pressure (GPa)
    p = trace(stress) / 3.
    # Pressure is -dE/dV; moreover p in kbar, we need to convert
    # it to eV/angstrom^3 to be consisten
    dE = -p * GPa_to_eV_over_ang3
    return dE

コード例 #17
0
options = {
	'resources': {
		'num_machines': 1,
		'tot_num_mpiprocs': 1,
	},
	'max_wallclock_seconds': 1800,
}

kpoints = KpointsData()
kpoints.set_kpoints_mesh([1, 1, 1])

inputs = {
	'code': Code.get_from_string('VASP.5.4.4@Raichu'),
	'structure': load_node(888),
	'kpoints': kpoints,
	'parameters': ParameterData(dict={}),
	'settings': ParameterData(dict={}),
	'pseudo_family': Str('vasp-pbe'),
        'options' : ParameterData( dict = { 
                      'max_wallclock_seconds' : 3600,
                      'max_memory_kb': 10000000,
                      'resources' : { 'num_machines': 1
                                    },
                    }),
        'max_iterations' : Int(1),
}

process = VaspCalculation.process()
# running = run(process, **inputs)
running = run(VASPBaseWorkchain, **inputs)