Esempio n. 1
0
 def __str__(self):
     if self.transgen == canonical:
         return "{" + self.symmetry.__str__() + "}"
     else:
         transgenblock = bp.block(
             [[self.transgen.liste[j].value.liste[i].liste[0].__str__() + "  "
                 for j in range(3)] for i in range(3)])
         return bp.block([["{" + self.symmetry.__str__() + "}", ],
                          [transgenblock, ]])
Esempio n. 2
0
 def __str__(self):
     if self.transgen == canonical:
         return "{" + self.symmetry.__str__() + "}"
     else:
         transgenblock = bp.block([[
             self.transgen.liste[j].value.liste[i].liste[0].__str__() + "  "
             for j in range(3)
         ] for i in range(3)])
         return bp.block([[
             "{" + self.symmetry.__str__() + "}",
         ], [
             transgenblock,
         ]])
Esempio n. 3
0
def test_block():
    liste = [["a", ], ["a\nb", "aaa"], ["aa\naa", "b"]]
    assert bp.block(liste) == " a   \n"\
                              " aaaa\n"\
                              " b   \n"\
                              "aa  b\n"\
                              "aa   "
Esempio n. 4
0
 def __str__(self):
     return bp.block([
         [
             "Atom", " " + self.name, " " + self.typ,
             " " + self.pos.__str__()
         ],
     ])
Esempio n. 5
0
    def __str__(self):
        liste_strings = [["Spacegroup", ''], ["----------", ''],
                         [self.transgen.__str__(), '']]
        for coset in self.liste_cosets:
            liste_strings.append(['', coset.symmetry.__str__()])

        return bp.block(liste_strings)
Esempio n. 6
0
def atomtable_equalnames(liste, atomset):
    assert isinstance(liste, list), \
        "First Argument must be of type list."
    for atomname in liste:
        assert isinstance(atomname, str), \
            "First Argument must be a list " \
            "of str."
    assert isinstance(atomset, cr.Atomset), \
        "Second argument must by of type Atomset."

    for atom in atomset.menge:
        assert (atom.name in liste), \
            "The list does not contain an atom " \
            "named %s ." % atom.name

    stringliste = [["  name", "  type", "   x ", "   y ", "   z "],
                   ["  ----", "  ----", "  ---", "  ---", "  ---"]]
    for atomname in liste:
        how_often = 0
        for atom in atomset.menge:
            if (atom.name == atomname):
                how_often += 1
                stringliste.append(
                    ["  " + atom.name,
                     "  " + atom.typ,
                     "  " + atom.pos.x().__str__(),
                     "  " + atom.pos.y().__str__(),
                     "  " + atom.pos.z().__str__()])
#        assert (how_often == 1), \
#            "There are %i atoms named "\
#            "%s in the atomset" \
#            %(how_often, atomname)
    string = bp.block(stringliste)
    return string
Esempio n. 7
0
    def __str__(self):
        liste_strings = [["Spacegroup", ''],
                         ["----------", ''],
                         [self.transgen.__str__(), '']]
        for coset in self.liste_cosets:
            liste_strings.append(['', coset.symmetry.__str__()])

        return bp.block(liste_strings)
Esempio n. 8
0
 def __str__(self):
     if self == canonical:
         return "canonical"
     else:
         return bp.block([["Transgen",
                           self.liste[0].value.block(0, 3, 0, 1).__str__(), ' ',
                           self.liste[1].value.block(0, 3, 0, 1).__str__(), ' ',
                           self.liste[2].value.block(0, 3, 0, 1).__str__()], ])
Esempio n. 9
0
 def __mul__(self, right):
     assert isinstance(right, Coset), \
         "Cannot multiply Coset with %s ." % (type(right))
     assert self.transgen == right.transgen, \
         "Can only multiply two Cosets with the same Transgen, "\
         "but " + bp.block([[self.transgen.__str__(),
                             " != ",
                             right.transgen.__str__()]])
     return Coset(self.symmetry * right.symmetry, self.transgen)
Esempio n. 10
0
 def __str__(self):
     return "Cellparameters\n" + \
            bp.block([["a", " b", " c", " alpha", " beta", " gamma"],
                      [self.a.__str__(),
                       " " + self.b.__str__(),
                       " " + self.c.__str__(),
                       " " + self.alpha.__str__(),
                       " " + self.beta.__str__(),
                       " " + self.gamma.__str__()]])
Esempio n. 11
0
 def __str__(self):
     return "Cellparameters\n" + \
            bp.block([["a", " b", " c", " alpha", " beta", " gamma"],
                      [self.a.__str__(),
                       " " + self.b.__str__(),
                       " " + self.c.__str__(),
                       " " + self.alpha.__str__(),
                       " " + self.beta.__str__(),
                       " " + self.gamma.__str__()]])
Esempio n. 12
0
 def __mul__(self, right):
     assert isinstance(right, Coset), \
         "Cannot multiply Coset with %s ." % (type(right))
     assert self.transgen == right.transgen, \
         "Can only multiply two Cosets with the same Transgen, "\
         "but " + bp.block([[self.transgen.__str__(),
                             " != ",
                             right.transgen.__str__()]])
     return Coset(self.symmetry * right.symmetry, self.transgen)
Esempio n. 13
0
 def __str__(self):
     if self == canonical:
         return "canonical"
     else:
         return bp.block([
             [
                 "Transgen", self.liste[0].value.block(0, 3, 0,
                                                       1).__str__(), ' ',
                 self.liste[1].value.block(0, 3, 0, 1).__str__(), ' ',
                 self.liste[2].value.block(0, 3, 0, 1).__str__()
             ],
         ])
Esempio n. 14
0
 def __str__(self):
     # The Atoms are printed in alphabetically order with regard to
     # the name, and if name is equal, with regard to the type.
     strings = [
         ["Atomset\n"
          "-------"],
     ]
     liste = [atom for atom in self.menge]
     atomliste = []
     momentumliste = []
     bondliste = []
     faceliste = []
     subsetliste = []
     for item in self.menge:
         if isinstance(item, Atom):
             atomliste.append(item)
         elif isinstance(item, Momentum):
             momentumliste.append(item)
         elif isinstance(item, Bond):
             bondliste.append(item)
         elif isinstance(item, Face):
             faceliste.append(item)
         elif isinstance(item, Subset):
             subsetliste.append(item)
     types = [atom.typ for atom in atomliste]
     indexes = [i for (j, i) in sorted(zip(types, range(len(atomliste))))]
     names = [atomliste[i].name for i in indexes]
     indexes = [i for (j, i) in sorted(zip(names, indexes))]
     print(indexes)
     for i in indexes:
         strings.append(["", atomliste[i].__str__()])
         strings.append([""])
     for momentum in momentumliste:
         strings.append(["", str(momentum)])
     for bond in bondliste:
         strings.append(["", str(bond)])
     for face in faceliste:
         strings.append(["", str(face)])
     for subset in subsetliste:
         strings.append(["", str(subset)])
     return bp.block(strings)
Esempio n. 15
0
 def __str__(self):
     # The Atoms are printed in alphabetically order with regard to
     # the name, and if name is equal, with regard to the type.
     strings = [["Atomset\n"
                 "-------"], ]
     liste = [atom for atom in self.menge]
     atomliste = []
     momentumliste = []
     bondliste = []
     faceliste = []
     subsetliste = []
     for item in self.menge:
         if isinstance(item, Atom):
             atomliste.append(item)
         elif isinstance(item, Momentum):
             momentumliste.append(item)
         elif isinstance(item, Bond):
             bondliste.append(item)
         elif isinstance(item, Face):
             faceliste.append(item)
         elif isinstance(item, Subset):
             subsetliste.append(item)
     types = [atom.typ for atom in atomliste]
     indexes = [i for (j, i) in sorted(zip(types, range(len(atomliste))))]
     names = [atomliste[i].name for i in indexes]
     indexes = [i for (j, i) in sorted(zip(names, indexes))]
     print(indexes)
     for i in indexes:
         strings.append(["", atomliste[i].__str__()])
         strings.append([""])
     for momentum in momentumliste:
         strings.append(["", str(momentum)])
     for bond in bondliste:
         strings.append(["", str(bond)])
     for face in faceliste:
         strings.append(["", str(face)])
     for subset in subsetliste:
         strings.append(["", str(subset)])
     return bp.block(strings)
Esempio n. 16
0
 def __str__(self):
     return bp.block([["Pos", self.value.block(0, 3, 0, 1).__str__()], ])
Esempio n. 17
0
 def __str__(self):
     return bp.block([["Atom", " " + self.name,
                       " " + self.typ, " " + self.pos.__str__()], ])
Esempio n. 18
0
 def __str__(self):
     return bp.block([["Metric", self.value.__str__()]])
Esempio n. 19
0
 def __str__(self):
     return bp.block([["Rec", self.value.block(0, 1, 0, 3).__str__()], ])
Esempio n. 20
0
 def __str__(self):
     return bp.block([
         ["Pos", self.value.block(0, 3, 0, 1).__str__()],
     ])
Esempio n. 21
0
 def __str__(self):
     return bp.block([["Operator", self.value.__str__()], ])
Esempio n. 22
0
 def __str__(self):
     return bp.block([
         ["Operator", self.value.__str__()],
     ])
Esempio n. 23
0
 def __str__(self):
     return bp.block([["Metric", self.value.__str__()]])
Esempio n. 24
0
 def __str__(self):
     return bp.block([
         ["Rec", self.value.block(0, 1, 0, 3).__str__()],
     ])