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
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
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()])