Early in 1911, my grandfather Bethel Jacobs sailed from England to the northern Chilean town of Antofagasta. He had been seeking work for ages as an engineer, and in the end was offered a job in one of the remotest and most inhospitable corners of the globe. He became an employee of the British-owned company responsible for the railway line linking the Atacama desert with the high Bolivian Andes. He saw major engineering challenges ahead of him, as well as an opportunity to establish a reputation comparable to that of his uncle Charles Jacobs, the man responsible for New York's Hudson River Tunnel.
The one problem was that he had recently fallen in love with his cousin Sophie. Though they had become engaged a few days before he went away, he did not know how they were going to cope with at least three years of separation.
I was only three years old when my grandfather died, but tales of the period he spent in South America filled my childhood; I later came into possession of the letters he had written to my future grandmother on what was at first an almost daily basis. Finally, armed with copies of these letters, I realised one of my long-held ambitions: to set off on a journey in his footsteps.
After travelling for two nights by bus from the centre of Chile, through a progressively barren and uninhabited landscape, I alighted at dawn at the coastal town whose name had always had for me an almost mythical resonance. Antofagasta, a place of squat dwellings set against sun-scorched slopes, has rarely been favourably described, but I found it seedily evocative of Bethel's days there, when it had been a lawless boom town filled with foreign communities drawn by the area's mineral wealth.
A curious version of London's Big Ben, complete with chimes, was a nostalgic foretaste of the vast "railway enclosure" belonging to my grandfather's former company, now known as FCAB (Ferrocarriles Antofagasta Bolivia). I went inside to be confronted by porticoed wooden buildings unchanged since 1900, British-made clocks and furniture, an old London telephone cabin, a luxurious dining car once used on the Antofagasta to La Paz line, and - in the residential building where my grandfather had been put up - a mahogany memorial plaque inscribed with the names of colleagues who would die in the Great War.
A sentimental high point of my stay in the Antofagasta area was a visit to the outlying small township of Mejillones, where my grandfather had spent some of his happiest days in Chile. The place today, though soon to be changed by the construction of a nearby "mega port", had declined into a decayed weekend resort following the closure of what had been the largest railway building works in South America. I sat at a popular seaside bar, enjoying delicious pasties made from abalone, before tracking down a shaded group of English-style bungalows still owned by the FCAB. From one of my grandfather's photos, I was able to identify the now decayed cottage garden where he loved to sit.
These were moments that became ever more necessary to my grandfather, who was finding the desert grating increasingly on his nerves. He had accepted his job on the understanding that he would be constructing a branch line through a lush Bolivian valley, but instead he was assigned at first, routine maintenance work on the main line across the Atacama, where he had to put up with the world's most extreme climactic fluctuations.
I had an insight into the environment in which he had worked after leaving Antofagasta and heading east across the desert towards Bolivia. The still privately owned FCAB operates no passenger service up to the Chilean mining town of Calama, but I was given an engine car all to myself on one of the company's freight trains. In the course of the more than 16 hours it took to cover the 150 miles to Calama (a journey of about two and a half hours by bus), the extreme heat of the late morning gave way to persistent afternoon winds and freezing nocturnal temperatures.
Though the flat, stony landscape hardly changed during all this time, there was something curiously exhilarating about travelling through a haunting emptiness relieved only by the occasional ghostly sight of snaking whirlwinds of dust or of the now deserted nitrate settlements where my grandfather had stayed for exhausting weeks on end, longing more than ever for his Sophie.
Among the few compensations of this period in his life was helping to restore the former late 19th-century railway viaduct at Conchi, a vertiginously tall and virtually unvisited structure outside Calama that was considered by Bethel to be one of the great engineering marvels of his day. This monument alone justified for him all the hardships that he and his colleagues had to endure while building what was then still quaintly thought of as "the land of the future".
He would never have the opportunity to create such an ambitious work himself, but, after nearly two years in the Atacama, he was at least transferred, as he had always wanted, to the Bolivian Andes. The change of environment was a dramatic one, though not as dramatic as it is today: the crossing from Chile to Bolivia takes you abruptly from a world of relative prosperity to a place whose economy seems barely to have progressed over the past 50 years.
Most people travelling onwards from Calama into Bolivia sign up for one of the three-day excursions by Jeep that cross a succession of empty, haunting and spectacular landscapes, culminating in the dazzling white expanse of the great salt flat of Uyuni. But I wanted to continue by railway, and did so on the token once-weekly passenger train that the FCAB has been forced by a 1889 treaty to maintain.
The unheated carriages were crammed full of Bolivians returning home for Oruro's carnival, trying to keep warm as the train climbed by night to more than 4,000m, and the temperatures plunged below zero. Those of us who could sleep awoke at dawn to the sight of snow-capped volcanoes encircling the bleak border village of Ollague. The rest of the day was spent laboriously making our way towards Uyuni across the Bolivian high plateau or altiplano. After the unrelieved dryness of the Atacama, it was strange entering a rainy summer season known confusingly as the "Bolivian winter".
Our arrival at Uyuni was heralded by a glimpse of the town's notorious "railway cemetery", a rubbish-strewn group of rusted old engines and carriages grimly evocative of the fate both of Bolivia's railways and of Bolivia itself since the days when Uyuni was grandly conceived as one of South America's leading railway terminals.
The railway from Calama joins up at Uyuni with Bolivia's only other remaining passenger line, which once helped to connect Buenos Aires by train to Quito. Today it goes only as far north as Oruro. As well as getting to know this route, I was keen to travel on its two principal branch lines, one of which, dating back to 1912, leads to the mining town of Potosi, where my grandfather had been totally overwhelmed by the wealth of surviving colonial buildings from the 16th and 17th centuries.
In the end, the only way I was able to travel by train to Potosí was to sneak a lift in an engineer's inspection cab, which climbed almost imperceptibly through tundra up to a height of nearly 5,000m, across the highest railway pass in the world. But the greatest challenge of my trip was to find out what had happened to the branch line leading from Oruro to the great market centre of Cochabamba.
My grandfather, who had been actively involved in the construction of this line, had predicted that, when completed, it "would form one of the most wildly picturesque railway journeys in the world". Shortly before my arrival in Bolivia I had been excited to discover that the line had been just reopened after many years of being left to ruin. However, I was now told that it had been almost closed with the onset of the rainy season, when large sections of the track had been pulled up to prevent them from being washed away by floods. My only option was to try to follow the line on foot, in the company of a jovially optimistic engineer.
The valley through which we slowly descended was as spectacular as my grandfather had suggested, with massive pinnacles of rock thrust up above dense vegetation. However, the state of the line piteously reflected the extraordinary amount of damage that can be inflicted by just a few weeks of Bolivia's volatile weather conditions. Violent storms had led to the destruction of much of the track, forcing us to walk up to our necks through terrifying mountain torrents, undertake perilous ascents up sheer slopes of rubble, and cross bridges whose rotting railway sleepers half-hung over the abyss. Miraculously, after a day in which half a mountainside had failed to engulf us, we arrived at Cochabamba.
I made my way to the town's charming, arcaded main square, where my grandfather had spent some of his last hours in Bolivia, relaxing in a café while reading of the assassination at Sarajevo of Archduke Ferdinand. Malaria and a bad investment had succeeded in delaying his return to England. Eventually he got back there in August 1914 to find that his fiancée had tired of waiting for him and was away in Dublin. The two of them were reconciled, but not before he had signed up for "the war to end all wars". Three more years of being apart from his beloved Sophie still awaited him before his odyssey would finally be over.
'Ghost Train Through the Andes, On My Grandfather's Trail in Chile and Bolivia' by Michael Jacobs is published on 3 August by John Murray, price £25
My top attraction
Lovers of ghost towns should visit the haunting ruins of Chacabuco. The place is one of the many now abandoned settlements founded from 1900 onwards. In the late 1970s, a decision was made to preserve what was left as an industrial museum. Soon afterwards the town was turned into a concentration camp by Pinochet. Bizarrely, one of its former inmates looks after the place today, and is the sole remaining inhabitant. Open daily, 9am-6pm.
My top hotel
One of Bolivia's most endearing and eccentric hotels, Hacienda de Cayara (00 591 2 622 6380; cayara.com.bo), stands at the end of a narrow, fertile valley 18km from Potosi. Set around a delightful stone patio, its ochre-coloured buildings and chapel form part of a 16th-century estate that was acquired at the end of the 19th century by a French mining engineer, Louis Soux. The place is run by two of his grandchildren. It has a wonderful family feel that compensates for the slightly spartan bedrooms.Reuse content