xneg, xpos, converged = sim.xinsertnegpos(dx0=dxinit, dxfactor=dxfactor2, dxmin=dxmin, poszonly=True, xmid=xmidpos) if converged: break xmidpos = (xneg + xpos) / 2.0 sim.adddislo(Dislocation(xpos, float(i + 1) * d, 0.0, b)) sim.adddislo(Dislocation(xneg, float(i + 1) * d, pi, b)) sim.plotsig(plotdim, disloscale=disloscale, res=plotres, pmax=maxstressplot, fname=destfolder + 'step' + str(i + 1) + 'a.png') sim.stepton_fcriterion3(nmax, dxmaxperstep, fmaxperstep, ncutstart=1e8) sim.plotsig(plotdim, disloscale=disloscale, res=plotres, pmax=maxstressplot, fname=destfolder + 'step' + str(i + 1) + 'b.png') print 'Step ' + str(i + 1) + ' part 1 used ' + str( sim.nsteps) + ' iterations' logfile.write('Step ' + str(i + 1) + ' part 1 used ' + str(sim.nsteps) + ' iterations\n') sim.reset() #positive z dislocation dipole xneg, xpos, converged = sim.xinsertnegpos(dx0=dxinit,
poszonly=True) if converged: #try smaller increment xneg, xpos, converged = sim.xinsertnegpos(dx0=dxinit, dxfactor=dxfactor2, dxmin=dxmin, poszonly=True) if converged: break sim.adddislo(Dislocation(xpos, float(i + 1) * d, 0.0, b)) sim.adddislo(Dislocation(xneg, float(i + 1) * d, pi, b)) sim.plotsig(plotdim, disloscale=disloscale, res=plotres, pmax=maxstressplot, fname=destfolder + 'step' + str(i + 1) + 'a.png') sim.stepton_fcriterion3(nmax, dxmaxperstep, fmaxperstep) sim.plotsig(plotdim, disloscale=disloscale, res=plotres, pmax=maxstressplot, fname=destfolder + 'step' + str(i + 1) + 'b.png') print 'Step ' + str(i + 1) + ' part 1 used ' + str( sim.nsteps) + ' iterations' logfile.write('Step ' + str(i + 1) + ' part 1 used ' + str(sim.nsteps) + ' iterations\n') sim.reset() #positive z dislocation dipole xneg, xpos, converged = sim.xinsertnegpos(dx0=dxinit,