Пример #1
0
Файл: io.py Проект: yuansr/ababe
    def __init__(self, gcell, zoom=1):
        self.lattice = gcell.lattice
        self.positions = gcell.positions
        self.numbers = gcell.numbers

        self.atoms_name_list = list(
            map(lambda x: Specie.to_name(x), list(self.numbers)))

        self.zoom = zoom
Пример #2
0
    def comment(self):
        from collections import Counter, OrderedDict
        atoms_name_list = list(
            map(lambda x: Specie.to_name(x), list(self.numbers)))
        d = Counter(atoms_name_list)
        ordered_atoms = OrderedDict(
            sorted(d.items(), key=lambda x: Specie(x[0]).Z))
        if 'G' in ordered_atoms:
            del ordered_atoms['G']

        comment = ''.join(
            ['{}{}'.format(k, v) for k, v in ordered_atoms.items()])
        return comment
Пример #3
0
    def __init__(self, gcell):
        self.lattice = np.around(gcell.lattice, decimals=6)
        self.positions = np.around(gcell.positions, decimals=6)
        self.numbers = gcell.numbers

        atoms_name_list = list(
            map(lambda x: Specie.to_name(x), list(self.numbers)))
        d = Counter(atoms_name_list)
        ordered_atoms = OrderedDict(
            sorted(d.items(), key=lambda x: Specie(x[0]).Z))
        # remove Ghostatoms
        if 'G' in ordered_atoms:
            del ordered_atoms['G']

        self.comment = ''.join(
            ['{}{}'.format(k, v) for k, v in ordered_atoms.items()])