def convention_sodium_chloride(supercell_coefficients, named_result): fname = '../' + cubic.conventional_fcc_cifs['sodium_chloride'].file crystal = cif_parser_wrapper( fname, is_primitive_cell=False, fractional=True, bravais=get_supercell_bravais(supercell_coefficients), supercell_coefficients=supercell_coefficients) options = 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')), ('potential_type', Set(xtb_potential_str(potential_type)))]) assertions = { PotentialType.TRUNCATED: OrderedDict([("n_iter", SetAssert(0)), ("energy", SetAssert(0, 0))]), PotentialType.FULL: OrderedDict([("n_iter", SetAssert(0, 0)), ("energy", SetAssert(0, 0))]) } return xtb_input_string_cleaner(crystal=crystal, options=options, assertions=assertions[potential_type], named_result=named_result)
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
def sio2_zeolite_gamma_point(named_result='SiO2') -> str: """ BCC structure :param named_result: named result string :return: Input for testing translational invariance """ fname = '../' + cubic.bcc_cifs['sio2'].file crystal = cif_parser_wrapper(fname) assert crystal['bravais'] == 'bcc', "crystal not simple cubic" arbitrary_shifts = [0., 0.1, 0.2, 0.24, 0.25] options = OrderedDict([ ('h0_cutoff', Set(60, 'bohr')), ('overlap_cutoff', Set(60, 'bohr')), ('repulsive_cutoff', Set(60, 'bohr')), ('dispersion_cutoff', Set(60, 'bohr')), ('ewald_real_cutoff', Set(60, 'bohr')), ('ewald_reciprocal_cutoff', Set(1)), ('ewald_alpha', Set(0.5)), ('potential_type', Set(xtb_potential_str(potential_type))), ]) assertions = { PotentialType.TRUNCATED: OrderedDict([("n_iter", SetAssert(14)), ("energy", SetAssert(-69.074350228, 5.e-6))]), PotentialType.FULL: OrderedDict([("n_iter", SetAssert(0, 0)), ("energy", SetAssert(0, 0))]) } comments = ['! Fractional shift of '] * len(arbitrary_shifts) return translation_string(crystal, options, assertions[potential_type], arbitrary_shifts, named_result, comments=[x + str(arbitrary_shifts[i]) for i, x in enumerate(comments)])
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
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
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
def primitive_silicon(named_result='primitive_cell_si') -> str: """ Primitive silicon Note, this will likely give slightly difference results to using cubic.silicon, which (probably) has a slightly different lattice parameter :param named_result: named_result :return: input string """ fname = '../' + cubic.conventional_fcc_cifs['silicon'].file crystal = cif_parser_wrapper(fname, is_primitive_cell=True, fractional=True, bravais='fcc') assert crystal['n_atoms'] == 2, "Expect 2-atom basis for primitive si" options = 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([2, 2, 2])), ('potential_type', Set(xtb_potential_str(potential_type)))]) assertions = { PotentialType.TRUNCATED: OrderedDict([("n_iter", SetAssert(0)), ("energy", SetAssert(0, 1.e-6))]), PotentialType.FULL: OrderedDict([("n_iter", SetAssert(0)), ("energy", SetAssert(0, 0))]) } return qcore_input.xtb_input_string_cleaner( crystal=crystal, options=options, assertions=assertions[potential_type], named_result=named_result)
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
def conventional_silicon(named_result='conventional_cell_si'): fname = '../' + cubic.conventional_fcc_cifs['silicon'].file crystal = cif_parser_wrapper(fname, is_primitive_cell=False, fractional=True, bravais='cubic') assert crystal['n_atoms'] == 8, "Expect 8-atom basis for primitive si" options = 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([2, 2, 2])), ('potential_type', Set(xtb_potential_str(potential_type)))]) return qcore_input.xtb_input_string_cleaner(crystal=crystal, options=options, named_result=named_result)
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
def sio2_zeolite(named_result='SiO2') -> str: """ BCC structure :param named_result: named result string :return: Input for testing translational invariance """ fname = '../' + cubic.bcc_cifs['sio2'].file crystal = cif_parser_wrapper(fname) assert crystal['bravais'] == 'bcc', "crystal not simple cubic" arbitrary_shift = 0.1 options = 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(1)), ('ewald_alpha', Set(0.5)), ('monkhorst_pack', Set([2, 2, 2])), ('potential_type', Set(xtb_potential_str(potential_type))), ]) assertions = { PotentialType.TRUNCATED: OrderedDict([("n_iter", SetAssert(14)), ("energy", SetAssert(-69.074163659, 1.e-6))]), PotentialType.FULL: OrderedDict([("n_iter", SetAssert(0, 0)), ("energy", SetAssert(0, 0))]) } comments = '! Fractional shift of 0.1' return translation_string(crystal, options, assertions[potential_type], arbitrary_shift, named_result, comments=comments)
def nickel_triphosphide(named_result='nickel_triphosphide') -> str: """ BCC Won't converge with these settings :param named_result: named result string :return: Input for testing symmetry reduction of MP grid """ fname = '../' + cubic.bcc_cifs[named_result].file crystal = cif_parser_wrapper(fname) assert crystal['bravais'] == 'bcc', "crystal not bcc" options = 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([2, 2, 2])), ('symmetry_reduction', Set(True)), ('temperature', Set(0, 'kelvin')), ('potential_type', Set(xtb_potential_str(potential_type)))]) assertions = { PotentialType.TRUNCATED: OrderedDict([("n_iter", SetAssert(0)), ("energy", SetAssert(0, 1.e-6))]), PotentialType.FULL: OrderedDict([("n_iter", SetAssert(0)), ("energy", SetAssert(0, 0))]) } return xtb_symmetry_test_string( crystal=crystal, options=options, assertions=assertions[PotentialType.TRUNCATED], named_result=named_result)