Hi!
I’m a bit confused about what you want to do. From my understanding, optimizers interact with loss functions via gradients, so you would never really "define a loss function in torch.optim.SGD.
If you have a function f that quantifies how well n points are distributed on a unit sphere, then you could do something like
optimizer = torch.optim.SGD([points], lr=0.001)
for _ in range(num_iters):
    loss = f(points)  # calculate loss
    loss.backwards()  # back propagate
    optimizer.step()  # update parameters
    optimizer.zero_grad()  # reset gradients