@staticmethod
def search_and_replace(file, to_search):
    """
        Search and replace atom_names for numbers
      """
    to_replace = range(1, len(to_search) + 1)
    with open(file, 'r+') as f:
        lines = f.readlines()
        for i, line in enumerate(lines):
            lines[i] = ' ' + line.strip('\n')
    with open(file, 'w') as f:
        f.write('\n'.join(lines))
    with open(file, 'r') as f:
        filedata = f.read()
    for item_to_search, item_to_replace in zip(to_search, to_replace):
        filedata = filedata.replace(' ' + item_to_search.strip('_') + ' ', 
            ' ' + str(item_to_replace) + ' ')
    f = open(file, 'w')
    f.write(filedata)
    f.close()
