Table of Contents

Class: molecule | ../bkchem/molecule.py
--- | ---
Base Classes |
--- | ---
container top_level id_enabled oasa.molecule with_paper
Methods |
--- | ---
__init__ __iter__ add_atom_to add_edge add_vertex bbox bond_between check_fragments check_integrity children_generator create_edge create_fragment create_graph create_new_atom create_vertex create_vertex_according_to_text delete | delete_atom delete_bond delete_fragment delete_items draw eat_molecule expand_groups find_least_crowded_place_around_atom find_place flush_graph_to_file gen_bonds_between get_angle get_formula_dict get_fragment_by_id get_fragments_with_edge get_fragments_with_vertex get_geometry | get_package handle_overlap insert_atom is_empty lift mark_template_atom mark_template_bond move move_bonds_between_atoms read_package redraw replace_vertices transform
| __init__
    __init__ (
            self,
            paper=None,
            package=None,
            )
| __iter__
    __iter__ ( self )
| add_atom_to
    add_atom_to (
            self,
            a1,
            bond_to_use=None,
            pos=None,
            )
adds new atom bound to atom id with bond, the position of new atom can be specified in pos or is decided calling find_place(), if x, y is specified and matches already existing atom it will be used instead of creating new one
| add_edge
    add_edge (
            self,
            v1,
            v2,
            e=None,
            )
| add_vertex
    add_vertex ( self,  v=None )
| bbox
    bbox ( self )
returns the bounding box of the object as a list of [x1,y1,x2,y2]
| bond_between
    bond_between (
            self,
            a1,
            a2,
            )
returns id of bond between atoms a1 and a2
| check_fragments
    check_fragments ( self )
checks if all the fragments of this molecule are consistent and removes and returns the ones that are not
| check_integrity
    check_integrity ( self )
after deleting atoms or bonds it is important to see if it's needed to divide molecule to fragments and return them in form of list of new molecules
| children_generator
    children_generator ( self )
| create_edge
    create_edge ( self )
| create_fragment
    create_fragment (
            self,
            name,
            edges,
            vertices,
            type="explicit",
            strict=False,
            )
| create_graph
    create_graph ( self )
| create_new_atom
    create_new_atom (
            self,
            x,
            y,
            name=None,
            vertex_class=None,
            )
| create_vertex
    create_vertex ( self,  vertex_class=None )
| create_vertex_according_to_text
    create_vertex_according_to_text (
            self,
            old,
            text,
            interpret=1,
            )
| delete
    delete ( self )
deletes the molecule from canvas by calling delete for its children
| delete_atom
    delete_atom ( self,  item )
remove links to atom from molecule records
| delete_bond
    delete_bond ( self,  item )
| delete_fragment
    delete_fragment ( self,  f )
| delete_items
    delete_items (
            self,
            items,
            redraw=1,
            delete_single_atom=1,
            )
deletes items and also makes cleaning of orphan bonds and atoms
| draw
    draw ( self,  automatic="none" )
| eat_molecule
    eat_molecule ( self,  mol )
transfers everything from mol to self, now only calls feed_data
| expand_groups
    expand_groups ( self,  atoms=[] )
expands all group atoms; optional atoms selects atoms to expand - all used if not present
| find_least_crowded_place_around_atom
    find_least_crowded_place_around_atom (
            self,
            a,
            range=10,
            )
| find_place
    find_place (
            self,
            a,
            distance,
            added_order=1,
            )
tries to find accurate place for next atom around atom `id`, returns x,y and list of ids of `items` found there for overlap, those atoms are not bound to id
| flush_graph_to_file
    flush_graph_to_file ( self,  name="/home/beda/oasa/oasa/mol.graph" )
| gen_bonds_between
    gen_bonds_between (
            self,
            a1,
            a2,
            )
yields all bonds between atoms a1 and a2
| get_angle
    get_angle (
            self,
            a1,
            a2,
            )
what is the angle between horizontal line through i1 and i1-i2 line
| get_formula_dict
    get_formula_dict ( self )
returns a formula dict as defined in the periodic_table.py::formula_dict
| get_fragment_by_id
    get_fragment_by_id ( self,  id )
| get_fragments_with_edge
    get_fragments_with_edge ( self,  e )
| get_fragments_with_vertex
    get_fragments_with_vertex ( self,  v )
| get_geometry
    get_geometry ( self )
returns a tuple of ((minx, miny, max, maxy), mean_bond_length)
| get_package
    get_package (
            self,
            doc,
            items=None,
            )
| handle_overlap
    handle_overlap ( self )
deletes one of overlaping atoms and updates the bonds
| insert_atom
    insert_atom ( self,  at )
inserts atom to molecule without any connections
| is_empty
    is_empty ( self )
| lift
    lift ( self )
| mark_template_atom
    mark_template_atom ( self,  v )
Exceptions |
--- | ---
ValueError, "submitted atom does not belong to this molecule"
| mark_template_bond
    mark_template_bond ( self,  b )
Exceptions |
--- | ---
ValueError, "submitted bond does not belong to this molecule"
| move
    move (
            self,
            dx,
            dy,
            )
moves the whole molecule
| move_bonds_between_atoms
    move_bonds_between_atoms (
            self,
            a1,
            a2,
            )
transfers all bonds from one atom to the other; both atoms must be in self
| read_package
    read_package ( self,  package )
reads the dom element package and sets internal state according to it
| redraw
    redraw ( self,  reposition_double=0 )
| replace_vertices
    replace_vertices (
            self,
            old,
            new,
            )
replaces the vertex old with the vertex new
| transform
    transform ( self,  tr )
applies given transformation to its children

Table of Contents

This document was automatically generated on Tue Dec 12 13:46:43 2006 by HappyDoc version 2.1