ubsuny / 23-Homework7G3

MIT License
1 stars 6 forks source link

rectangle.ipynb doesn't print the optimized potential. #59

Closed Pranjal-Srivastava-2023 closed 7 months ago

Pranjal-Srivastava-2023 commented 7 months ago

cluster = Cluster(r_na, r_cl) vals_init = cluster.get_vals() print('initial Na positions:\n', r_na) print('initial Cl positions:\n', r_cl) print('initial positions flattened shape:\n', vals_init ) print('initial V :', cluster.V() )

Optimize the configuration

res = scipy.optimize.minimize(fun=cluster, x0=vals_init, tol=1e-3, method="BFGS") cluster.set_vals(res.x) # Update the class instance with the final optimized positions

poojashresthacode commented 7 months ago

what's the error message?

Pranjal-Srivastava-2023 commented 7 months ago

There is no error message. The code is missing two lines:

res = scipy.optimize.minimize(fun=cluster, x0=vals_init, tol=1e-3, method="BFGS") cluster.set_vals(res.x) # Update the class instance with the final optimized positions

JustinJaniszewski commented 7 months ago

yes but I dont understand that. If I do that, the shape is all weird when plotting

JustinJaniszewski commented 7 months ago

I think I understand now. Thank you for letting me know.