this should be done with something like
```
def curvature(i) : return v[i-1]-2.0*v[i]+v[i+1]
sum([c*c for c in map(curvature, range(1, nreco-1)])
```
with an inner list comprehension; it should be faster and easier to read