def example():
    '''This section gives examples of how to use the module.'''

    # 1a8d is an example from the loops benchmark
    # 1lfa contains hydrogens
    b = Bonsai.retrieve('1lfa', cache_dir='/tmp')
    search_radius = 10.0

    atom_of_interest = b.get_atom(1095)
    nearby_atoms = b.find_atoms_near_atom(atom_of_interest, search_radius)
    for na in nearby_atoms:
        assert(na - atom_of_interest <= search_radius)
    for fa in b.get_atom_set_complement(nearby_atoms):
        assert(fa - atom_of_interest > search_radius)

    # Get all heavy atoms within the radius (including HETATM)
    nearby_heavy_atoms = b.find_heavy_atoms_near_atom(atom_of_interest, search_radius)

    # Get all C-alpha atoms within the radius
    nearby_ca_atoms = b.find_atoms_near_atom(atom_of_interest, search_radius, atom_names_to_include = ['CA'])

    # Get all carbon atoms within the radius
    nearby_c_atoms = b.find_atoms_near_atom(atom_of_interest, search_radius, atom_names_to_include = b.get_atom_names_by_group(['C']))
def example ( ) : b = Bonsai . retrieve ( '1lfa' , cache_dir = '/tmp' ) search_radius = 10.0 atom_of_interest = b . get_atom ( 1095 ) nearby_atoms = b . find_atoms_near_atom ( atom_of_interest , search_radius ) for na in nearby_atoms : assert ( na - atom_of_interest <= search_radius ) for fa in b . get_atom_set_complement ( nearby_atoms ) : assert ( fa - atom_of_interest > search_radius ) nearby_heavy_atoms = b . find_heavy_atoms_near_atom ( atom_of_interest , search_radius ) nearby_ca_atoms = b . find_atoms_near_atom ( atom_of_interest , search_radius , atom_names_to_include = [ 'CA' ] ) nearby_c_atoms = b . find_atoms_near_atom ( atom_of_interest , search_radius , atom_names_to_include = b . get_atom_names_by_group ( [ 'C' ] ) )
This section gives examples of how to use the module.