added energy calculation and weight calculation
merge of polymer.f90