Variable focal-length lens for atoms