This thread is about a train that is charged at its terminus stations. Having it charged by a diesel generator doesn't bring much of an environmental benefit.
Solar panels are unlikely to come anywhere near the required power. You are looking at around 200W per square metre of solar panel in good sunlight, so around 8kW per carriage, but unlike panels on a roof, they would need to be flat, rather than aligned to point at the sun. A class 700 train has about 400kW of power per carriage, so even in ideal conditions, solar power fitted to the train would be 1 or 2 % of the demand. Much better to put the solar panels in a field, and run a power cable to a battery at the terminus station (or concentrate on running railways, and ask the National grid to do that bit for you

)