コード例 #1
0
def alpha_N2(named_result='alpha_N2'):
    """
    Simple cubic example
    No charge transfer => Trivial to converge
    """
    fname = '../' + cubic.cubic_cifs['alpha-N2'].file
    crystal = cif_parser_wrapper(fname)
    settings = collections.OrderedDict([('h0_cutoff', Set(40, 'bohr')),
                                        ('overlap_cutoff', Set(40, 'bohr')),
                                        ('repulsive_cutoff', Set(40, 'bohr')),
                                        ('ewald_real_cutoff', Set(40, 'bohr')),
                                        ('ewald_reciprocal_cutoff', Set(10)),
                                        ('ewald_alpha', Set(0.5)),
                                        ('monkhorst_pack', Set([2, 2, 2])),
                                        ('symmetry_reduction', Set(True)),
                                        ('temperature', Set(0, 'kelvin'))])

    xtb_potential = collections.OrderedDict([
        ('potential_type', Set('truncated')),
        ('smoothing_range', Set(1, 'bohr'))
    ])

    sub_commands = collections.OrderedDict([('xtb_potential', xtb_potential)])

    input_string = qcore_input.xtb_input_string(crystal,
                                                settings=settings,
                                                sub_commands=sub_commands,
                                                named_result=named_result)
    return input_string
コード例 #2
0
def primitive_anatase(named_result='primitive_anatase'):
    """
    Anatase primitive unit cell

    SCC takes 26 iterations vs 11 SCF

    :param named_result: named result
    :return:
    """
    crystal = tetragonal.tio2_anatase()

    settings = collections.OrderedDict([('h0_cutoff', Set(40, 'bohr')),
                                        ('overlap_cutoff', Set(40, 'bohr')),
                                        ('repulsive_cutoff', Set(40, 'bohr')),
                                        ('ewald_real_cutoff', Set(40, 'bohr')),
                                        ('ewald_reciprocal_cutoff', Set(10)),
                                        ('ewald_alpha', Set(0.5)),
                                        ('monkhorst_pack', Set([2, 2, 2])),
                                        ('symmetry_reduction', Set(False)),
                                        ('temperature', Set(0, 'kelvin'))])

    xtb_potential = collections.OrderedDict([
        ('potential_type', Set('truncated')),
        ('smoothing_range', Set(1, 'bohr'))
    ])

    sub_commands = collections.OrderedDict([('xtb_potential', xtb_potential)])

    input_string = qcore_input.xtb_input_string(crystal,
                                                settings=settings,
                                                sub_commands=sub_commands,
                                                named_result=named_result)
    return input_string
コード例 #3
0
def convention_sodium_chloride(named_result, ewald):
    fname = '../' + cubic.conventional_fcc_cifs['sodium_chloride'].file
    crystal = cif_parser_wrapper(fname, is_primitive_cell=False, fractional=True, bravais='cubic')
    settings = collections.OrderedDict([
        ('h0_cutoff',               Set(40, 'bohr')),
        ('overlap_cutoff',          Set(40, 'bohr')),
        ('repulsive_cutoff',        Set(40, 'bohr')),
        ('ewald_real_cutoff',       Set(ewald['real'], 'bohr')),
        ('ewald_reciprocal_cutoff', Set(ewald['reciprocal'])),
        ('ewald_alpha',             Set(ewald['alpha'])),
        ('monkhorst_pack',          Set([4, 4, 4])),
        ('symmetry_reduction',      Set(True)),
        ('temperature',             Set(0, 'kelvin'))
    ])

    input_string = qcore_input.xtb_input_string(crystal, settings, named_result=named_result)
    return input_string
コード例 #4
0
def magnesium_oxide():
    file_name = '../' + cubic.conventional_fcc_cifs['magnesium_oxide'].file
    crystal = cif_parser_wrapper(file_name,
                                 fractional=True,
                                 is_primitive_cell=False,
                                 bravais='cubic')

    unit = get_position_unit(crystal)
    lattice_constant_factors = np.linspace(0.8, 1.2, 21, endpoint=True)
    lattice_constants = cubic_lattice_constants(crystal,
                                                lattice_constant_factors)

    named_result = 'mgo_volume'
    settings = collections.OrderedDict([
        ('h0_cutoff', Set(40, 'bohr')),
        ('overlap_cutoff', Set(40, 'bohr')),
        ('repulsive_cutoff', Set(40, 'bohr')),
        # Ewald setting for hard-cutoff of potential at 30 bohr
        ('ewald_real_cutoff', Set(40, 'bohr')),
        # Converged w.r.t. real-space value
        ('ewald_reciprocal_cutoff', Set(10)),
        ('ewald_alpha', Set(0.5)),
        ('monkhorst_pack', Set([2, 2, 2])),
        ('symmetry_reduction', Set(True)),
        ('temperature', Set(0, 'kelvin')),
        ('solver', Set('SCC'))
    ])

    total_energies = np.zeros(shape=(lattice_constant_factors.size))
    for i, al in enumerate(lattice_constants):
        lattice_factor = lattice_constant_factors[i]
        crystal['lattice_parameters']['a'] = Set(al, unit)
        input_string = qcore_input.xtb_input_string(crystal,
                                                    settings,
                                                    named_result=named_result)
        output = run_qcore(input_string)
        if not output:
            print('No result:', lattice_factor)
        else:
            total_energies[i] = output[named_result]['energy']
            # 4.19 ang is exp. See "Ab initio determination of the bulk properties of Mgo"
            print(lattice_factor, al, output[named_result]['energy'])

    return lattice_constant_factors, total_energies
コード例 #5
0
def primitive_sodium_chloride():

    named_result = 'primitive_nacl'
    fname = '../' + cubic.fcc_cifs['sodium_chloride'].file
    crystal = cif_parser_wrapper(fname,  is_primitive_cell=True, fractional=True)
    settings = collections.OrderedDict([
        ('h0_cutoff',               Set(40, 'bohr')),
        ('overlap_cutoff',          Set(40, 'bohr')),
        ('repulsive_cutoff',        Set(40, 'bohr')),
        ('ewald_real_cutoff',       Set(10, 'bohr')),
        ('ewald_reciprocal_cutoff', Set(1)),
        ('ewald_alpha',             Set(0.5)),
        ('monkhorst_pack',          Set([4, 4, 4])),
        ('symmetry_reduction',      Set(True)),
        ('temperature',             Set(0, 'kelvin'))
    ])

    input_string = qcore_input.xtb_input_string(crystal, settings, named_result=named_result)
    return input_string
コード例 #6
0
def primitive_potassium(named_result='primitive_potassium'):
    """
    BCC Example

    Notes:
    Converges but with this warning
    warning: solve(): system seems singular (rcond: 4.98607e-17);
    attempting approx solution
    13         7.217892848     -5.61e-12      5.55e-17        0.13

    SCF takes ~ 35 iterations => SCC faster
    symmetry reduction works

    :param named_result: named result
    :return:
    """
    fname = '../' + cubic.bcc_cifs['potassium'].file
    crystal = cif_parser_wrapper(fname)

    settings = collections.OrderedDict([('h0_cutoff', Set(40, 'bohr')),
                                        ('overlap_cutoff', Set(40, 'bohr')),
                                        ('repulsive_cutoff', Set(40, 'bohr')),
                                        ('ewald_real_cutoff', Set(40, 'bohr')),
                                        ('ewald_reciprocal_cutoff', Set(10)),
                                        ('ewald_alpha', Set(0.5)),
                                        ('monkhorst_pack', Set([2, 2, 2])),
                                        ('symmetry_reduction', Set(True)),
                                        ('temperature', Set(0, 'kelvin')),
                                        ('solver', Set('SCC'))])

    xtb_potential = collections.OrderedDict([
        ('potential_type', Set('truncated')),
        ('smoothing_range', Set(1, 'bohr'))
    ])

    sub_commands = collections.OrderedDict([('xtb_potential', xtb_potential)])

    input_string = qcore_input.xtb_input_string(crystal,
                                                settings=settings,
                                                sub_commands=sub_commands,
                                                named_result=named_result)
    return input_string
コード例 #7
0
ファイル: crystals.py プロジェクト: AlexBuccheri/QcoreUtils
def conventional_copper():

    named_result = 'conventional_copper'
    fname = '../' + cubic.conventional_fcc_cifs['copper'].file
    crystal = cif_parser_wrapper(fname,
                                 is_primitive_cell=False,
                                 fractional=True,
                                 bravais='cubic')
    settings = OrderedDict([('h0_cutoff', Set(40, 'bohr')),
                            ('overlap_cutoff', Set(40, 'bohr')),
                            ('repulsive_cutoff', Set(40, 'bohr')),
                            ('ewald_real_cutoff', Set(10, 'bohr')),
                            ('ewald_reciprocal_cutoff', Set(1)),
                            ('ewald_alpha', Set(0.5)),
                            ('monkhorst_pack', Set([4, 4, 4])),
                            ('symmetry_reduction', Set(False)),
                            ('temperature', Set(0, 'kelvin'))])

    input_string = qcore_input.xtb_input_string(crystal,
                                                settings,
                                                named_result=named_result)
    return input_string