static double my_f(const gsl_vector *v,void *params) { t_remd_data *d = (t_remd_data *) params; double penalty=0; int i; for(i=0; (i<d->nparams); i++) { d->params[i] = gsl_vector_get(v, i); if (d->params[i] < 0) penalty += 10; } if (penalty > 0) return penalty; else return calc_d2(d); }
static void dump_remd_parameters(FILE *gp, t_remd_data *d, const char *fn, const char *fn2, const char *rfn, const char *efn, const char *mfn, int skip, real tref, output_env_t oenv) { FILE *fp, *hp; int i, j, np = d->nparams; real rhs, tauf, taub, fff, DG; real *params; const char *leg[] = { "Measured", "Fit", "Difference" }; const char *mleg[] = { "Folded fraction", "DG (kJ/mole)"}; char **rleg; real fac[] = { 0.97, 0.98, 0.99, 1.0, 1.01, 1.02, 1.03 }; #define NFAC asize(fac) real d2[NFAC]; double norm; integrate_dfdt(d); print_tau(gp, d, tref); norm = (d->bDiscrete ? 1.0/d->nmask : 1.0); if (fn) { fp = xvgropen(fn, "Optimized fit to data", "Time (ps)", "Fraction Folded", oenv); xvgr_legend(fp, asize(leg), leg, oenv); for (i = 0; (i < d->nframe); i++) { if ((skip <= 0) || ((i % skip) == 0)) { fprintf(fp, "%12.5e %12.5e %12.5e %12.5e\n", d->time[i], d->sumft[i]*norm, d->sumfct[i]*norm, (d->sumft[i]-d->sumfct[i])*norm); } } ffclose(fp); } if (!d->bSum && rfn) { snew(rleg, d->nreplica*2); for (i = 0; (i < d->nreplica); i++) { snew(rleg[2*i], 32); snew(rleg[2*i+1], 32); sprintf(rleg[2*i], "\\f{4}F(t) %d", i); sprintf(rleg[2*i+1], "\\f{12}F \\f{4}(t) %d", i); } fp = xvgropen(rfn, "Optimized fit to data", "Time (ps)", "Fraction Folded", oenv); xvgr_legend(fp, d->nreplica*2, (const char**)rleg, oenv); for (j = 0; (j < d->nframe); j++) { if ((skip <= 0) || ((j % skip) == 0)) { fprintf(fp, "%12.5e", d->time[j]); for (i = 0; (i < d->nreplica); i++) { fprintf(fp, " %5f %9.2e", is_folded(d, i, j), d->fcalt[i][j]); } fprintf(fp, "\n"); } } ffclose(fp); } if (fn2 && (d->nstate > 2)) { fp = xvgropen(fn2, "Optimized fit to data", "Time (ps)", "Fraction Intermediate", oenv); xvgr_legend(fp, asize(leg), leg, oenv); for (i = 0; (i < d->nframe); i++) { if ((skip <= 0) || ((i % skip) == 0)) { fprintf(fp, "%12.5e %12.5e %12.5e %12.5e\n", d->time[i], d->sumit[i]*norm, d->sumict[i]*norm, (d->sumit[i]-d->sumict[i])*norm); } } ffclose(fp); } if (mfn) { if (bBack(d)) { fp = xvgropen(mfn, "Melting curve", "T (K)", "", oenv); xvgr_legend(fp, asize(mleg), mleg, oenv); for (i = 260; (i <= 420); i++) { tauf = tau(d->params[epAuf], d->params[epEuf], 1.0*i); taub = tau(d->params[epAfu], d->params[epEfu], 1.0*i); fff = taub/(tauf+taub); DG = BOLTZ*i*log(fff/(1-fff)); fprintf(fp, "%5d %8.3f %8.3f\n", i, fff, DG); } ffclose(fp); } } if (efn) { snew(params, d->nparams); for (i = 0; (i < d->nparams); i++) { params[i] = d->params[i]; } hp = xvgropen(efn, "Chi2 as a function of relative parameter", "Fraction", "Chi2", oenv); for (j = 0; (j < d->nparams); j++) { /* Reset all parameters to optimized values */ fprintf(hp, "@type xy\n"); for (i = 0; (i < d->nparams); i++) { d->params[i] = params[i]; } /* Now modify one of them */ for (i = 0; (i < NFAC); i++) { d->params[j] = fac[i]*params[j]; d2[i] = calc_d2(d); fprintf(gp, "%s = %12g d2 = %12g\n", epnm(np, j), d->params[j], d2[i]); fprintf(hp, "%12g %12g\n", fac[i], d2[i]); } fprintf(hp, "&\n"); } ffclose(hp); for (i = 0; (i < d->nparams); i++) { d->params[i] = params[i]; } sfree(params); } if (!d->bSum) { for (i = 0; (i < d->nreplica); i++) { fprintf(gp, "Chi2[%3d] = %8.2e\n", i, d->d2_replica[i]); } } }
static void print_tau(FILE *gp, t_remd_data *d, real tref) { real tauf, taub, ddd, fff, DG, DH, TDS, Tm, Tb, Te, Fb, Fe, Fm; int i, np = d->nparams; ddd = calc_d2(d); fprintf(gp, "Final value for Chi2 = %12.5e (%d replicas)\n", ddd, d->nmask); tauf = tau(d->params[epAuf], d->params[epEuf], tref); fprintf(gp, "%s = %12.5e %s = %12.5e (kJ/mole)\n", epnm(np, epAuf), d->params[epAuf], epnm(np, epEuf), d->params[epEuf]); if (bBack(d)) { taub = tau(d->params[epAfu], d->params[epEfu], tref); fprintf(gp, "%s = %12.5e %s = %12.5e (kJ/mole)\n", epnm(np, epAfu), d->params[epAfu], epnm(np, epEfu), d->params[epEfu]); fprintf(gp, "Equilibrium properties at T = %g\n", tref); fprintf(gp, "tau_f = %8.3f ns, tau_b = %8.3f ns\n", tauf/1000, taub/1000); fff = taub/(tauf+taub); DG = BOLTZ*tref*log(fff/(1-fff)); DH = d->params[epEfu]-d->params[epEuf]; TDS = DH-DG; fprintf(gp, "Folded fraction F = %8.3f\n", fff); fprintf(gp, "Unfolding energies: DG = %8.3f DH = %8.3f TDS = %8.3f\n", DG, DH, TDS); Tb = 260; Te = 420; Tm = 0; Fm = 0; Fb = folded_fraction(d, Tb); Fe = folded_fraction(d, Te); while ((Te-Tb > 0.001) && (Fm != 0.5)) { Tm = 0.5*(Tb+Te); Fm = folded_fraction(d, Tm); if (Fm > 0.5) { Fb = Fm; Tb = Tm; } else if (Fm < 0.5) { Te = Tm; Fe = Fm; } } if ((Fb-0.5)*(Fe-0.5) <= 0) { fprintf(gp, "Melting temperature Tm = %8.3f K\n", Tm); } else { fprintf(gp, "No melting temperature detected between 260 and 420K\n"); } if (np > 4) { char *ptr; fprintf(gp, "Data for intermediates at T = %g\n", tref); fprintf(gp, "%8s %10s %10s %10s\n", "Name", "A", "E", "tau"); for (i = 0; (i < np/2); i++) { tauf = tau(d->params[2*i], d->params[2*i+1], tref); ptr = epnm(d->nparams, 2*i); fprintf(gp, "%8s %10.3e %10.3e %10.3e\n", ptr+1, d->params[2*i], d->params[2*i+1], tauf/1000); } } } else { fprintf(gp, "Equilibrium properties at T = %g\n", tref); fprintf(gp, "tau_f = %8.3f\n", tauf); } }
//------------------------------------------------------------------ // //------------------------------------------------------------------ void AlgNuc3pt::run() { char *fname = "run()"; VRB.Func(cname,fname); if( Nuc3pt_arg->DoHalfFermion == 2 && Nuc3pt_arg->DoConserved == 1 ) { ERR.General(cname,fname,"DoConserved should be 2 when DoHalfFermion = 2!!!\n"); } // Always do point sink... Nuc2pt Nuc_c5(NUC_G5C,POINT) ; // do a few mesons for kicks Meson pion; pion.setGamma(-5); Meson vector[3]; vector[0].setGamma(0); vector[1].setGamma(1); vector[2].setGamma(2); char *MesonSrcTag ; switch (Nuc3pt_arg->src_type){ case POINT: MesonSrcTag = "POINT" ; break; case BOX: MesonSrcTag = "GFBOX" ; break; case GAUSS_GAUGE_INV: MesonSrcTag = "GSmear" ; break; default: // It should never get here! MesonSrcTag = "" ;// make GCC happy! ERR.General(cname,fname,"OOPS!!!\n"); break ; } pion.setSrc(MesonSrcTag); vector[0].setSrc(MesonSrcTag); vector[1].setSrc(MesonSrcTag); vector[2].setSrc(MesonSrcTag); int ZeroMom[3] ; ZeroMom[0]=ZeroMom[1]=ZeroMom[2]=0 ; ProjectType ptype[4] ; ptype[0] = PPAR_5X ; ptype[1] = PPAR_5Y ; ptype[2] = PPAR_5Z ; ptype[3] = PPAR_5 ; OpenFile(); Fprintf(fp,"List of momenta:\n"); int Nmom(56) ; ThreeMom sink_mom[56] ; int count(0); for(int p1=-2;p1<3;p1++) for(int p2=-2;p2<3;p2++) for(int p3=-2;p3<3;p3++) if((p1*p1+p2*p2+p3*p3)<=Nuc3pt_arg->MaxMom2) if((p1*p1+p2*p2+p3*p3)!=0)// eliminate the p=0 { Fprintf(fp,"\t\t\t%i: %i %i %i\n",count,p1,p2,p3); sink_mom[count] = ThreeMom(p1,p2,p3); count++ ; } CloseFile(); if(count>56) ERR.General(cname,fname,"No of momenta > 56\n"); //set the number of momenta Nmom=count ; // non-zero momentum give bad signal with BOX sources... // do not ever do it!! if( Nuc3pt_arg->src_type == BOX && (Nuc3pt_arg->BoxEnd - Nuc3pt_arg->BoxStart) != GJP.Xnodes()*GJP.XnodeSites()-1) Nmom=0 ; Float qmass(Nuc3pt_arg->Mass(0)) ; // Loop over source times OpenFile(); Fprintf(fp,"Doing quark Mass: %g\n", qmass); Fprintf(fp,"Doing %d sources inc= %d\n", Nuc3pt_arg->num_src, Nuc3pt_arg->source_inc); CloseFile(); // start: ts=t_source, then increment by "source_inc" int ts=Nuc3pt_arg->t_source; int mt[5]; if ( Nuc3pt_arg->num_mult > 1) ts=Nuc3pt_arg->mt[0]; // use the t_source, source_inc counter if not doing MultGauss. -MFL for(int i_source=0; i_source < Nuc3pt_arg->num_src; i_source++) { int t_sink = (ts + Nuc3pt_arg->t_sink)%(GJP.Tnodes()*GJP.TnodeSites()); OpenFile(); Fprintf(fp,"Doing source/sink time slices: %d %d\n", ts, t_sink); CloseFile(); // First calculate the needed two point functions Nuc_c5.Zero() ; pion.Zero() ; vector[0].Zero() ; vector[1].Zero() ; vector[2].Zero() ; char out_prop[200]; // If we don't do the coherent sink, we only allocate 1 propagator // hence we reuse the memory for the propagator for different source locations. // Otherwise we need to have all the propagators present at the same time // -- MFL int n; if (Nuc3pt_arg->num_src == num_qprop) n = i_source; else n = 0; GetThePropagator(n, ts, qmass); Nuc_c5.calcNucleon(*q_prop[n]) ; pion.setMass(qmass,qmass) ; pion.calcMeson(*q_prop[n],*q_prop[n]) ; vector[0].setMass(qmass,qmass) ; vector[0].calcMeson(*q_prop[n],*q_prop[n]) ; vector[1].setMass(qmass,qmass) ; vector[1].calcMeson(*q_prop[n],*q_prop[n]) ; vector[2].setMass(qmass,qmass) ; vector[2].calcMeson(*q_prop[n],*q_prop[n]) ; // Print out 2pt function results //---------------------------------------------------------------- OpenFile(); Nuc_c5.Print(fp) ; pion.Print(fp) ; vector[0].Print(fp) ; vector[1].Print(fp) ; vector[2].Print(fp) ; CloseFile(); //Do the projections needed for disconnected Ga for(int p(0);p<4;p++) { Nuc2pt Nuc_c5_p(NUC_G5C,POINT,ptype[p]) ; // Nuc_c5_p.Zero(); if(Nuc3pt_arg->DoGa1Proj||(p>2)) { Nuc_c5_p.calcNucleon(*q_prop[n]) ; OpenFile(); Nuc_c5_p.Print(fp) ; CloseFile(); } } //do some non-zero momenta { Nuc2pt Nuc_c5_p(NUC_G5C,POINT,PPAR_5) ; for(int m(0);m<Nmom;m++) { Nuc_c5.Zero() ; Nuc_c5.calcMomNucleon(*q_prop[n],sink_mom[m]) ; // Print out 2pt function results //---------------------------------------------------------------- OpenFile(); Nuc_c5.Print(fp) ; CloseFile(); // Calculate the smeared smeared momentum two point function // to extract alpha for NEDM reweighting Nuc_c5_p.Zero() ; Nuc_c5_p.calcMomNucleon(*q_prop[n],sink_mom[m]) ; // Print out 2pt function result //---------------------------------------------------------------- OpenFile(); Nuc_c5_p.Print(fp) ; CloseFile(); }// End momentum } //Do the smeared sink stuff if((Nuc3pt_arg->src_type==GAUSS_GAUGE_INV)&&(Nuc3pt_arg->DoSS2ptF)){ Nuc2pt Nuc_c5_ss(NUC_G5C,GAUSS_GAUGE_INV) ; QPropWGaussSrc smr(*q_prop[n]) ; QPropWGaussArg gauss_arg = q_prop[n]->GaussArg(); smr.GaussSmearSinkProp(gauss_arg); // First calculate the needed two point functions Nuc_c5_ss.Zero() ; Nuc_c5_ss.calcNucleon(smr) ; pion.Zero() ; pion.calcMeson(smr,smr) ; // Print out 2pt function results //---------------------------------------------------------------- OpenFile(); Nuc_c5_ss.Print(fp) ; pion.Print(fp) ; CloseFile(); //Do the projections needed for disconnected Ga for(int p(0);p<4;p++) { Nuc2pt Nuc_c5_ss_p(NUC_G5C,GAUSS_GAUGE_INV,ptype[p]) ; if(Nuc3pt_arg->DoGa1Proj||(p>2)){ Nuc_c5_ss_p.calcNucleon(smr) ; OpenFile(); Nuc_c5_ss_p.Print(fp) ; CloseFile(); } } //do some non-zero momenta { Nuc2pt Nuc_c5_ss_p(NUC_G5C,GAUSS_GAUGE_INV,PPAR_5) ; for(int m(0);m<Nmom;m++) { Nuc_c5_ss.Zero() ; Nuc_c5_ss.calcMomNucleon(smr,sink_mom[m]) ; // Print out 2pt function results //---------------------------------------------------------------- OpenFile(); Nuc_c5_ss.Print(fp) ; CloseFile(); // Calculate the smeared smeared momentum two point function // to extract alpha for NEDM reweighting Nuc_c5_ss_p.Zero() ; Nuc_c5_ss_p.calcMomNucleon(smr,sink_mom[m]) ; // Print out 2pt function results //---------------------------------------------------------------- OpenFile(); Nuc_c5_ss_p.Print(fp) ; CloseFile(); }// End momentum if(Nuc3pt_arg->DoHalfFermion == 2) { OpenFile(); Fprintf(fp,"DoHalfFermion=%d non-rel nucleon 2-pt\n",Nuc3pt_arg->DoHalfFermion); CloseFile(); q_prop[n]->NonRelProp( 1 ); { Nuc2pt Nuc_c5_p_nr(NUC_G5C,POINT) ; Nuc_c5_p_nr.Zero() ; Nuc_c5_p_nr.calcNucleon(*q_prop[n]) ; OpenFile(); Nuc_c5_p_nr.Print(fp) ; CloseFile(); for(int m(0);m<Nmom;m++) { Nuc_c5_p_nr.Zero() ; Nuc_c5_p_nr.calcMomNucleon(*q_prop[n],sink_mom[m]) ; OpenFile(); Nuc_c5_p_nr.Print(fp); CloseFile(); } } smr.NonRelProp( 0 ); int dohalf = Nuc3pt_arg->DoHalfFermion; // First calculate the needed two point functions { Nuc2pt Nuc_c5_g_nr(NUC_G5C,GAUSS_GAUGE_INV) ; Nuc_c5_g_nr.Zero() ; Nuc_c5_g_nr.calcNucleon(smr) ; // Print out 2pt function results //---------------------------------------------------------------- OpenFile(); Nuc_c5_g_nr.Print(fp) ; CloseFile(); //do some non-zero momenta for(int m(0);m<Nmom;m++) { Nuc_c5_g_nr.Zero() ; Nuc_c5_g_nr.calcMomNucleon(smr,sink_mom[m]) ; // Print out 2pt function results //---------------------------------------------------------------- OpenFile(); Nuc_c5_g_nr.Print(fp) ; CloseFile(); }// End momentum } } // DoHalfF = 2 // } // End loop over qprop // Finally, smear the sink at time t_sink for 3-pt functions (below) for(int nt=0; nt<Nuc3pt_arg->num_mult; nt++){ // Multi Gauss t_sink set mt[nt]=Nuc3pt_arg->mt[nt]; //save Nuc3pt_arg->mt[nt]+=Nuc3pt_arg->t_sink; // locations of the proton sinks Nuc3pt_arg->mt[nt]=Nuc3pt_arg->mt[nt]%(GJP.Tnodes()*GJP.TnodeSites()); q_prop[n]->GaussSmearSinkProp(Nuc3pt_arg->mt[nt],q_prop[n]->GaussArg()); } } //end smeared sink } //Now do the 3pt functions // If doing coherent sinks, don't calculate the 3pt functions until all the // forward propagators have been calculated. --MFL int do_seq = 0; // int t_sink; if(Nuc3pt_arg->calc_seqQ != MULT_SEQ && Nuc3pt_arg->calc_seqQ != WRITE_MULT_SEQ && Nuc3pt_arg->calc_seqQ != READ_MULT_SEQ) { do_seq = 1; t_sink = ts + Nuc3pt_arg->t_sink; } // once all the forward propagators have been calculated, // do the sequential propagaotrs. --MFL else if (i_source == num_qprop-1) { do_seq = 1; t_sink = Nuc3pt_arg->t_source + Nuc3pt_arg->t_sink; } if(Nuc3pt_arg->DoUnPolarized && do_seq) { // for conserved vector currents Gamma Gt(T); Nuc3ptCons VectCurr(Gt); Nuc3ptCons *VectCurrp[4]; if(Nuc3pt_arg->DoConserved) { for (int i(X);i<4;i++){ DIR d = DIR(i) ; Gamma G(d); VectCurrp[i] = new Nuc3ptCons(Nmom,G) ; } } OpenFile(); Fprintf(fp,"UnPolarized Zero mom.\n"); CloseFile(); //first do the zero momentum un-polarized stuff //up-quark GetTheSeqPropagator(t_sink,qmass, PROT_U_SEQ,ZeroMom,PPAR); //down-quark GetTheSeqPropagator(t_sink,qmass, PROT_D_SEQ,ZeroMom,PPAR); calc_Scalar(); //needed for the sigma term calc_Vector(); //Vector current calc_X_q_b(); //<x>_q (b) does not need non-zero momentum for(int i(0) ; i<Nmom ; i++) calc_Vector(sink_mom[i]); //conserved current if(Nuc3pt_arg->DoConserved) { if(GJP.Snodes()==2) u_s_prop->SwapQPropLs(); for ( int nt = 0; nt < num_qprop; nt++ ) { VectCurr.Calc3pt(*u_s_prop,*q_prop[nt]); for (int i(X);i<4;i++) VectCurrp[i]->Calc3pt(*u_s_prop,*q_prop[nt],Nmom,sink_mom); } char* dummy; u_s_prop->RestoreOrgProp(dummy,1); u_s_prop->DeleteQPropLs(); if(GJP.Snodes()==2) d_s_prop->SwapQPropLs(); for ( int nt = 0; nt < num_qprop; nt++ ) { VectCurr.Calc3pt(*d_s_prop,*q_prop[nt]); for (int i(X);i<4;i++) VectCurrp[i]->Calc3pt(*d_s_prop,*q_prop[nt],Nmom,sink_mom); } d_s_prop->RestoreOrgProp(dummy,1); d_s_prop->DeleteQPropLs(); OpenFile(); Fprintf(fp,"UnPolarized Zero mom Conserved Vector\n"); VectCurr.Print(fp) ; for (int i(X);i<4;i++) VectCurrp[i]->Print(fp,Nmom,sink_mom) ; CloseFile(); } if(Nuc3pt_arg->DoConserved) { for (int i(X);i<4;i++) delete VectCurrp[i]; } } if(Nuc3pt_arg->DoUnPolarizedMom && do_seq) { OpenFile(); Fprintf(fp,"UnPolarized mom.\n"); CloseFile(); int UnitMom[3]; UnitMom[1]=1 ; // check the conventions UnitMom[0]=UnitMom[2]=0 ; //up-quark GetTheSeqPropagator(t_sink,qmass, PROT_U_SEQ,UnitMom,PPAR); //down-quark GetTheSeqPropagator(t_sink,qmass, PROT_D_SEQ,UnitMom,PPAR); calc_Scalar(); //needed for the sigma term calc_Vector(); //Vector current calc_X_q_b(); //<x>_q (b) does not need non-zero momentum for(int i(0) ; i<Nmom ; i++) calc_Vector(sink_mom[i]); calc_X_q_a(); //<x>_q (a) needs non-zero momentum calc_X2_q(); //<x^2>_q needs non-zero momentum calc_X3_q(); //<x^3>_q needs non-zero momentum } // Polarized if(Nuc3pt_arg->DoPolarized && do_seq) { // for conserved axial and vector currents Gamma G5z(G5,Z); Nuc3ptCons AxialCurr(Complex(0.0,1.0),G5z); Nuc3ptCons *AxialCurrp[4]; Nuc3ptCons *VectCurrp[4]; if(Nuc3pt_arg->DoConserved) { for (int i(X);i<4;i++){ DIR d = DIR(i); Gamma G5d(G5,d); AxialCurrp[i] = new Nuc3ptCons(Nmom,Complex(0.0,1.0),G5d); d = DIR(i) ; Gamma G(d); VectCurrp[i] = new Nuc3ptCons(Nmom,G) ; } } OpenFile(); Fprintf(fp,"Polarized Zero mom.\n"); CloseFile(); // //up-quark GetTheSeqPropagator(t_sink,qmass, PROT_U_SEQ,ZeroMom,PPAR_5Z); //down-quark GetTheSeqPropagator(t_sink,qmass, PROT_D_SEQ,ZeroMom,PPAR_5Z); calc_Axial(); //Axial-Vector current i Gamma_5 Gamma_z calc_Tensor() ;//Tensor current i Gamma_5 Gamma_z Gamma_t calc_X_Dq_b() ; calc_d1() ; for(int i(0) ; i<Nmom ; i++){ calc_Vector(sink_mom[i]);//neutron EDM and mangetic moment calc_Axial(sink_mom[i]);//axial form factors calc_EnergyMomentum(sink_mom[i]) ; // proton spin calc_PScalar(sink_mom[i]);//pseudoscalar form factors } if(Nuc3pt_arg->DoConserved) { if(GJP.Snodes()==2) { u_s_prop->SwapQPropLs(); d_s_prop->SwapQPropLs(); } for ( int nt = 0; nt < num_qprop; nt++ ) { AxialCurr.Calc3pt(*u_s_prop,*q_prop[nt]); for(int i(X);i<4;i++){ AxialCurrp[i]->Calc3pt(*u_s_prop,*q_prop[nt],Nmom,sink_mom); VectCurrp[i]->Calc3pt(*u_s_prop,*q_prop[nt],Nmom,sink_mom); } AxialCurr.Calc3pt(*d_s_prop,*q_prop[nt]); for(int i(X);i<4;i++){ AxialCurrp[i]->Calc3pt(*d_s_prop,*q_prop[nt],Nmom,sink_mom); VectCurrp[i]->Calc3pt(*d_s_prop,*q_prop[nt],Nmom,sink_mom); } OpenFile(); Fprintf(fp,"Polarized Zero mom Conserved Axial and Vector\n"); AxialCurr.Print(fp) ; for (int i(X);i<4;i++) { VectCurrp[i]->Print(fp,Nmom,sink_mom) ; } for (int i(X);i<4;i++) { AxialCurrp[i]->Print(fp,Nmom,sink_mom) ; } CloseFile(); } char* dummy; u_s_prop->RestoreOrgProp(dummy,1); u_s_prop->DeleteQPropLs(); d_s_prop->RestoreOrgProp(dummy,1); d_s_prop->DeleteQPropLs(); } if(Nuc3pt_arg->DoConserved) { for(int i(X);i<4;i++) { delete AxialCurrp[i]; delete VectCurrp[i]; } } } if(Nuc3pt_arg->DoPolarizedMom && do_seq) { OpenFile(); Fprintf(fp,"Polarized with mom.\n"); CloseFile(); int UnitMom[3]; UnitMom[1]=1 ; // check the conventions UnitMom[0]=UnitMom[2]=0 ; //up-quark GetTheSeqPropagator(t_sink,qmass, PROT_U_SEQ,UnitMom,PPAR_5Z); //down-quark GetTheSeqPropagator(t_sink,qmass, PROT_D_SEQ,UnitMom,PPAR_5Z); for(int i(0) ; i<Nmom ; i++){ calc_Vector(sink_mom[i]);//neutron EDM and magnetic moment calc_Axial(sink_mom[i]);//axial form factors calc_EnergyMomentum(sink_mom[i]) ; // proton spin } calc_X_Dq_a() ; calc_X2_Dq() ; calc_X_dq() ; calc_d2() ; } if(Nuc3pt_arg->DoConserved) q_prop[n]->DeleteQPropLs(); ts+=Nuc3pt_arg->source_inc; for(int nt=0; nt<Nuc3pt_arg->num_mult; nt++){ Nuc3pt_arg->mt[nt]=mt[nt]; Nuc3pt_arg->mt[nt]+=Nuc3pt_arg->source_inc; } /* if(i_source==1){ // obsolete. commented out --MFL ts+=Nuc3pt_arg->mt[4]; for(int nt=0; nt<Nuc3pt_arg->num_mult; nt++){ Nuc3pt_arg->mt[nt]+=Nuc3pt_arg->mt[4]; } } */ } // end loop over source timeslices } // end run