A novel approach to describe the 3D structure of small/medium-sized and large molecules is introduced. A vector and an index are defined on the basis of considering second line graphs with edges weighted by the dihedral angles of the molecule. They measure the 3D `compactness' or folding of the molecular structures, giving maximum values for the most folded structures. We have ranked five protein models according to their degree of folding. The similarity among these proteins has been determined, showing that the most folded proteins are not similar among them, while the less folded ones are similar to each other.