gen_mdps creates contains the following for loop which goes to nsim+1 instead of nsim:
for i in range(nsim+1):
new_file_path = str(file_dir+'/'+file_name+'_'+str(i)+'.mdp')
If changed to nsim the genbar must be executed so that coupled lambdas are one point less than nsim, for example
genbar -nsim 20 -vdw -0,19
will create a lambda vector with 21 lambda values (not 20 as you would expect).