Hi Yang,
After studying your graphic, I did the following code that works, or at least output the list of pairs (x,y):
$HistoryLength=0;
ClearSystemCache[];
ClearAll["Global`*"];
SetDirectory["/home/marcelo/Documentos/Tomlinson/2D"];
Module[{x,y,i,j, FmolaX,FmolaY,c={0,0},a=2.46,k=1.5625,V=0.5},
Emin[go_,ho_]:=Module[{g=go,h=ho},
{x,y}/.Take[Flatten[N[FindMinimum[-V *(2 Cos[(2 Pi x)/a]* Cos[(2 Pi y)/(a Sqrt[3])]+Cos[(4 Pi y)/(a Sqrt[3])])+ (k/2)*(x-g)^2+(k/2)*(y-h)^2,{{x,First},{y,Last}}
,Method->"PrincipalAxis"],7]],-2]];
Do[
If[j==0,c={0,i},c={First,Last}];
c=Emin[j,i] ;
FmolaX=-16*k*(First-(j))*(10^-10);
FmolaY=-16*k*(Last-(i))*(10^-10);
{FmolaX,FmolaY}>>>"DataFxFyTomlinsonV15.txt";
c>>>"DataMinimTomlinsonV15.txt",
(*Print["the minima of the function related to step Y",i," X",j,":",c],*) {i,0.0,10.0,0.01},
{j,0.0,10.0,0.01}]
];
I explain the moto:
the equation :
-V *(2 Cos[(2 Pi x)/a]* Cos[(2 Pi y)/(a Sqrt[3])] +
Cos[(4 Pi y)/(a Sqrt[3])]) + (k/2)*(x - g)^2 + (k/2)*(y - h)^2
has to be minimized, which results {x,y}, I need them as input for the next step of my "Do", they are insert as g0 , h0, respectively: Emin[g0,h0] function.
There is a detail to be respect: as soon as the loop reach (i, "10")the next step (i,"0") do not should get the previous x,y, so I use the "If "command to prevent this.
See that I am runnig across i: 0 to 10, thgrouh J: 0 to 10, at each step ofI I run J :0 to 10, ok?
Important: "i" corespond to h0 and "J " corresppond to g0 ( x0 is g0 and h0 is y0, for each step -(x-x0)² and (y-yo)²)
But when I graphic the results (as example the DataFxFyTomlinsonV15.txt ,results) after doing some mining data
Unprotect;
ListDensityPlot[{elemFx}, Mesh -> None, InterpolationOrder -> 2,
ColorFunction -> GrayLevel]
Unprotect;
The picture is not correct to the pic that I have to reproduce....
The core is I need always the very next point (x,y) minimum, for the following step minimizing.
Are my codes correct?