How to use the smact.builder function in SMACT

To help you get started, we’ve selected a few SMACT examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github WMD-group / SMACT / tests / Example_surfaces.py View on Github external
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)
github WMD-group / SMACT / tests / Example_distort.py View on Github external
# 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")
github WMD-group / SMACT / examples / CationMutation / cation_mutation.py View on Github external
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)
github WMD-group / SMACT / examples / cation_mutation.py View on Github external
# Example script using distorter, generate all possible 
# (symmetry inequivalent) substitutions 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

# Build the input
smact_lattice, test_case = builder.cubic_perovskite(['Ba','Ti','O'],[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]
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")