Пример #1
0
    def makeatoms(self, *args):
        self.update_element()
        self.update_gui()
        if self.legal_element is None or (self.struct.get_active() == 2 and
                                          self.legal_element2 is None):
            self.atoms = None
            self.pybut.python = None
            self.status.set_markup(_("Please specify a consistent set of atoms. "))
        else:
            n = int(self.n.value)
            m = int(self.m.value)
            CC = self.bondlength.value
            vacuum = self.vacuum.value
            orient = self.orient_text[self.orient.get_active()]
            elem = self.legal_element
            if self.struct.get_active() == 0:
                # Extended sheet
                self.atoms = graphene_nanoribbon(n, m, type=orient, C_C=CC,
                                                 vacc=vacuum, sheet=True,
                                                 main_element=elem)
            elif self.struct.get_active() == 1:
                # Unsaturated nanoribbon
                self.atoms = graphene_nanoribbon(n, m, type=orient, C_C=CC,
                                                 vacc=vacuum,
                                                 main_element=elem)
            elif self.struct.get_active() == 2:
                # Saturated nanoribbon
                elem2 = self.legal_element2
                self.atoms = graphene_nanoribbon(n, m, type=orient, C_C=CC,
                                                 C_H=self.bondlength2.value,
                                                 vacuum=vacuum,
                                                 saturated=True,
                                                 main_element=elem,
                                                 saturate_element=elem2)
            else:
                raise RuntimeError("Unknown structure in SetupGraphene!")

        # Now, rotate into the xy plane (ase.gui's default view plane)
        pos = self.atoms.get_positions()
        cell = self.atoms.get_cell()
        pbc = self.atoms.get_pbc()
        cell[1,1], cell[2,2] = cell[2,2], cell[1,1]
        x = pos[:,1].copy()
        z = pos[:,2].copy()
        pos[:,1] = z
        pos[:,2] = x
        self.atoms.set_cell(cell)
        self.atoms.set_positions(pos)
        self.atoms.set_pbc([pbc[0], pbc[2], pbc[1]])
        # Find the heights of the unit cell
        h = np.zeros(3)
        uc = self.atoms.get_cell()
        for i in range(3):
            norm = np.cross(uc[i-1], uc[i-2])
            norm /= np.sqrt(np.dot(norm, norm))
            h[i] = np.abs(np.dot(norm, uc[i]))
        label = label_template % {'natoms'  : self.atoms.get_number_of_atoms(),
                                  'symbols' : formula(self.atoms.get_atomic_numbers()),
                                  'volume'  : self.atoms.get_volume()}
        self.status.set_markup(label)                
Пример #2
0
 def material_from_selection(self,*args):
     box_selection = self.get_selection()
     selection = self.gui.images.selected.copy()
     if selection.any():
         Z = []
         for n in range(len(selection)):
             if selection[n]:
                 Z += [self.gui.images.Z[n]]
         name = formula(Z)
         if (box_selection == selection).all():
             name += ': ' + self.texture_selection.get_text()
         texture_button = gtk.combo_box_new_text()
         for t in self.finish_list:
             texture_button.append_text(t)
         texture_button.set_active(1)
         transparency = gtk.Adjustment(0,0.0,1.0,0.01)
         transparency_spin = gtk.SpinButton(transparency, 0, 0)
         transparency_spin.set_digits(2)
         delete_button = gtk.Button(stock=gtk.STOCK_DELETE)
         alignment = delete_button.get_children()[0]
         index = len(self.materials)
         delete_button.connect("clicked",self.delete_material,{"n":index})
         self.materials += [[True,selection,texture_button,
                             gtk.Label(_("  transparency: ")),transparency_spin,
                             gtk.Label("   "),delete_button,gtk.Label()]]
         self.materials[-1][-1].set_markup("    "+name)
         pack(self.tbox,[self.materials[-1][2],self.materials[-1][3],self.materials[-1][4],
                         self.materials[-1][5],self.materials[-1][6],self.materials[-1][7]])
     else:
         oops(_("Can not create new texture! Must have some atoms selected to create a new material!"))
Пример #3
0
 def makeatoms(self, *args):
     self.update_element()
     if self.legal_element is None:
         self.atoms = None
         self.pybut.python = None
     else:
         n = int(self.n.value)
         m = int(self.m.value)
         symb = self.legal_element
         length = int(self.length.value)
         bl = self.bondlength.value
         self.atoms = nanotube(n, m, length=length, bond=bl, symbol=symb)
         # XXX can this be translated?
         self.pybut.python = py_template % {'n': n, 'm':m, 'length':length,
                                            'symb':symb, 'bl':bl}
         h = np.zeros(3)
         uc = self.atoms.get_cell()
         for i in range(3):
             norm = np.cross(uc[i-1], uc[i-2])
             norm /= np.sqrt(np.dot(norm, norm))
             h[i] = np.abs(np.dot(norm, uc[i]))
         label = label_template % {'natoms'   : self.atoms.get_number_of_atoms(),
                                   'symbols'  : formula(self.atoms.get_atomic_numbers()),
                                   'volume'   : self.atoms.get_volume(),
                                   'diameter' : self.atoms.get_cell()[0][0]/2.0}
         self.status.set_markup(label)                
Пример #4
0
 def makeatoms(self, *args):
     self.update_element()
     if self.legal_element is None:
         self.atoms = None
         self.pybut.python = None
     else:
         n = int(self.n.value)
         m = int(self.m.value)
         symb = self.legal_element
         length = int(self.length.value)
         bl = self.bondlength.value
         self.atoms = nanotube(n, m, length=length, bond=bl, symbol=symb)
         # XXX can this be translated?
         self.pybut.python = py_template % {
             'n': n,
             'm': m,
             'length': length,
             'symb': symb,
             'bl': bl
         }
         h = np.zeros(3)
         uc = self.atoms.get_cell()
         for i in range(3):
             norm = np.cross(uc[i - 1], uc[i - 2])
             norm /= np.sqrt(np.dot(norm, norm))
             h[i] = np.abs(np.dot(norm, uc[i]))
         label = label_template % {
             'natoms': len(self.atoms),
             'symbols': formula(self.atoms.get_atomic_numbers()),
             'volume': self.atoms.get_volume(),
             'diameter': self.atoms.get_cell()[0][0] / 2.0
         }
         self.status.set_markup(label)
Пример #5
0
 def makeatoms(self, *args):
     self.update_element()
     if self.legal_element is None:
         self.atoms = None
         self.pybut.python = None
     else:
         n = int(self.n.value)
         m = int(self.m.value)
         symb = self.legal_element
         length = int(self.length.value)
         bl = self.bondlength.value
         self.atoms = nanotube(n, m, length=length, bond=bl, symbol=symb)
         # XXX can this be translated?
         self.pybut.python = py_template % {'n': n, 'm':m, 'length':length,
                                            'symb':symb, 'bl':bl}
         label = label_template % {'natoms'   : len(self.atoms),
                                   'symbols'  : formula(self.atoms.get_atomic_numbers()),
                                   'volume'   : np.inf,
                                   'diameter' : self.atoms.get_cell()[0][0]/2.0}
         self.status.set_markup(label)
Пример #6
0
Файл: render.py Проект: adbX/ase
 def material_from_selection(self, *args):
     box_selection = self.get_selection()
     selection = self.gui.images.selected.copy()
     if selection.any():
         Z = []
         for n in range(len(selection)):
             if selection[n]:
                 Z += [self.gui.images.Z[n]]
         name = formula(Z)
         if (box_selection == selection).all():
             name += ': ' + self.texture_selection.get_text()
         texture_button = gtk.combo_box_new_text()
         for t in self.finish_list:
             texture_button.append_text(t)
         texture_button.set_active(1)
         transparency = gtk.Adjustment(0, 0.0, 1.0, 0.01)
         transparency_spin = gtk.SpinButton(transparency, 0, 0)
         transparency_spin.set_digits(2)
         delete_button = gtk.Button(stock=gtk.STOCK_DELETE)
         alignment = delete_button.get_children()[0]
         index = len(self.materials)
         delete_button.connect("clicked", self.delete_material,
                               {"n": index})
         self.materials += [[
             True, selection, texture_button,
             gtk.Label(_("  transparency: ")), transparency_spin,
             gtk.Label("   "), delete_button,
             gtk.Label()
         ]]
         self.materials[-1][-1].set_markup("    " + name)
         pack(self.tbox, [
             self.materials[-1][2], self.materials[-1][3],
             self.materials[-1][4], self.materials[-1][5],
             self.materials[-1][6], self.materials[-1][7]
         ])
     else:
         oops(
             _("Can not create new texture! Must have some atoms selected to create a new material!"
               ))
Пример #7
0
    def update(self, *args):
        """ all changes of physical constants are handled here, atoms are set up"""
        if self.clearing_in_process:
            return True
        self.update_element()
        a_equals = self.lattice_lequals[0].get_active()
        b_equals = self.lattice_lequals[1].get_active()
        c_equals = self.lattice_lequals[2].get_active()
        alpha_equals = self.lattice_aequals[0].get_active()
        beta_equals = self.lattice_aequals[1].get_active()
        gamma_equals = self.lattice_aequals[2].get_active()
        sym = self.spacegroup.get_text()
        valid = True
        try:
            no = int(sym)
            spg = Spacegroup(no).symbol
            self.spacegroupinfo.set_label(_('Symbol: %s') % str(spg))
            spg = no
        except:
            try:
                no = Spacegroup(sym).no
                self.spacegroupinfo.set_label(_('Number: %s') % str(no))
                spg = no
            except:
                self.spacegroupinfo.set_label(_('Invalid Spacegroup!'))
                valid = False

        if a_equals == 0:
            self.lattice_lbuts[0].set_sensitive(True)
        elif a_equals == 1:
            self.lattice_lbuts[0].set_sensitive(False)
            self.lattice_lbuts[0].set_value(self.lattice_lbuts[1].get_value())
        elif a_equals == 2:
            self.lattice_lbuts[0].set_sensitive(False)
            self.lattice_lbuts[0].set_value(self.lattice_lbuts[2].get_value())
        else:
            self.lattice_lbuts[0].set_sensitive(False)
        if b_equals == 0:
            self.lattice_lbuts[1].set_sensitive(True)
        elif b_equals == 1:
            self.lattice_lbuts[1].set_sensitive(False)
            self.lattice_lbuts[1].set_value(self.lattice_lbuts[0].get_value())
        elif b_equals == 2:
            self.lattice_lbuts[1].set_sensitive(False)
            self.lattice_lbuts[1].set_value(self.lattice_lbuts[2].get_value())
        else:
            self.lattice_lbuts[1].set_sensitive(False)
        if c_equals == 0:
            self.lattice_lbuts[2].set_sensitive(True)
        elif c_equals == 1:
            self.lattice_lbuts[2].set_sensitive(False)
            self.lattice_lbuts[2].set_value(self.lattice_lbuts[0].get_value())
        elif c_equals == 2:
            self.lattice_lbuts[2].set_sensitive(False)
            self.lattice_lbuts[2].set_value(self.lattice_lbuts[1].get_value())
        else:
            self.lattice_lbuts[2].set_sensitive(False)
        if alpha_equals == 0:
            self.lattice_abuts[0].set_sensitive(True)
        elif alpha_equals == 1:
            self.lattice_abuts[0].set_sensitive(False)
            self.lattice_abuts[0].set_value(self.lattice_abuts[1].get_value())
        elif alpha_equals == 2:
            self.lattice_abuts[0].set_sensitive(False)
            self.lattice_abuts[0].set_value(self.lattice_abuts[2].get_value())
        else:
            self.lattice_abuts[0].set_sensitive(False)
        if beta_equals == 0:
            self.lattice_abuts[1].set_sensitive(True)
        elif beta_equals == 1:
            self.lattice_abuts[1].set_sensitive(False)
            self.lattice_abuts[1].set_value(self.lattice_abuts[0].get_value())
        elif beta_equals == 2:
            self.lattice_abuts[1].set_sensitive(False)
            self.lattice_abuts[1].set_value(self.lattice_abuts[2].get_value())
        else:
            self.lattice_abuts[1].set_sensitive(False)
        if gamma_equals == 0:
            self.lattice_abuts[2].set_sensitive(True)
        elif gamma_equals == 1:
            self.lattice_abuts[2].set_sensitive(False)
            self.lattice_abuts[2].set_value(self.lattice_abuts[0].get_value())
        elif gamma_equals == 2:
            self.lattice_abuts[2].set_sensitive(False)
            self.lattice_abuts[2].set_value(self.lattice_abuts[1].get_value())
        else:
            self.lattice_abuts[2].set_sensitive(False)

        valid = len(self.elements[0][0].get_text()) and valid
        self.get_data.set_sensitive(valid and self.get_n_elements() == 1
                                    and self.update_element())
        self.atoms = None
        if valid:
            basis_count = -1
            for el in self.elements:
                if el[-1]:
                    basis_count += 1
            if basis_count:
                symbol_str = '['
                basis_str = "["
                symbol = []
                basis = []
            else:
                symbol_str = ''
                basis_str = ''
                basis = None
            for el in self.elements:
                if el[-1]:
                    symbol_str += "'" + el[0].get_text() + "'"
                    if basis_count:
                        symbol_str += ','
                        symbol += [el[0].get_text()]
                        exec 'basis += [[float(' + el[1].get_text(
                        ) + '),float(' + el[2].get_text(
                        ) + '),float(' + el[3].get_text() + ')]]'
                    else:
                        symbol = el[0].get_text()
                        exec 'basis = [[float(' + el[1].get_text(
                        ) + '),float(' + el[2].get_text(
                        ) + '),float(' + el[3].get_text() + ')]]'
                    basis_str += '[' + el[1].get_text() + ',' + el[2].get_text(
                    ) + ',' + el[3].get_text() + '],'
            basis_str = basis_str[:-1]
            if basis_count:
                symbol_str = symbol_str[:-1] + ']'
                basis_str += ']'
            size_str = '(' + str(int(self.size[0].get_value())) + ',' + str(
                int(self.size[1].get_value())) + ',' + str(
                    int(self.size[2].get_value())) + ')'
            size = (int(self.size[0].get_value()),
                    int(self.size[1].get_value()),
                    int(self.size[2].get_value()))
            cellpar_str = ''
            cellpar = []
            for i in self.lattice_lbuts:
                cellpar_str += str(i.get_value()) + ','
                cellpar += [i.get_value()]
            for i in self.lattice_abuts:
                cellpar_str += str(i.get_value()) + ','
                cellpar += [i.get_value()]
            cellpar_str = '[' + cellpar_str[:-1] + ']'
            args = {
                'symbols': symbol,
                'basis': basis,
                'size': size,
                'spacegroup': spg,
                'cellpar': cellpar
            }
            args_str = {
                'symbols': symbol_str,
                'basis': basis_str,
                'size': size_str,
                'spacegroup': spg,
                'cellpar': cellpar_str
            }
            self.pybut.python = py_template % args_str
            try:
                self.atoms = crystal(**args)
                label = label_template % {
                    'natoms': self.atoms.get_number_of_atoms(),
                    'symbols': formula(self.atoms.get_atomic_numbers()),
                    'volume': self.atoms.get_volume()
                }
                self.status.set_label(label)
            except:
                self.atoms = None
                self.status.set_markup(
                    _("Please specify a consistent set of atoms."))
        else:
            self.atoms = None
            self.status.set_markup(
                _("Please specify a consistent set of atoms."))
Пример #8
0
    def update(self, *args):
        """ all changes of physical constants are handled here, atoms are set up"""
        if self.clearing_in_process:
            return True
        self.update_element()
        a_equals = self.lattice_lequals[0].get_active()
        b_equals = self.lattice_lequals[1].get_active()
        c_equals = self.lattice_lequals[2].get_active()
        alpha_equals = self.lattice_aequals[0].get_active()
        beta_equals = self.lattice_aequals[1].get_active()
        gamma_equals = self.lattice_aequals[2].get_active()
        sym = self.spacegroup.get_text()
        valid = True
        try:
            no = int(sym)
            spg = Spacegroup(no).symbol
            self.spacegroupinfo.set_label(_('Symbol: %s') % str(spg))
            spg = no
        except:
            try:
                no = Spacegroup(sym).no
                self.spacegroupinfo.set_label(_('Number: %s') % str(no))
                spg = no
            except:
                self.spacegroupinfo.set_label(_('Invalid Spacegroup!'))
                valid = False

        if a_equals == 0:
            self.lattice_lbuts[0].set_sensitive(True)
        elif a_equals == 1:
            self.lattice_lbuts[0].set_sensitive(False)
            self.lattice_lbuts[0].set_value(self.lattice_lbuts[1].get_value())
        elif a_equals == 2:
            self.lattice_lbuts[0].set_sensitive(False)
            self.lattice_lbuts[0].set_value(self.lattice_lbuts[2].get_value())
        else:
            self.lattice_lbuts[0].set_sensitive(False)
        if b_equals == 0:
            self.lattice_lbuts[1].set_sensitive(True)
        elif b_equals == 1:
            self.lattice_lbuts[1].set_sensitive(False)
            self.lattice_lbuts[1].set_value(self.lattice_lbuts[0].get_value())
        elif b_equals == 2:
            self.lattice_lbuts[1].set_sensitive(False)
            self.lattice_lbuts[1].set_value(self.lattice_lbuts[2].get_value())
        else:
            self.lattice_lbuts[1].set_sensitive(False)
        if c_equals == 0:
            self.lattice_lbuts[2].set_sensitive(True)
        elif c_equals == 1:
            self.lattice_lbuts[2].set_sensitive(False)
            self.lattice_lbuts[2].set_value(self.lattice_lbuts[0].get_value())
        elif c_equals == 2:
            self.lattice_lbuts[2].set_sensitive(False)
            self.lattice_lbuts[2].set_value(self.lattice_lbuts[1].get_value())
        else:
            self.lattice_lbuts[2].set_sensitive(False)
        if alpha_equals == 0:
            self.lattice_abuts[0].set_sensitive(True)
        elif alpha_equals == 1:
            self.lattice_abuts[0].set_sensitive(False)
            self.lattice_abuts[0].set_value(self.lattice_abuts[1].get_value())
        elif alpha_equals == 2:
            self.lattice_abuts[0].set_sensitive(False)
            self.lattice_abuts[0].set_value(self.lattice_abuts[2].get_value())
        else:
            self.lattice_abuts[0].set_sensitive(False)
        if beta_equals == 0:
            self.lattice_abuts[1].set_sensitive(True)
        elif beta_equals == 1:
            self.lattice_abuts[1].set_sensitive(False)
            self.lattice_abuts[1].set_value(self.lattice_abuts[0].get_value())
        elif beta_equals == 2:
            self.lattice_abuts[1].set_sensitive(False)
            self.lattice_abuts[1].set_value(self.lattice_abuts[2].get_value())
        else:
            self.lattice_abuts[1].set_sensitive(False)
        if gamma_equals == 0:
            self.lattice_abuts[2].set_sensitive(True)
        elif gamma_equals == 1:
            self.lattice_abuts[2].set_sensitive(False)
            self.lattice_abuts[2].set_value(self.lattice_abuts[0].get_value())
        elif gamma_equals == 2:
            self.lattice_abuts[2].set_sensitive(False)
            self.lattice_abuts[2].set_value(self.lattice_abuts[1].get_value())
        else:
            self.lattice_abuts[2].set_sensitive(False)

        valid = len(self.elements[0][0].get_text()) and valid
        self.get_data.set_sensitive(valid and self.get_n_elements() == 1 and
                                    self.update_element())
        self.atoms = None
        if valid:
            basis_count = -1
            for el in self.elements:
                if el[-1]:
                    basis_count += 1
            if basis_count:
                symbol_str = '['
                basis_str = "["
                symbol = []
                basis = []
            else:
                symbol_str = ''
                basis_str = ''
                basis = None
            for el in self.elements:
                if el[-1]:
                    symbol_str += "'" + el[0].get_text() + "'"
                    if basis_count:
                        symbol_str += ','
                        symbol += [el[0].get_text()]
                        exec('basis += [[float(' + el[1].get_text(
                        ) + '),float(' + el[2].get_text() + '),float(' + el[3]
                             .get_text() + ')]]')
                    else:
                        symbol = el[0].get_text()
                        exec('basis = [[float(' + el[1].get_text() + '),float('
                             + el[2].get_text() + '),float(' + el[3].get_text(
                             ) + ')]]')
                    basis_str += '[' + el[1].get_text() + ',' + el[2].get_text(
                    ) + ',' + el[3].get_text() + '],'
            basis_str = basis_str[:-1]
            if basis_count:
                symbol_str = symbol_str[:-1] + ']'
                basis_str += ']'
            size_str = '(' + str(int(self.size[0].get_value())) + ',' + str(
                int(self.size[1].get_value())) + ',' + str(
                    int(self.size[2].get_value())) + ')'
            size = (int(self.size[0].get_value()),
                    int(self.size[1].get_value()),
                    int(self.size[2].get_value()))
            cellpar_str = ''
            cellpar = []
            for i in self.lattice_lbuts:
                cellpar_str += str(i.get_value()) + ','
                cellpar += [i.get_value()]
            for i in self.lattice_abuts:
                cellpar_str += str(i.get_value()) + ','
                cellpar += [i.get_value()]
            cellpar_str = '[' + cellpar_str[:-1] + ']'
            args = {
                'symbols': symbol,
                'basis': basis,
                'size': size,
                'spacegroup': spg,
                'cellpar': cellpar
            }
            args_str = {
                'symbols': symbol_str,
                'basis': basis_str,
                'size': size_str,
                'spacegroup': spg,
                'cellpar': cellpar_str
            }
            self.pybut.python = py_template % args_str
            try:
                self.atoms = crystal(**args)
                label = label_template % {
                    'natoms': len(self.atoms),
                    'symbols': formula(self.atoms.get_atomic_numbers()),
                    'volume': self.atoms.get_volume()
                }
                self.status.set_label(label)
            except:
                self.atoms = None
                self.status.set_markup(
                    _("Please specify a consistent set of atoms."))
        else:
            self.atoms = None
            self.status.set_markup(
                _("Please specify a consistent set of atoms."))
Пример #9
0
    def update(self, *args):
        """ all changes of physical constants are handled here, atoms are set up"""
        if self.clearing_in_process:
            return True
        self.update_element()
        a_equals = self.lattice_lequals[0].get_active()
        b_equals = self.lattice_lequals[1].get_active()
        c_equals = self.lattice_lequals[2].get_active()
        alpha_equals = self.lattice_aequals[0].get_active()
        beta_equals = self.lattice_aequals[1].get_active()
        gamma_equals = self.lattice_aequals[2].get_active()
        sym = self.spacegroup.get_text()
        valid = True
        try:
            no = int(sym)
            spg = Spacegroup(no).symbol
            self.spacegroupinfo.set_label(_("Symbol: %s") % str(spg))
            spg = no
        except:
            try:
                no = Spacegroup(sym).no
                self.spacegroupinfo.set_label(_("Number: %s") % str(no))
                spg = no
            except:
                self.spacegroupinfo.set_label(_("Invalid Spacegroup!"))
                valid = False

        if a_equals == 0:
            self.lattice_lbuts[0].set_sensitive(True)
        elif a_equals == 1:
            self.lattice_lbuts[0].set_sensitive(False)
            self.lattice_lbuts[0].set_value(self.lattice_lbuts[1].get_value())
        elif a_equals == 2:
            self.lattice_lbuts[0].set_sensitive(False)
            self.lattice_lbuts[0].set_value(self.lattice_lbuts[2].get_value())
        else:
            self.lattice_lbuts[0].set_sensitive(False)
        if b_equals == 0:
            self.lattice_lbuts[1].set_sensitive(True)
        elif b_equals == 1:
            self.lattice_lbuts[1].set_sensitive(False)
            self.lattice_lbuts[1].set_value(self.lattice_lbuts[0].get_value())
        elif b_equals == 2:
            self.lattice_lbuts[1].set_sensitive(False)
            self.lattice_lbuts[1].set_value(self.lattice_lbuts[2].get_value())
        else:
            self.lattice_lbuts[1].set_sensitive(False)
        if c_equals == 0:
            self.lattice_lbuts[2].set_sensitive(True)
        elif c_equals == 1:
            self.lattice_lbuts[2].set_sensitive(False)
            self.lattice_lbuts[2].set_value(self.lattice_lbuts[0].get_value())
        elif c_equals == 2:
            self.lattice_lbuts[2].set_sensitive(False)
            self.lattice_lbuts[2].set_value(self.lattice_lbuts[1].get_value())
        else:
            self.lattice_lbuts[2].set_sensitive(False)
        if alpha_equals == 0:
            self.lattice_abuts[0].set_sensitive(True)
        elif alpha_equals == 1:
            self.lattice_abuts[0].set_sensitive(False)
            self.lattice_abuts[0].set_value(self.lattice_abuts[1].get_value())
        elif alpha_equals == 2:
            self.lattice_abuts[0].set_sensitive(False)
            self.lattice_abuts[0].set_value(self.lattice_abuts[2].get_value())
        else:
            self.lattice_abuts[0].set_sensitive(False)
        if beta_equals == 0:
            self.lattice_abuts[1].set_sensitive(True)
        elif beta_equals == 1:
            self.lattice_abuts[1].set_sensitive(False)
            self.lattice_abuts[1].set_value(self.lattice_abuts[0].get_value())
        elif beta_equals == 2:
            self.lattice_abuts[1].set_sensitive(False)
            self.lattice_abuts[1].set_value(self.lattice_abuts[2].get_value())
        else:
            self.lattice_abuts[1].set_sensitive(False)
        if gamma_equals == 0:
            self.lattice_abuts[2].set_sensitive(True)
        elif gamma_equals == 1:
            self.lattice_abuts[2].set_sensitive(False)
            self.lattice_abuts[2].set_value(self.lattice_abuts[0].get_value())
        elif gamma_equals == 2:
            self.lattice_abuts[2].set_sensitive(False)
            self.lattice_abuts[2].set_value(self.lattice_abuts[1].get_value())
        else:
            self.lattice_abuts[2].set_sensitive(False)

        valid = len(self.elements[0][0].get_text()) and valid
        self.get_data.set_sensitive(valid and self.get_n_elements() == 1 and self.update_element())
        self.atoms = None
        if valid:
            basis_count = -1
            for el in self.elements:
                if el[-1]:
                    basis_count += 1
            if basis_count:
                symbol_str = "["
                basis_str = "["
                symbol = []
                basis = []
            else:
                symbol_str = ""
                basis_str = ""
                basis = None
            for el in self.elements:
                if el[-1]:
                    symbol_str += "'" + el[0].get_text() + "'"
                    if basis_count:
                        symbol_str += ","
                        symbol += [el[0].get_text()]
                        exec "basis += [[float(" + el[1].get_text() + "),float(" + el[2].get_text() + "),float(" + el[
                            3
                        ].get_text() + ")]]"
                    else:
                        symbol = el[0].get_text()
                        exec "basis = [[float(" + el[1].get_text() + "),float(" + el[2].get_text() + "),float(" + el[
                            3
                        ].get_text() + ")]]"
                    basis_str += "[" + el[1].get_text() + "," + el[2].get_text() + "," + el[3].get_text() + "],"
            basis_str = basis_str[:-1]
            if basis_count:
                symbol_str = symbol_str[:-1] + "]"
                basis_str += "]"
            size_str = (
                "("
                + str(int(self.size[0].get_value()))
                + ","
                + str(int(self.size[1].get_value()))
                + ","
                + str(int(self.size[2].get_value()))
                + ")"
            )
            size = (int(self.size[0].get_value()), int(self.size[1].get_value()), int(self.size[2].get_value()))
            cellpar_str = ""
            cellpar = []
            for i in self.lattice_lbuts:
                cellpar_str += str(i.get_value()) + ","
                cellpar += [i.get_value()]
            for i in self.lattice_abuts:
                cellpar_str += str(i.get_value()) + ","
                cellpar += [i.get_value()]
            cellpar_str = "[" + cellpar_str[:-1] + "]"
            args = {"symbols": symbol, "basis": basis, "size": size, "spacegroup": spg, "cellpar": cellpar}
            args_str = {
                "symbols": symbol_str,
                "basis": basis_str,
                "size": size_str,
                "spacegroup": spg,
                "cellpar": cellpar_str,
            }
            self.pybut.python = py_template % args_str
            try:
                self.atoms = crystal(**args)
                label = label_template % {
                    "natoms": self.atoms.get_number_of_atoms(),
                    "symbols": formula(self.atoms.get_atomic_numbers()),
                    "volume": self.atoms.get_volume(),
                }
                self.status.set_label(label)
            except:
                self.atoms = None
                self.status.set_markup(_("Please specify a consistent set of atoms."))
        else:
            self.atoms = None
            self.status.set_markup(_("Please specify a consistent set of atoms."))