This commit is contained in:
nssc_kuen 2022-04-10 12:12:50 +02:00
parent a3d4d8a2c6
commit cdf9e3104f
1 changed files with 3 additions and 1 deletions

View File

@ -19,7 +19,8 @@ class State:
return energy(self.positions()) return energy(self.positions())
def minimize(self) -> None: def minimize(self) -> None:
res = minimize(energy, self.positions(), method='L-BFGS-B', bounds=Bounds(0,self.size), jac='3-point') # report with jax gradient
res = minimize(energy, self.positions(), method='CG', jac='3-point')
min = res.x min = res.x
min = np.matrix(min) min = np.matrix(min)
min.shape = (self.count,3) min.shape = (self.count,3)
@ -75,6 +76,7 @@ def distances(P):
XYZ = abs(XYZ) XYZ = abs(XYZ)
# nearest image convention # nearest image convention
# replace with modulo
XYZ = XYZ.at[XYZ > 0.5].add(-0.5) XYZ = XYZ.at[XYZ > 0.5].add(-0.5)
XYZ = XYZ**2 XYZ = XYZ**2