def test_potential_charge(self): """ tests the total charge """ p = Potential.from_file('m0.pot') self.assertEqual(p.charge, 0) p = Potential.from_file('nomul.pot') self.assertEqual(p.charge, 0)
def test_printed_potential_match(self): p = Potential.from_file('m2p2.pot') with open('printed_potential.pot', 'w') as f: f.write(str(p)) p2 = Potential.from_file('printed_potential.pot') self.assertEqual(p == p2, True) delete_file('printed_potential.pot')
class Clique(object): def __init__(self, id, nodes, sizes, values=None): self.id = id self.potential = Potential(nodes, sizes, values) def enter_evidence(self, evidence): self.potential.enter_evidence(evidence)
def setUp(self): c1 = [[0.0, 0.0, 0.0]] q1 = [[1.0]] self.p1 = Potential.from_multipoles( c1, q1 ) c2 = [[5.4, 0.0, 0.0]] d2 = [[1.0, 1.0, 0.0]] self.p2 = Potential.from_multipoles( c2, d2 ) # a potential from a file self.pfile = Potential.from_file('pehf_iter.pot')
def setUp(self): c1 = [[0.0, 0.0, 0.0]] q1 = [[1.0]] self.p1 = Potential.from_multipoles(c1, q1) c2 = [[5.4, 0.0, 0.0]] d2 = [[1.0, 1.0, 0.0]] self.p2 = Potential.from_multipoles(c2, d2) # a potential from a file self.pfile = Potential.from_file('pehf_iter.pot')
def test_add_potentials_with_multipoles_mixed(self): """ Adds potentials with mixed multipole moments """ m2p2 = Potential.from_file('m2p2.pot') m0 = Potential.from_file('m0.pot') # check we can add both ways p2 = m0 + m2p2 self.assertEqual(p2.nsites, 15) self.assertEqual(len(p2.polarizabilities), 15) self.assertEqual(max(p2.multipoles.keys()), 2) p1 = m2p2 + m0 self.assertEqual(p1.nsites, 15) self.assertEqual(len(p1.polarizabilities), 15) self.assertEqual(max(p1.multipoles.keys()), 2)
def __pb_train_click(self): try: class_0_point_0_x = int(self.ui.le_class_0_point_0_x.text()) class_0_point_0_y = int(self.ui.le_class_0_point_0_y.text()) point_0 = Point(class_0_point_0_x, class_0_point_0_y) class_0_point_1_x = int(self.ui.le_class_0_point_1_x.text()) class_0_point_1_y = int(self.ui.le_class_0_point_1_y.text()) point_1 = Point(class_0_point_1_x, class_0_point_1_y) self.__training_vectors[0] = [point_0, point_1] except ValueError: self.__training_vectors[0] = [Point(3, 2), Point(-5, 0)] try: class_1_point_0_x = int(self.ui.le_class_1_point_0_x.text()) class_1_point_0_y = int(self.ui.le_class_1_point_0_y.text()) point_0 = Point(class_1_point_0_x, class_1_point_0_y) class_1_point_1_x = int(self.ui.le_class_1_point_1_x.text()) class_1_point_1_y = int(self.ui.le_class_1_point_1_y.text()) point_1 = Point(class_1_point_1_x, class_1_point_1_y) self.__training_vectors[1] = [point_0, point_1] except ValueError: self.__training_vectors[1] = [Point(4, -7), Point(1, 1)] potential = Potential(self.__amount_of_classes) self.__func, isSuccess = potential.train(self.__training_vectors) if not isSuccess: self.__msgbox_message( 'Error', 'An error occurred while training. \nEnter another training data.' ) else: self.scene.clear() self.__draw_axes() self.__draw_graphic() self.__draw_training_points() try: self.ui.le_separated_function.setText(str(self.__func)) except ValueError: self.__msgbox_message( 'Error', 'An error occurred while training. \nEnter another training data.' )
def bubbler(potential, backend="cosmotransitions", **kwargs): """ :param potential: Potential object or string :param backend: Code with which to solve bounce :returns: Results from a particular code :rtype: namedtuple """ try: # Call function module = globals()[backend] potential = Potential(potential) if isinstance(potential, str) else potential action, trajectory_data, time, command = module.solve( potential, **kwargs) # Make interpolation function from output trajectory = [ interp(trajectory_data[:, 0], trajectory_data[:, i + 1]) for i in range(potential.n_fields) ] if trajectory_data is not None else None # Find maximum value of rho rho_end = trajectory_data[-1, 0] if trajectory_data is not None else None return Solution(backend, action, trajectory, rho_end, time, command) except Exception as error: return Solution(backend, None, None, None, None, error.message)
def test_get_pol_matrix(self): """ polarization matrix """ p = Potential.from_file('nomul.pot') pol = p.polarizabilities[0] mat = util.get_polarization_matrix(p) self.assertEqual(pol[0], mat[0,0]) self.assertEqual(pol[3], mat[1,1]) self.assertEqual(pol[5], mat[2,2])
def profiles(potential, backends=None, **kwargs): """ :param potential: Potential object or string Plots field profiles for all codes. """ potential = Potential(potential) if isinstance(potential, str) else potential results = bubblers(potential, backends, **kwargs) # Make profile plot _, ax = plt.subplots() colors = cycle(["Brown", "Green", "Blue"]) for result in results.itervalues(): if not result.action: continue color = next(colors) lines = cycle(["-", "--", "-."]) rho = np.linspace(0, result.rho_end, 1000) for name, trajectory in zip(potential.field_latex, result.trajectory): ax.plot(rho, trajectory(rho), ls=next(lines), c=color, lw=3, label="{} from {}".format(name, result.backend), alpha=0.8) # Plot true vacuum markers = cycle(["^", "p", "*"]) for name, field in zip(potential.field_latex, potential.true_vacuum): ax.plot(0., field, next(markers), c="Gold", label="True vacuum for {}".format(name), ms=10, clip_on=False, zorder=10) # Labels etc ax.set_xlabel(r"$\rho$") ax.set_ylabel(r"$\phi$") leg = ax.legend(numpoints=1, fontsize=12, loc='best') leg.get_frame().set_alpha(0.5) ax.set_title(potential.potential_latex) plt.show()
def test_add_empty_potentials(self): """ Potential addition with empty potential """ # first we test construction of empty potential p = Potential() self.assertEqual(p.labels, []) self.assertEqual(p.nsites, 0) self.assertEqual(p.npols, 0) p2 = p + p # maybe we should just raise a value error instead? self.assertEqual(p2.nsites, 0) self.assertEqual(p2.npols, 0)
def initalize_message(self): '''every node has a message dictionary self.message ={j: {nodek: mkj(xj), nodeh: mhj(xj), ...}, i: {nodek: mki(xi), nodeh: mhi(xi), ...}, } ''' self.message = {} for node_idx, node_name in enumerate(self.graph.node_list): self.message[node_idx] = {} for neighbor_node in self.graph.neighbor(node_idx): self.message[node_idx][neighbor_node] = Potential( [node_idx], np.array([self.graph.node_size[node_idx]]), np.ones(self.graph.node_size[node_idx]))
def bubblers(potential, backends=None, **kwargs): """ :param potential: Potential object or string :param backend: Code with which to solve bounce :returns: Results from all codes :rtype: list of namedtuple """ potential = Potential(potential) if isinstance(potential, str) else potential backends = backends if backends else BACKENDS return Solutions( {b: bubbler(potential, backend=b, **kwargs) for b in backends})
def setClean(self): equip = Equip.equipLib.getEquip(self.m_name) if equip is None: return False self.m_type = equip['type'] if equip['type'] in ['Weapon', 'Secondary', 'Emblem']: self.m_category = equip['category'] self.m_level = equip['level'] self.m_class = equip['class'] self.m_str = equip['str'] self.m_dex = equip['dex'] self.m_int = equip['int'] self.m_luk = equip['luk'] self.m_hp = equip['hp'] self.m_mp = equip['mp'] self.m_watt = equip['watt'] self.m_matt = equip['matt'] self.m_wdef = equip['wdef'] self.m_mdef = equip['mdef'] self.m_accuracy = equip['accuracy'] self.m_avoid = equip['avoid'] self.m_boss = equip['boss'] self.m_pdr = equip['pdr'] self.m_total_slot = equip['slot'] self.m_remain_slot = equip['slot'] if equip['slot'] == 0: self.m_remain_hammer = 0 else: self.m_remain_hammer = 2 self.m_success = 0 self.m_stars = 0 self.m_setId = equip['setId'] self.m_pot = Potential(self) self.m_bpot = None self.m_neb = None self.m_protect = False self.m_guardian = False self.m_safety = False return True
# linear combination of all the stored guesses so far new_guess = numpy.zeros(numpy.shape(self.guess_storage[0])) for i in range(n): new_guess += coeff[i] * self.guess_storage[i] # remove unwanted (non-contributing) solutions from the # DIIS space selection = list(numpy.where(numpy.abs(coeff) < self.diis_vector_threshold)[0]) selection.reverse() for i in selection: self.guess_storage.pop(i) self.diff_storage.pop(i) return new_guess if __name__ == '__main__': import sys from fields import get_static_field from potential import Potential from util import get_interaction_matrix, get_polarization_matrix filename = sys.argv[1] p = Potential.from_file(filename) polmat = get_polarization_matrix(p) intmat = get_interaction_matrix(p, induced_damping=True) field = get_static_field(p) s = IterativeDIISSolver(polmat, intmat, field, verbose = True, threshold = 1.0e-5) result = s.Solve()
def test_potential_equal(self): """ tests equality of potentials """ p = Potential.from_file('m0.pot') self.assertEqual(p == p, True)
class Equip: 'Equipment class' #static equipLib = EquipLib() potLib = PotentialLib() scrollLib = ScrollLib() m_name = '' m_type = '' m_category = '' m_level = 0 m_class = '' m_str = 0 m_dex = 0 m_int = 0 m_luk = 0 m_hp = 0 m_mp = 0 m_watt = 0 m_matt = 0 m_wdef = 0 m_mdef = 0 m_accuracy = 0 m_avoid = 0 m_boss = 0 m_pdr = 0 m_total_slot = 0 m_remain_slot = 0 m_remain_hammer = 0 m_success = 0 m_stars = 0 m_pot = None m_bpot = None m_neb = None m_protect = False m_guardian = False m_safety = False m_setId = 0 def __init__(self, name): self.m_name = name self.m_type = 'generic' self.m_class = 'all' def __getitem__(self, string): return { 'str': self.m_str, 'dex': self.m_dex, 'int': self.m_int, 'luk': self.m_luk, 'hp': self.m_hp, 'mp': self.m_mp, 'watt': self.m_watt, 'matt': self.m_matt, 'wdef': self.m_wdef, 'mdef': self.m_mdef, 'accuracy': self.m_accuracy, 'avoid': self.m_avoid, 'boss': self.m_boss, 'pdr': self.m_pdr, }[string] def __setitem__(self, string, value): if string == 'str': self.m_str = value elif string == 'dex': self.m_dex = value elif string == 'int': self.m_int = value elif string == 'luk': self.m_luk = value elif string == 'hp': self.m_hp = value elif string == 'mp': self.m_mp = value elif string == 'watt': self.m_watt = value elif string == 'matt': self.m_matt = value elif string == 'wdef': self.m_wdef = value elif string == 'mdef': self.m_mdef = value elif string == 'accuracy': self.m_accuracy = value elif string == 'avoid': self.m_avoid = value elif string == 'boss': self.m_boss =value elif string == 'pdr': self.m_pdr = value def showEquip(self): output = '' output += self.m_name if self.m_success > 0: output += ' (+' + str(self.m_success) + ')\n' else: output += '\n' if self.m_type in ['Weapon', 'Secondary']: output += 'Category: ' + self.m_type + ' (' + self.m_category + ')\n' else: output += 'Category: ' + self.m_type + '\n' output += 'REQ LVL: ' + str(self.m_level) + '\n' output += 'Class: ' + self.m_class + '\n' if self.m_str: output += 'STR: +' + str(self.m_str) + '\n' if self.m_dex: output += 'DEX: +' + str(self.m_dex) + '\n' if self.m_int: output += 'INT: +' + str(self.m_int) + '\n' if self.m_luk: output += 'LUK: +' + str(self.m_luk) + '\n' if self.m_hp: output += 'MaxHP: +' + str(self.m_hp) + '\n' if self.m_mp: output += 'MaxMP: +' + str(self.m_mp) + '\n' if self.m_watt: output += 'WEAPON ATT: ' + str(self.m_watt) + '\n' if self.m_matt: output += 'MAGIC ATT: ' + str(self.m_matt) + '\n' if self.m_wdef: output += 'WEAPON DEF: ' + str(self.m_wdef) + '\n' if self.m_mdef: output += 'MAGIC DEF: ' + str(self.m_mdef) + '\n' if self.m_accuracy: output += 'ACCURACY: +' + str(self.m_accuracy) + '\n' if self.m_avoid: output += 'AVOIDABILITY: +' + str(self.m_avoid) + '\n' if self.m_boss: output += 'Boss Damage: +' + str(int(self.m_boss*100)) + '%\n' if self.m_pdr: output += 'Ignore Enemy Defense: +' + str(int(self.m_pdr*100)) + '%\n' output += 'NUMBER OF UPGRADES AVAILABLE: ' + str(self.m_remain_slot) + '\n' output += 'NUMBER OF HAMMER APPLIED: ' + str(self.m_remain_hammer) + '\n\n' if self.m_pot: output += self.m_pot.showPot() if self.m_setId: output += EquipSetLib.showSetEffect(self.m_setId) subScrollInfo = '' if self.m_protect: subScrollInfo += 'Protect Scroll in effect.\n' if self.m_guardian: subScrollInfo += 'Guardian Scroll in effect.\n' if self.m_safety: subScrollInfo += 'Safety Scroll in effect.\n' if subScrollInfo != '': output += '----\n' output += subScrollInfo return output def setClean(self): equip = Equip.equipLib.getEquip(self.m_name) if equip is None: return False self.m_type = equip['type'] if equip['type'] in ['Weapon', 'Secondary', 'Emblem']: self.m_category = equip['category'] self.m_level = equip['level'] self.m_class = equip['class'] self.m_str = equip['str'] self.m_dex = equip['dex'] self.m_int = equip['int'] self.m_luk = equip['luk'] self.m_hp = equip['hp'] self.m_mp = equip['mp'] self.m_watt = equip['watt'] self.m_matt = equip['matt'] self.m_wdef = equip['wdef'] self.m_mdef = equip['mdef'] self.m_accuracy = equip['accuracy'] self.m_avoid = equip['avoid'] self.m_boss = equip['boss'] self.m_pdr = equip['pdr'] self.m_total_slot = equip['slot'] self.m_remain_slot = equip['slot'] if equip['slot'] == 0: self.m_remain_hammer = 0 else: self.m_remain_hammer = 2 self.m_success = 0 self.m_stars = 0 self.m_setId = equip['setId'] self.m_pot = Potential(self) self.m_bpot = None self.m_neb = None self.m_protect = False self.m_guardian = False self.m_safety = False return True def applySpecial(self, effect): if effect == 'Innocent': equip = Equip.equipLib.getEquip(self.m_name) if equip is None: return False self.m_str = equip['str'] self.m_dex = equip['dex'] self.m_int = equip['int'] self.m_luk = equip['luk'] self.m_hp = equip['hp'] self.m_mp = equip['mp'] self.m_watt = equip['watt'] self.m_matt = equip['matt'] self.m_wdef = equip['wdef'] self.m_mdef = equip['mdef'] self.m_accuracy = equip['accuracy'] self.m_avoid = equip['avoid'] self.m_total_slot = equip['slot'] self.m_remain_slot = equip['slot'] self.m_remain_hammer = 2 self.m_success = 0 self.m_stars = 0 self.m_protect = False self.m_guardian = False elif effect == 'Potential': if random.random() < 0.8: numLines = 2 else: numLines = 3 r = random.random() if r < 0.99: rank = 1 elif r < 0.9999: rank = 2 else: rank = 3 self.m_pot.m_rank = rank self.m_pot.roll(numLines) self.m_protect = False self.m_guardian = False elif effect == 'Epic Potential': if random.random() < 0.8: numLines = 2 else: numLines = 3 self.m_pot.m_rank = 2 self.m_pot.roll(numLines) self.m_protect = False self.m_guardian = False elif effect == 'Unique Potential': if random.random() < 0.8: numLines = 2 else: numLines = 3 self.m_pot.m_rank = 3 self.m_pot.roll(numLines) self.m_protect = False self.m_guardian = False elif effect == 'Clean Slate': if self.m_success + self.m_remain_slot < self.m_total_slot: self.m_remain_slot += 1 self.m_protect = False self.m_guardian = False elif effect == 'Hammer': if self.m_remain_hammer > 0: self.m_remain_hammer -= 1 self.m_total_slot += 1 self.m_remain_slot += 1 self.m_protect = False self.m_safety = False elif effect == 'Potential Stamp': if len(self.m_pot.m_lines) == 2: self.m_pot.expand() elif effect == 'Protect': self.m_protect = True elif effect == 'Guardian': self.m_guardian = True elif effect == 'Safety': self.m_safety = True return True def applyScroll(self, effect): scrollType, stat = Equip.scrollLib.getScrollStat(effect, self) if scrollType == 'decisive': for key, value in stat.items(): self[key] = self[key] + value elif scrollType == 'chaos': mutable = ['str', 'dex', 'int', 'luk', 'hp', 'mp', 'watt', 'matt', 'wdef', 'mdef', 'accuracy', 'avoid'] for option in mutable: if self[option] != 0: r = random.random() for i in range(min(stat.keys()), max(stat.keys())): if r > stat[i]: continue else: val = i if option == 'hp' or option == 'mp': val *= 10 self[option] = max(0, self[option] + val) break self.m_remain_slot -= 1 self.m_success += 1
# DIIS space selection = list( numpy.where(numpy.abs(coeff) < self.diis_vector_threshold)[0]) selection.reverse() for i in selection: self.guess_storage.pop(i) self.diff_storage.pop(i) return new_guess if __name__ == '__main__': import sys from fields import get_static_field from potential import Potential from util import get_interaction_matrix, get_polarization_matrix filename = sys.argv[1] p = Potential.from_file(filename) polmat = get_polarization_matrix(p) intmat = get_interaction_matrix(p, induced_damping=True) field = get_static_field(p) s = IterativeDIISSolver(polmat, intmat, field, verbose=True, threshold=1.0e-5) result = s.Solve()
def test_add_potentials_with_only_polarization(self): """ Potential addition with only polarization """ p = Potential.from_file('nomul.pot') p2 = p + p self.assertEqual(p2.nsites, 2) self.assertEqual(p2.npols, 2)
import numpy as np from potential import Potential # pot_x1 = Potential([0], np.array([2]), np.array([0.9, 0.1])) pot_x2 = Potential([1], np.array([2]), np.array([1.0, 1.0])) pot_x2x1 = Potential([1, 0], np.array([2, 2]), np.array([[0.9, 0.2], [0.1, 0.8]])) pot_x1x2 = Potential([0, 1], np.array([2, 2]), np.array([[0.9, 0.1], [0.2, 0.8]])) pot_m12_x2 = Potential([1], np.array([2]), np.array([0.83, 0.17])) res1 = pot_x2x1.multiply(pot_x1) res1_ver = Potential([1, 0], np.array([2, 2]), np.array([[0.81, 0.02], [0.09, 0.08]])) print res1 assert res1 == res1_ver res2 = pot_x1x2.multiply(pot_x1) res2_ver = Potential([0, 1], np.array([2, 2]), np.array([[0.81, 0.09], [0.02, 0.08]])) print res2 assert res2 == res2_ver res3 = pot_x2.multiply(pot_m12_x2) res3_ver = Potential([1], np.array([2]), np.array([0.83, 0.17])) assert res3 == res3_ver print res3 res4 = pot_x1.multiply(pot_x1x2, True) print 'res4' print res4
def __init__(self, id, nodes, sizes, values=None): self.id = id self.potential = Potential(nodes, sizes, values)
import numpy as np from potential import Potential # pot_x1 = Potential([0], np.array([2]), np.array([0.9, 0.1])) pot_x2 = Potential([1], np.array([2]), np.array([1.0, 1.0])) pot_x2x1 = Potential([1, 0], np.array([2, 2]), np.array([[0.9, 0.2], [0.1, 0.8]])) pot_x1x2 = Potential([0, 1], np.array([2, 2]), np.array([[0.9, 0.1], [0.2, 0.8]])) pot_m12_x2 = Potential([1], np.array([2]), np.array([0.83, 0.17])) res1 = pot_x2x1.multiply(pot_x1) res1_ver = Potential([1, 0], np.array([2, 2]), np.array([[0.81, 0.02], [0.09, 0.08]])) print res1 assert res1 == res1_ver res2 = pot_x1x2.multiply(pot_x1) res2_ver = Potential([0, 1], np.array([2, 2]), np.array([[0.81, 0.09], [0.02, 0.08]])) print res2 assert res2 == res2_ver res3 = pot_x2.multiply(pot_m12_x2) res3_ver = Potential([1], np.array([2]), np.array([0.83, 0.17])) assert res3 == res3_ver print res3
def test_nopol_potential_fails(self): """ testing that potential without polarizibility correctly loads """ p = Potential.from_file('nopol.pot') self.assertEqual(p.nsites, 3) self.assertEqual(p.npols, 0)
pot_surface3 = Surface_1D_analytic(np.cos, relative=True) complete_interaction = [{ 'function': pot_surface3, 'coordinates': [0, 1] }, { 'function': pot_surface3, 'coordinates': [1, 2] }, { 'function': pot_surface3, 'coordinates': [2, 3] }, { 'function': pot_surface3, 'coordinates': [3, 4] }] pot_obj = Potential(complete_interaction) initial_conditions = { 'coordinates': np.array([4, 0, 0, 0, 0]), 'velocity': np.array([3, 0, 0, 0, 0]), 'masses': np.array([300.0, 1.0, 1.0, 1.0, 1.0]) } md = MolecularDynamics(initial_conditions=initial_conditions, potential=pot_obj) md.calculate_nve() md.calculate_nvt()
import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm import MDAnalysis as md from density import Density from potential import Potential u = md.Universe('trj/md128_280k.tpr', 'trj/md128_280k.xtc') h2o = u.select_atoms('name OW or name HW1 or name HW2') pot = Potential(u) for _ in tqdm(u.trajectory, total=len(u_trajectory)): pot.potential_matrix() ''' plt.plot(t, np.mean(rot, axis=1), 'o') plt.plot(ref[:,0], ref[:,2]/512, '-') plt.xlim((0, 0.2)) plt.show() '''
def run_test(configData): # Example with config Data if not configData: print("Using configuration file: ", configData) # Set up our potential class # TODO: Convert potential from config file # We will pass a dictionary that we will get from the config file. For now we construct it manually potential_parameters = {} # define fields and constants for the time being # define constants const_2, const_3, const_4 = sympy.symbols('c2,c3,c4') constants = (const_2, const_3, const_4) # define fields field_1, field_2 = sympy.symbols('f1,f2') fields = (field_1, field_2) # Define the potential potential_form = const_2 * field_1**2 + const_3 * field_1**3 + const_4 * field_1**4 + field_2**4 # Vevs and masses vevs = (246., 0.) masses = (0., 125. ) # some ordering may be required to match diagonalisation # TODO: Are minimization bounds going to be derivived or inputs?. If inputs, put here and feed into potential parameters # Bounds and Initial Points # Build the dictionary potential_parameters['fields'] = fields potential_parameters['constants'] = constants potential_parameters['potential_form'] = potential_form potential_parameters['vevs'] = vevs potential_parameters['masses'] = masses potential_parameters['unknown_constants'] = (const_2, const_4) potential_parameters['known_constants'] = (const_3, ) potential_parameters['known_constants_vals'] = (-1.5 * 125.**2 / 246. / 3, ) # Create our potential class # This stores all info about the potential - See the class potential = Potential(potential_parameters) # potential currently cannot handle pure mass terms # solve the constants from 1st derivative and hessian of potential # This will be private function - But for testing lets run it # TODO: Make sure there are no more free constants after reduction print("==============coupling constants reduction============") print(potential._constant_reduction) print("======================================================") # ####working out the free-parameters###### print("===============printing free constants================") print(potential.remaining_vars()) print("======================================================") # print("=====================test outputs=====================") # # Only printing for testing. Private member # print("Constrained Potential :", potential._constrained_potential) # # # Set some constants # constant_val = {'c3': -1.5 * 125. ** 2 / 246. / 3} # print("Potential with c3 Fixed :", potential.set_constants(constant_val)) # # # Get Numeric Values of Constants given fixed unknown variables # print("Numeric Values for Constants with c3 fixed :", potential.numeric_const_values(constant_val)) # print("======================================================") # define the bounds of the minimisation, where the c20vals etc are set to fix the value # define initial point for minimisation # Initial point for finding minima # Bounds for the minimization # TODO: Implement minimization with bounds and initial point. # TODO: Implementation is done in the class not here! # TODO: Bounds can be class members and set up from config. Or dervived in the constructor # bnds = ((-400., 400.), (-400., 400.), (c20val, c20val), (c30val, c30val), (c40val, c40val)) # bounds = < insert some points > #bounds=((-400.,400),) # run minimisation # TODO: for each field add the range (-400.,400.) (bounds, initial_point) = (((-400., 400), (-400., 400.)), [0., 0.]) print("=========printing solutions from minimisation=========") #print(potential.func_to_minimise()) print(potential.minimise(bounds, initial_point)) #print(Potential.out) print("======================================================") # Plotting """ Leave for Now... will fix soon