If there are a lot of different types of A,B .... molecules in the system, and I want to quickly get all the molecules of type A,do anyone know how can I realize that ?? This is a kind of pattern matching problem ? My thought is: 1. First transfer all molecule structures into a string and store them. 2. Then search for the strings for the desired string. Any body has a better idea? or where can I find such an algorithm ? Any clues are highly appreciated.