Exemplo n.º 1
0
    def on_copy_button_clicked_handler(self, *arg):
        try:
            v1 = float(self.vx_entry.get_text())
        except:
            msg().error("Wrong x-field in Vector.")
        try:
            v2 = float(self.vy_entry.get_text())
        except:
            msg().error("Wrong y-field in Vector.")
        try:
            v3 = float(self.vz_entry.get_text())
        except:
            msg().error("Wrong z-field in Vector.")
        v = Vector(v1, v2, v3)
        if self.system is not None:
            if self.system.INITIAL_STRUCTURE is not None:
                s = self.system.INITIAL_STRUCTURE
                s.setCarthesian()
                sel = Selection(self.group_entry.get_text(), s)
                l = []
                for i in sel.getAtoms():
                    if i >= 0 and i < len(s):
                        l.append((s.speciesIndex(i), s[i] + v))
                for i, v in l:
                    s.appendAtom(i, v)

                msg().status("OK")
                systemlist().notifySystemChanged()
            else:
                msg().error("No initial structure in the current system.")
        else:
            msg().error("No system selected.")
Exemplo n.º 2
0
 def getSelection(self, struct=None):
     #    print "selection:",self.selection
     s = Selection(self.selection, struct)
     return s.getAtoms()