Skip to content

__repr__ not working for SymmetryOperation #7

@mcocdawc

Description

@mcocdawc

Hej Marcus,

I try to use your library for detecting pointgroups in my python module chemcoord.
There is a bug in __repr__ of your SymmetryOperation class which can be reproduced with this code:

import chemcoord as cc

molecule = cc.Cartesian.read_xyz('MIL53_small.xyz', start_index=1)
def give_elements(molecule):
    return [msym.Element(name=molecule.loc[i, 'atom'], coordinates=molecule.loc[i, ['x', 'y', 'z']])
            for i in molecule.index]
with msym.Context(elements=give_elements(molecule)) as ctx:
    ctx.find_symmetry()
    symmetry_operations = ctx.symmetry_operations

symmetry_operations[0].__class__.__name__
OUT: 'SymmetryOperation'
symmetry_operations[0]._names
OUT: ['E', 'C', 'S', 'σ', 'i']
symmetry_operations[0].type
OUT: 414166088

The command symmetry_operations[0]._names[symmetry_operations[0].type] raises now an IndexError, which leads to the bug in __repr__. I gues that some byte offset from you C-code has to be calculated into symmetry_operations[0].type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions