-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_grand_minimizer_v11.py
111 lines (72 loc) · 2.7 KB
/
test_grand_minimizer_v11.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import numpy as np
import matplotlib.pyplot as plt
from grand_minimizer_v11 import Island, E_hexi, Island_from_HOC
kwargs = {'polarity_1': 'n'} # more like a honeycomb
island = Island(R=0, a=1.34, nmax=5, E_surf=E_hexi,
E_surf_kwargs=kwargs, E_bond_alpha=10) # nmax=5,
t_eval = np.linspace(0, 20, 201)
island.solve_as_ivp(t_eval=t_eval, damping=1)
angles, mean_angle, weighted_mean_angle = island.get_angles()
island.show(show_arrows=True, show_final=True, border=5, figsize=[12, 8]) # 0.5
for vxy in island.velocities:
v = np.sqrt((vxy**2).sum(axis=0))
plt.plot(v)
plt.show()
if True:
results = []
rotations = np.linspace(0, 60, 61)
for R in rotations:
island = Island(R=R, a=1.35, nmax=5, E_surf=E_hexi,
E_surf_kwargs=kwargs, E_bond_alpha=10)
island.solve_as_ivp(t_eval=t_eval, damping=1)
E_initial, E_final = [island.get_total_energy(xy) for xy in
(island.xy, island.xy_final)]
angles, mean_angle, weighted_mean_angle = island.get_angles()
results.append([E_initial, E_final, weighted_mean_angle])
print(R, )
things = [np.array(thing) for thing in zip(*results)]
E_initial, E_final, weighted_mean_angle = things
if True:
plt.figure()
plt.plot(rotations, E_initial)
plt.plot(rotations, E_final)
plt.plot(rotations, weighted_mean_angle)
plt.show()
"""
print('angles.shape, np.nanmin(angles), np.nanmax(angles): ',
angles.shape, np.nanmin(angles), np.nanmax(angles))
print('final mean_angle, weighted_mean_angle: ', mean_angle, weighted_mean_angle)
"""
"""
# FROM 10
kwargs = {'polarity_1': 'n'} # more like a honeycomb
ijkl = (7, 1, 8, 1)
ijkl = (7, 0, 3, 3)
i1 = Island_from_HOC(ijkl, E_surf=E_hexi, E_surf_kwargs=kwargs,
E_bond_alpha=1)
i1.set_alpha(10)
t_eval = np.linspace(0, 10, 101)
i1.solve_as_ivp(t_eval=t_eval, damping=3)
i1.show(show_arrows=True, show_final=True, border=.5)
i2 = Island_from_HOC(ijkl, nmax=5, E_surf=E_hexi, E_surf_kwargs=kwargs,
E_bond_alpha=1)
i2.set_alpha(10)
i2.solve_as_ivp(t_eval=t_eval, damping=3)
i2.show(show_arrows=True, show_final=True, border=2.5)
"""
"""
# FROM 9
kwargs = {'polarity_1': 'n'} # more like a honeycomb
i3 = Island(R=20, a=1.3, strain=0.02, kind='h', nmax=5,
E_surf=E_hexi, E_surf_kwargs=kwargs, E_bond_alpha=1)
t_eval = np.linspace(0, 10, 101)
alphas = np.logspace(0, 2, 3)
i3.set_alpha(10)
i3.solve_as_ivp(t_eval=t_eval, damping=3)
i3.show(show_arrows=True, show_final=True, border=2)
print('i3.velocities.shape: ', i3.velocities.shape)
for vxy in i3.velocities:
v = np.sqrt((vxy**2).sum(axis=0))
plt.plot(v)
plt.show()
"""