def makeatoms(self, *args):
     "Make the atoms according to the current specification."
     if not self.update_element():
         self.clearatoms()
         self.makeinfo()
         return False
     assert self.legal_element is not None
     struct = self.list_of_structures[self.structure.get_active()]
     if self.needs_2lat[struct]:
         # a and c lattice constants
         lc = {'a': self.lattice_const_a.value,
               'c': self.lattice_const_c.value}
         lc_str = str(lc)
     else:
         lc = self.lattice_const_a.value
         lc_str = "%.5f" % (lc,)
     if self.method.get_active() == 0:
         # Layer-by-layer specification
         surfaces = [x[0] for x in self.direction_table]
         layers = [int(x[1].value) for x in self.direction_table]
         self.atoms = self.factory[struct](self.legal_element, copy(surfaces),
                                           layers, latticeconstant=lc)
         imp = self.import_names[struct]
         self.pybut.python = py_template_layers % {'import': imp,
                                                   'element': self.legal_element,
                                                   'surfaces': str(surfaces),
                                                   'layers': str(layers),
                                                   'latconst': lc_str,
                                                   'factory': imp.split()[-1]
                                                   }
     else:
         # Wulff construction
         assert self.method.get_active() == 1
         surfaces = [x[0] for x in self.direction_table]
         surfaceenergies = [x[2].value for x in self.direction_table]            
         self.update_size_dia()
         if self.round_above.get_active():
             rounding = "above"
         elif self.round_below.get_active():
             rounding = "below"
         elif self.round_closest.get_active():
             rounding = "closest"
         else:
             raise RuntimeError("No rounding!")
         self.atoms = wulff_construction(self.legal_element, surfaces,
                                         surfaceenergies,
                                         self.size_n_adj.value,
                                         self.factory[struct],
                                         rounding, lc)
         self.pybut.python = py_template_wulff % {'element': self.legal_element,
                                                  'surfaces': str(surfaces),
                                                  'energies': str(surfaceenergies),
                                                  'latconst': lc_str,
                                                  'natoms': self.size_n_adj.value,
                                                  'structure': struct,
                                                  'rounding': rounding
                                                   }
     self.makeinfo()
Beispiel #2
0
    def makeatoms(self, *args):
        'Make the atoms according to the current specification.'
        symbol = self.element.symbol
        if symbol is None:
            self.clearatoms()
            self.makeinfo()
            return False
        struct = self.structure.value
        if self.needs_2lat[struct]:
            # a and c lattice constants
            lc = {'a': self.a.value, 'c': self.c.value}
            lc_str = str(lc)
        else:
            lc = self.a.value
            lc_str = '%.5f' % (lc, )
        if self.method.value == 'wulff':
            # Wulff construction
            surfaces = [x[0] for x in self.direction_table]
            surfaceenergies = [
                x[1].value for x in self.direction_table_rows.rows
            ]
            self.update_size_diameter(update=False)
            rounding = self.round_radio.value
            self.atoms = wulff_construction(symbol, surfaces, surfaceenergies,
                                            self.size_natoms.value,
                                            self.factory[struct], rounding, lc)
            python = py_template_wulff % {
                'element': symbol,
                'surfaces': str(surfaces),
                'energies': str(surfaceenergies),
                'latconst': lc_str,
                'natoms': self.size_natoms.value,
                'structure': struct,
                'rounding': rounding
            }
        else:
            # Layer-by-layer specification
            surfaces = [x[0] for x in self.direction_table]
            layers = [x[1].value for x in self.direction_table_rows.rows]
            self.atoms = self.factory[struct](symbol,
                                              copy(surfaces),
                                              layers,
                                              latticeconstant=lc)
            imp = self.import_names[struct]
            python = py_template_layers % {
                'import': imp,
                'element': symbol,
                'surfaces': str(surfaces),
                'layers': str(layers),
                'latconst': lc_str,
                'factory': imp.split()[-1]
            }
        self.makeinfo()

        return python
Beispiel #3
0
    def makeatoms(self, *args):
        'Make the atoms according to the current specification.'
        if not self.element.check():
            self.clearatoms()
            self.makeinfo()
            return False
        struct = self.structure.value
        if self.needs_2lat[struct]:
            # a and c lattice constants
            lc = {'a': self.a.value,
                  'c': self.c.value}
            lc_str = str(lc)
        else:
            lc = self.a.value
            lc_str = '%.5f' % (lc,)
        if self.method.value == 'wulff':
            # Wulff construction
            surfaces = [x[0] for x in self.direction_table]
            surfaceenergies = [x[1].value
                               for x in self.direction_table_rows.rows]
            self.update_size_diameter(update=False)
            rounding = self.round_radio.value
            self.atoms = wulff_construction(self.element.symbol,
                                            surfaces,
                                            surfaceenergies,
                                            self.size_natoms.value,
                                            self.factory[struct],
                                            rounding, lc)
            python = py_template_wulff % {'element': self.element.symbol,
                                          'surfaces': str(surfaces),
                                          'energies': str(surfaceenergies),
                                          'latconst': lc_str,
                                          'natoms': self.size_natoms.value,
                                          'structure': struct,
                                          'rounding': rounding}
        else:
            # Layer-by-layer specification
            surfaces = [x[0] for x in self.direction_table]
            layers = [x[1].value for x in self.direction_table_rows.rows]
            self.atoms = self.factory[struct](self.element.symbol,
                                              copy(surfaces),
                                              layers, latticeconstant=lc)
            imp = self.import_names[struct]
            python = py_template_layers % {'import': imp,
                                           'element': self.element.symbol,
                                           'surfaces': str(surfaces),
                                           'layers': str(layers),
                                           'latconst': lc_str,
                                           'factory': imp.split()[-1]}
        self.makeinfo()

        return python
Beispiel #4
0
def get_scaffold(shape = "ico", i = 3, latticeconstant = 3.0,
    energies = [0.5,0.4,0.3], surfaces = [(1, 0, 0), (1, 1, 1), (1, 1, 0)],
    max_bondlength = None):
    """Builds a scaffold of ghost atoms in icosahedral, octahedral or wulff-shape. 
    Takes a shape argument (string can be ico, octa or wulff) as well as 
    the size argument i (int) and a latticeconstant.
    When shape = 'wulff', it is required to give energies and surfaces as lists of equal length.
    Returns a Cluster object with atom type 'X'.

    Args:
        shape (str) :       nanocluster shape such as "ico" (default), "octa", "wulff"
        i (float) :         size of the nanocluster. Has different implications depending 
                            on the shape
        latticeconstant (float) :   lattice constant of the fcc crystal structure defining
                                    the scaling of the nanocluster 
        energies (list) :       Defines Wulff-shape, ignored otherwise. The proportions of 
                                the surface energies defining the prominence of certain
                                slabs defined by surface (energies and corresponding 
                                surfaces must be in the same order)
        surfaces (list) :       Defines Wulff-shape, ignored otherwise. The Miller-indices
                                of the surface slabs. Their energies define the prominence 
                                of certain slabs (energies and corresponding surfaces must 
                                be in the same order)
        max_bondlength (float) :    distance up to which two atoms are considered
                                    bound. If None, the minimum distance is used
                                    as a guess with a tolerance factor of 0.1.
                                    Works well with equidistant atoms.

    Returns:
        cluskit.Scaffold :  Scaffold object, an enhanced ase.Atoms object
                            with additional attributes such as bond_matrix
    """
    if shape == "ico":
        atoms = Icosahedron('X', noshells = i, latticeconstant = latticeconstant)
    elif shape == "octa":
        atoms = Octahedron('X', length = i, latticeconstant = latticeconstant)
    elif shape == "wulff":
        # i gives size in atoms
        atoms = wulff_construction('X',
            latticeconstant = latticeconstant,
            surfaces=surfaces,
            energies=energies,
            size=i,
            structure='fcc',
            rounding='above')
    else:
        raise NameError("shape argument unknown! Use ico, octa or wulff")
    return Scaffold(atoms, max_bondlength = max_bondlength)
Beispiel #5
0
from ase.cluster import wulff_construction
from ase.visualize import view
from blase.tools import get_bondpairs, write_blender

surfaces = [(1, 1, 1), (1, 0, 0)]
energies = [1.28, 1.69]
atoms = wulff_construction('Au', surfaces, energies, 5000, 'fcc')
# view(atoms1)
for i in range(3):
    atoms.positions[:, i] -= min(atoms.positions[:, i])
atoms.positions[:, i] -= min(atoms.positions[:, i])
atoms.center(vacuum=2.0)
# view(atoms)
camera_loc = atoms.get_center_of_mass() + [0, -300, 0]

kwargs = {
    'engine':
    'BLENDER_WORKBENCH',  #'CYCLES', #'BLENDER_EEVEE' #'BLENDER_WORKBENCH'
    'camera_loc': camera_loc,  # distance from camera to front atom
    'camera_type': 'PERSP',  #  ['PERSP', 'ORTHO', 'PANO']
    'camera_lens': 100,  #
    'camera_target': atoms.get_center_of_mass(),  #
    'radii': 1.0,
    'display': True,
    'outfile': 'figs/wulff'
}
write_blender(atoms, **kwargs)
Beispiel #6
0
                         [10.94464142, 5.00000011, 5.01802495]])
systems.append((atoms, 'Pentane molecule'))

#
slab = fcc100('Cu', size=(2, 2, 2), vacuum=3.5)
add_adsorbate(slab, 'C', 1.5, 'hollow')
mask = [a.tag > 1 for a in slab]
constraint = FixAtoms(mask=mask)
slab.set_constraint(constraint)
systems.append((slab, 'C/Cu(100)'))

#
surfaces = [(1, 0, 0), (1, 1, 0), (1, 1, 1)]
esurf = [0.9151, 0.9771, 0.7953]  # Surface energies
size = 10  # number of atoms
atoms = wulff_construction('Al', surfaces, esurf, size, 'fcc',
                           rounding='above')
atoms.center(vacuum=6)
atoms.rattle(0.2)
systems.append((atoms, 'Alumninum cluster'))


def create_database():
    db = connect('systems.db', append=False)
    for atoms, description in systems:
        name = atoms.get_chemical_formula()
        db.write(atoms, description=description, name=name)

    if False:
        for atoms, description in systems:
            for seed in range(5):
                a = atoms.copy()
Beispiel #7
0
# 1. Build Atoms Object.
###############################################################################

# Setup calculator:
calc = EMT()

# 1.1. Set up structure:

surfaces = [(1, 0, 0), (1, 1, 0), (1, 1, 1)]
esurf = [1.0, 1.1, 0.9]
lc = 4.0
size = 11
atoms = wulff_construction('Au',
                           surfaces,
                           esurf,
                           size,
                           'fcc',
                           rounding='above',
                           latticeconstant=lc)
atoms.center(vacuum=5.0)
atoms.rattle(stdev=0.10, seed=0)

write('initial.traj', atoms)

atoms = read('initial.traj')
os.remove('initial.traj')
c = FixAtoms(indices=[0])
atoms.set_constraint(c)

# 2. Benchmark.
###############################################################################