0
$\begingroup$

I am trying to run the following Mathematica program,

ClearAll[f,g,L,s,k,h,L];L=100;h=30;

Do[f[i_,i_]:=-2;

f[i_,j_]:=KroneckerDelta[i,j-1]+KroneckerDelta[i-1,j];
g[i_,j_]:=KroneckerDelta[i,1]*KroneckerDelta[L,j]+KroneckerDelta[i,L]*KroneckerDelta[j,1];

K:=-(Array[f,{L,L}]+Array[g,{L,L}]);

vecs:=N[Eigenvectors[K],60];

Y:=N[Inverse[Transpose[vecs]].K.Transpose[vecs],60];

l=MatrixPower[Y,1/2];

P=N[Transpose[vecs].l.Inverse[Transpose[vecs]],60];

P2=P[[1;;L-s,1;;L-s]];

S2=P2[[1;;h,1;;h]]-P2[[1;;h,s+h+1;;L-s]].N[Inverse[P2[[s+h+1;;L-s,s+h+1;;
L-s]]],60].P2[[s+h+1;;L-s,1;;h]];

X2=N[Inverse[S2],60];

P3=N[P2[[1;;h,1;;h]],60]//Chop;

PA:=P3[[1;;h,1;;h]]//Chop;

XA:=X2[[1;;h,1;;h]]//Chop;

AA=N[XA.PA,60];

C1:=1/2 N[MatrixPower[AA,1/2]+ IdentityMatrix[h],60];

C2:=1/2 N[MatrixPower[AA,1/2]- IdentityMatrix[h],60];n=100/101;

M:=MatrixPower[C1,n]-MatrixPower[C2,n];

M2:=DiagonalMatrix[Log[Eigenvalues[M]]];ENT=Re[1/(n-1) Tr[M2]];

Print[s,"  ",N[ENT]],{s,1,20,1}];

Exit[];

this is running in Mathematica 10, but since I need to run the program for big size (L=300), I need to submit it as batch job(please find the script below), but it start to crashes for L>=15, I was wondering what would be the reason that it stops for bigger size when I submit it as batch job...

#!/bin/bash
#$ -cwd
    #$ -j y
#

# Set up proper modules.
. /etc/profile
module load mathematica
module list

echo "Running on" `hostname`
# Run your batch/serial job.
math  -run  -batchinput -batchoutput   < chain_1d.txt > output.out

exit 0
$\endgroup$
3
  • $\begingroup$ Note that clearAll in the first line should be replaced by ClearAll. Also, I recommend that you format the code in your Question as I did for you to improve readability. $\endgroup$
    – bbgodfrey
    Feb 7, 2015 at 22:34
  • $\begingroup$ I think you mean batch job, not bash job. $\endgroup$ Feb 8, 2015 at 5:37
  • 1
    $\begingroup$ @setareh - just to nail down the problem, it runs fine in batch mode for L<15, but will crash for larger values? What messages does it give in output.out concerning the crash? Does it crash when you run it in the frontend for large L values? $\endgroup$
    – Jason B.
    Dec 18, 2015 at 9:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.