Clear atoms and use free_symbols instead_merged

This is almost the same PR  in ```Clear atoms(symbol) and use free_symbols instead``` #7272. Due to a merge conflict and an error occurred on its way this new PR is created.

In this PR, the ```atoms(Symbol)``` and ```atoms()``` are replaced by ```free_symbols``` wherever appropriate.