import ase from ase.io import * import smact.builder as build import smact.surface as surface PbZrO = build.cubic_perovskite(['Pb', 'Zr', 'O']) S100 = surface.cut100(PbZrO) S110 = surface.cut110(PbZrO) S111 = surface.cut111(PbZrO) write('100.cif', S100) write('110.cif', S110) write('111.cif', S111) write('Bulk.cif', PbZrO)
def pretty_print_atoms(atoms, linewrap=15): entries = [ "{0:5.3f} {1:5.3f} {2:5.3f} {symbol}".format(*position, symbol=symbol) for position, symbol in zip(atoms.get_positions(), atoms.get_chemical_symbols()) ] for output_i in range(linewrap): line = "" for i, entry in enumerate(entries): if output_i == i % linewrap: line = line + entry + "\t" print line # Build the input smact_lattice, test_case = builder.cubic_perovskite(["Ba", "Ti", "O"], repetitions=[2, 2, 2]) hlinewidth = 68 print ("-" * hlinewidth) print "Original coordinates: " pretty_print_atoms(test_case) print ("-" * hlinewidth) # Do the single substitution first, it is trivial as all Ba # sites are equivalent we will choose the first Ba subs_site = [0.0, 0.0, 0.0] single_substitution = distort.make_substitution(test_case, subs_site, "Sr") print "Single: " pretty_print_atoms(single_substitution)
entries = [ "{0:5.3f} {1:5.3f} {2:5.3f} {symbol}".format(*position, symbol=symbol) for position, symbol in zip(atoms.get_positions(), atoms.get_chemical_symbols()) ] for output_i in range(linewrap): line = '' for i, entry in enumerate(entries): if (output_i == i % linewrap): line = line + entry + '\t' print line # Build the input smact_lattice, test_case = builder.cubic_perovskite(['Ba', 'Ti', 'O'], repetitions=[2, 2, 2]) hlinewidth = 68 print('-' * hlinewidth) print "Original coordinates: " pretty_print_atoms(test_case) print('-' * hlinewidth) # Do the single substitution first, it is trivial as all Ba # sites are equivalent we will choose the first Ba subs_site = [0.0, 0.0, 0.0] single_substitution = distort.make_substitution(test_case, subs_site, "Sr") print "Single: " pretty_print_atoms(single_substitution)
# Example script of using distorter, generate all possible (symmetry inequivalent) subsitiutions of Sr on Ba # sites; single and double substitutions. import ase import smact.builder as builder import smact.distorter as distort import numpy as np import ase.io as io # Build the input test_case = builder.cubic_perovskite(['Ba','Ti','O'],repetitions=[2,2,2]) print "------------------------------" print "Original coordinates: ", test_case print "------------------------------" # Do the single substitution first, it is trivial as all Ba sites are equivalent we will choose the first Ba subs_site = [0.0, 0.0, 0.0] # Fractional coordinates of the site to substitute single_substitution = distort.make_substitution(test_case,subs_site,"Sr") print "Single: ", single_substitution #Build a sub-lattice you wish to disorder [test case do the Ba sub-lattice] sub_lattice = distort.build_sub_lattice(single_substitution,"Ba") # Enumerate the inequivalent sites inequivalent_sites = distort.get_inequivalent_sites(sub_lattice,single_substitution)