How to calculate opening stock price

How is the initial stock price set at the start of trading?

The opening stock price is determined by matching pre-market buy and sell orders. The price where the most shares can be traded becomes the opening price. This is published by the exchange at market open.