Efficient and stable method of searching for optimum structures of molecules containing cyclic parts