from lj import lj_pot from specialize_n2d2 import n2, V12, r_12 from derivation_modeling.derivation import replace, compute_children, all_to_xhtml from derivation_modeling.util.vector_utils import replace_func from sympy import Symbol, sqrt, Integral lj_n2 = n2.new_derivation() lj_n2.set_name('lj_n2') lj_n2.set_title('Using LJ potential with N=2') lj_eqn = lj_pot.final() lj_n2.add_step(replace_func(V12, lj_eqn), 'Specialize to the LJ potential') L = 4.0 lj_n2.add_step(replace('L', L), 'Insert value for box size') lj_n2.add_step(replace('Omega', L * L), 'Insert value for box volume') lj_n2.add_step(replace('beta', 1.0), 'Insert value for temperature') # Could evaluate now in sympy #i1 = lj_n2.final().rhs #print 'Z = ',i1.evalf() # Could replace the last three steps with the following code # to evaluate parameter scan in sympy #for i in range(10): # for j in range(10): # box_len = 0.6 + j*.02 # beta = 0.5 + i*.1 # i1 = lj_n2.final().rhs # i1 = i1.subs('L',box_len)
from sympy import Symbol, Integral, exp, Function, Abs, Eq from derivation_modeling.util.vector import Vector, VectorMagnitude from derivation_modeling.util.vector_utils import decompose, add_limits, replace_func from derivation_modeling.derivation import derivation, definition, replace_definition, specialize_integral, replace, do_integral, identity from partition import partition_function, beta_def, R, V r1 = Vector('r1',dim=2) r2 = Vector('r2',dim=2) V2 = Function('V') n2 = partition_function.new_derivation() n2.set_name('specialize_n2d2') n2.set_title('Specialized to N=2, D=2') #n2.do_print() n2.add_step(specialize_integral(R,(r1,r2)),'specialize to N=2') n2.add_step(replace(V,V2(r1,r2)),'replace potential with N=2') #n2.do_print() r_cm = Vector('r_cm',dim=2) r_12 = Vector('r_12',dim=2) r_12_def = definition(r_12, r2-r1) r_cm_def = definition(r_cm, (r1+r2)/2) V12 = Function('V') # replace r1,r2 with r_12 and r_cm # tranformation of limit region is hard, but the square box should be equivalent in periodic # boundary conditions # Jacobian is 1
from lj import lj_pot from specialize_n2d2 import n2,V12,r_12 from derivation_modeling.derivation import replace, compute_children, all_to_xhtml from derivation_modeling.util.vector_utils import replace_func from sympy import Symbol, sqrt, Integral lj_n2 = n2.new_derivation() lj_n2.set_name('lj_n2') lj_n2.set_title('Using LJ potential with N=2') lj_eqn = lj_pot.final() lj_n2.add_step(replace_func(V12,lj_eqn),'Specialize to the LJ potential') L = 4.0 lj_n2.add_step(replace('L',L),'Insert value for box size') lj_n2.add_step(replace('Omega',L*L),'Insert value for box volume') lj_n2.add_step(replace('beta',1.0),'Insert value for temperature') # Could evaluate now in sympy #i1 = lj_n2.final().rhs #print 'Z = ',i1.evalf() # Could replace the last three steps with the following code # to evaluate parameter scan in sympy #for i in range(10): # for j in range(10): # box_len = 0.6 + j*.02