An ab initio investigation of structure and energetics of clusters KnCln and LinFn