Potential relief and equilibrium positions for oxygen atoms in Cd-O-Nb, Cd-O-Cd and Nb-O-Nb chains are studied in Pb(Cd1/3Nb2/3)O-3 (PCN) and Ba(Cd1/3Nb2/3)O-3 (BCN). Total energy cluster calculations are performed using ab initio restricted Hartree-Fock method. The electron correlation contribution is calculated within Moller-Plesset method. It is revealed that in PCN the oxygen atoms in Cd-O-Cd and Cd-O-Nb chains move in multi-well potentials with four minima shifted transversely to fourfold  axis. Whereas the oxygen atom in Nb-O-Nb chain in PCN and all oxygen atoms in BCN move in single-well potentials.