Beispiel #1
0
 def do(self):
     total, formula = chemical_formula(yield_atoms(context.application.cache.nodes), True)
     if total > 0:
         answer = "Chemical formula: %s" % formula
         answer += "\nNumber of atoms: %i" % total
     else:
         answer = "No atoms found."
     ok_information(answer, markup=True)
Beispiel #2
0
        def create_pattern():
            "Read the atom positions and transform them to the flat coordinates"
            active, inactive = universe.get_active_inactive()
            tmp_cell = UnitCell()
            tmp_cell.add_cell_vector(universe.cell[:,active[0]])
            tmp_cell.add_cell_vector(universe.cell[:,active[1]])
            r = tmp_cell.calc_align_rotation_matrix()

            return [
                (atom.number, numpy.dot(r, atom.get_absolute_frame().t))
                for atom in yield_atoms([universe])
            ]