Difference between revisions of "Howto"

From MyUbuntu
Jump to navigation Jump to search
Line 151: Line 151:
 
     245 0.55500 job1.sh    romao        r    06/07/2016 19:30:41 all.q@node3   
 
     245 0.55500 job1.sh    romao        r    06/07/2016 19:30:41 all.q@node3   
 
</pre>
 
</pre>
To kill a job, first get the job number with the command qstat, and then use
+
*To kill a job, first get the job number with the command qstat, and then use
 +
<pre>
 
qdel jobnumber1 jobnumber2 ...
 
qdel jobnumber1 jobnumber2 ...
 +
</pre>
 
You can delete several jobs with the same command
 
You can delete several jobs with the same command
  
Script job2.sh
+
*Script job2.sh
 +
<pre>
 
#!/bin/bash -x                                                                 
 
#!/bin/bash -x                                                                 
 
#                                                                               
 
#                                                                               
Line 219: Line 222:
  
 
exit
 
exit
This script does the same thing with one difference. In the first script the jobs are run inside the directories Dir1 and Dir2. These directories are physically in node1 and mounted by nfs on the other machines. If your job writes many times to the disk, these results have to transferred by nfs to the directory in node1 and this slows down the performance. The script job2.sh solves this problem by copying the program files in the /tmp directory in the nodes where you are running. Uses the scratch space there and only when the job end copies everything back to your directory.
+
</pre>
You have to change the names of the program files to suit your case
+
*This script does the same thing with one difference. In the first script the jobs are run inside the directories Dir1 and Dir2. These directories are physically in node1 and mounted by nfs on the other machines. If your job writes many times to the disk, these results have to transferred by nfs to the directory in node1 and this slows down the performance. The script job2.sh solves this problem by copying the program files in the /tmp directory in the nodes where you are running. Uses the scratch space there and only when the job end copies everything back to your directory.
Warning: To use this script you have to have ssh without passwords enabled between node1 and the other nodes. See above
+
*You have to change the names of the program files to suit your case
 +
*Warning: To use this script you have to have ssh without passwords enabled between node1 and the other nodes. See above
  
Main Page
+
[[Main Page]]
  
 
==Mathematica and Fortran==
 
==Mathematica and Fortran==

Revision as of 19:58, 17 October 2020

How to use SSH without passwords

  • You want to enter from computer A into computer B using ssh without passwords
  1. Generate the public keys in computer A
    ssh-keygen -t dsa
    ssh-keygen -t rsa
    

    and follow the instructions

  2. Copy the public keys for computer A into a file authorized_keys_A
    cd; cd .ssh
    cp id_dsa.pub authorized_keys_A
    cat id_rsa.pub >> authorized_keys_A
    
  3. Copy the file to computer B using your password
    scp authorized_keys_A user@Computer_B
    
  4. Login into Computer B using your password
  5. Move the file to the directory .ssh. If this is the only computer you want to use move the file to authorized_keys
    cd .ssh
    mv authorized_keys_A authorized_keys
    
  6. If you want to do the same with other computers and have already an authorizes_keys file, then append it
    cat authorized_keys_A >> authorized_keys
    
  7. If it fails (it happened with Ubuntu 18.04) after the procedure explained do in client side (computer A)
    ssh-add
    

    Verify with

    ssh-add -l
    
  8. That is all. Now you can login from A to B without password and using ssh.

Main Page

How to use the nodes@cftp

What are the nodes (This information is obsolete)

  • The nodes are 6 computers dedicated only for calculations. Each have 4 CPU's, in a total of 24 CPU's.
  • They are different, so they are not good to use in parallel programming

From the net you can only access node1:

ssh user@node1.tecnico.ulisboa.pt

The others 5 are in a sub-net and can only be accessed from node1

  • There is only one user directory in node1. It is automatically mounted on all the other nodes, so you will always see the same directory structure
  • You should not use the nodes running the programs directly. You should use the software Sun Grid Engine described below

How to use the software Sun Grid Engine (Not anymore installed)

  • The main idea is that you submit the jobs using a software that knows what are the free CPU's in each node and submits the job there
  • This is best done using scripts. I am going to show two basic scripts. For this suppose that you have a directory structure as follows
Examples
├── Dir1
│   ├── example.dat
│   ├── ProgTest
│   └── ProgTest.f
├── Dir2
│   ├── example.dat
│   ├── ProgTest
│   └── ProgTest.f
├── job1.sh
└── job2.sh
  • This means that you have a base Directory Examples and two sub-directories Dir1 and Dir2.
  • Inside each of these directories there are all the files needed to run the program, including the executable and any other necessary input. The final results will go also into these directories.
  • In the base directories there are two scripts. They do the same thing, but they differ in a way I will explain below.
  • Script job1.sh
#!/bin/bash -x                                                                  
#
# request Bourne shell as shell for job                                         
#$ -S /bin/sh                                                                   

usage(){
echo
echo "DESCRIPTION: Job File for qsub. "
echo
echo "USAGE: qsub job1.sh subdir "
echo
echo  "           -h         Print usage."
echo
}

if [[ $# == 0 || "$1" == "-h" ]]; then
    usage
    exit
fi


# Start Date
date

BASE=/home/romao/Examples
DIR=$BASE/$1
PATH=$PATH:$DIR
export PATH

cd $DIR

./ProgTest


# End Date
date

exit
  • You run this script with the command
qsub job1.sh Dir1

or

qsub job1.sh Dir2
  • When the program ends the results are in those directories
  • If the program takes sometime, you can see if they are running with the command
qstat
  • The output is something like this
node1$ qstat
job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID 
-----------------------------------------------------------------------------------------------------------------
    244 0.55500 job1.sh    romao        r     06/07/2016 19:30:41 all.q@node6                        1        
    245 0.55500 job1.sh    romao        r     06/07/2016 19:30:41 all.q@node3   
  • To kill a job, first get the job number with the command qstat, and then use
qdel jobnumber1 jobnumber2 ...

You can delete several jobs with the same command

  • Script job2.sh
#!/bin/bash -x                                                                 
#                                                                               
# request Bourne shell as shell for job                                         
#$ -S /bin/sh                                                                   


usage(){
echo
echo "DESCRIPTION: Job File for qsub. "
echo
echo "USAGE: qsub job2.sh subdir "
echo
echo  "           -h         Print usage."
echo
}

if [[ $# == 0 || "$1" == "-h" ]]; then
    usage
    exit
fi



# Start Date                                                                    
date

BASE=/home/romao/Examples
DIR=$BASE/$1
PATH=$PATH:$DIR
export PATH


if [ -d /tmp/romao/$1 ]; then

cd /tmp/romao
rm -fr $1

cp -pLR $DIR/ProgTest /tmp/romao/$1/

else

mkdirhier /tmp/romao/$1

cp -pLR $DIR/ProgTest /tmp/romao/$1/


fi;

cd /tmp/romao/$1

time ./ProgTest



cp example.dat $DIR/

cd /tmp/romao
rm -fr $1

# End Date                                                                      
date

exit
  • This script does the same thing with one difference. In the first script the jobs are run inside the directories Dir1 and Dir2. These directories are physically in node1 and mounted by nfs on the other machines. If your job writes many times to the disk, these results have to transferred by nfs to the directory in node1 and this slows down the performance. The script job2.sh solves this problem by copying the program files in the /tmp directory in the nodes where you are running. Uses the scratch space there and only when the job end copies everything back to your directory.
  • You have to change the names of the program files to suit your case
  • Warning: To use this script you have to have ssh without passwords enabled between node1 and the other nodes. See above

Main Page

Mathematica and Fortran

How to Enable debugging in ifort

To be able to traceback where the error comes from one should compile with the options

ifort -g -traceback ...

How to Export data from Mathematica

Suppose that you have a list with several entries in mathematica. Let us consider an example In[2]:= data = Table[{x, Sin[x], Cos[x]}, {x, 0., Pi, Pi/16}]

Out[2]= (0. 0. 1. 0.19635 0.19509 0.980785 0.392699 0.382683 0.92388 0.589049 0.55557 0.83147 0.785398 0.707107 0.707107 0.981748 0.83147 0.55557 1.1781 0.92388 0.382683 1.37445 0.980785 0.19509 1.5708 1. 6.12323*10^-17 1.76715 0.980785 -0.19509 1.9635 0.92388 -0.382683 2.15984 0.83147 -0.55557 2.35619 0.707107 -0.707107 2.55254 0.55557 -0.83147 2.74889 0.382683 -0.92388 2.94524 0.19509 -0.980785 3.14159 1.22465*10^-16 -1.

) You can export this data into a file by doing In[3]:= Export["datafile.dat", data,"TSV"]

Out[3]= datafile.dat The file will look like 0. 0. 1. 0.19634954084936207 0.19509032201612825 0.9807852804032304 0.39269908169872414 0.3826834323650898 0.9238795325112867 0.5890486225480862 0.5555702330196022 0.8314696123025452 0.7853981633974483 0.7071067811865475 0.7071067811865476 0.9817477042468103 0.8314696123025452 0.5555702330196023 1.1780972450961724 0.9238795325112867 0.38268343236508984 1.3744467859455345 0.9807852804032304 0.19509032201612833 1.5707963267948966 1. 6.123233995736766e-17 1.7671458676442586 0.9807852804032304 -0.1950903220161282 1.9634954084936207 0.9238795325112867 -0.3826834323650897 2.1598449493429825 0.8314696123025455 -0.555570233019602 2.356194490192345 0.7071067811865476 -0.7071067811865475 2.552544031041707 0.5555702330196022 -0.8314696123025453 2.748893571891069 0.3826834323650899 -0.9238795325112867 2.945243112740431 0.1950903220161286 -0.9807852804032304 3.141592653589793 1.2246467991473532e-16 -1.

How to Import data into Mathematica

Data can be imported into Mathematica with the command newdata = Import["datafile.dat"] This produces the output In[1] =newdata Out[1]=(0. 0. 1. 0.19635 0.19509 0.980785 0.392699 0.382683 0.92388 0.589049 0.55557 0.83147 0.785398 0.707107 0.707107 0.981748 0.83147 0.55557 1.1781 0.92388 0.382683 1.37445 0.980785 0.19509 1.5708 1. 6.12323*10^-17 1.76715 0.980785 -0.19509 1.9635 0.92388 -0.382683 2.15984 0.83147 -0.55557 2.35619 0.707107 -0.707107 2.55254 0.55557 -0.83147 2.74889 0.382683 -0.92388 2.94524 0.19509 -0.980785 3.14159 1.22465*10^-16 -1.

)

How to Export from Mathematica into Fortran

It is many times useful to output the results of Mathematica into a Fortran file. To export in a format compatible with Fortran 77 we can use the method here described. Suppose we calculate the following expression in Mathematica In[2]:= res = (x + y + z)^10 // Expand

Out[2]= x^10+10 x^9 y+10 x^9 z+45 x^8 y^2+90 x^8 y z+45 x^8 z^2+120 x^7 y^3+360 x^7 y^2 z+360 x^7 y z^2+120 x^7 z^3+210 x^6 y^4+840 x^6 y^3 z+1260 x^6 y^2 z^2+840 x^6 y z^3+210 x^6 z^4+252 x^5 y^5+1260 x^5 y^4 z+2520 x^5 y^3 z^2+2520 x^5 y^2 z^3+1260 x^5 y z^4+252 x^5 z^5+210 x^4 y^6+1260 x^4 y^5 z+3150 x^4 y^4 z^2+4200 x^4 y^3 z^3+3150 x^4 y^2 z^4+1260 x^4 y z^5+210 x^4 z^6+120 x^3 y^7+840 x^3 y^6 z+2520 x^3 y^5 z^2+4200 x^3 y^4 z^3+4200 x^3 y^3 z^4+2520 x^3 y^2 z^5+840 x^3 y z^6+120 x^3 z^7+45 x^2 y^8+360 x^2 y^7 z+1260 x^2 y^6 z^2+2520 x^2 y^5 z^3+3150 x^2 y^4 z^4+2520 x^2 y^3 z^5+1260 x^2 y^2 z^6+360 x^2 y z^7+45 x^2 z^8+10 x y^9+90 x y^8 z+360 x y^7 z^2+840 x y^6 z^3+1260 x y^5 z^4+1260 x y^4 z^5+840 x y^3 z^6+360 x y^2 z^7+90 x y z^8+10 x z^9+y^10+10 y^9 z+45 y^8 z^2+120 y^7 z^3+210 y^6 z^4+252 y^5 z^5+210 y^4 z^6+120 y^3 z^7+45 y^2 z^8+10 y z^9+z^10 To export into a Fortran file you do the following stmp = OpenWrite["expression.f", FormatType -> FortranForm, PageWidth -> 60]; Write[stmp, exp]; Close[stmp]; The file will look like

       "res="x**10 + 10*x**9*y + 45*x**8*y**2 + 
    -   120*x**7*y**3 + 210*x**6*y**4 + 252*x**5*y**5 + 
    -   210*x**4*y**6 + 120*x**3*y**7 + 45*x**2*y**8 + 
    -   10*x*y**9 + y**10 + 10*x**9*z + 90*x**8*y*z + 
    -   360*x**7*y**2*z + 840*x**6*y**3*z + 
    -   1260*x**5*y**4*z + 1260*x**4*y**5*z + 
    -   840*x**3*y**6*z + 360*x**2*y**7*z + 90*x*y**8*z + 
    -   10*y**9*z + 45*x**8*z**2 + 360*x**7*y*z**2 + 
    -   1260*x**6*y**2*z**2 + 2520*x**5*y**3*z**2 + 
    -   3150*x**4*y**4*z**2 + 2520*x**3*y**5*z**2 + 
    -   1260*x**2*y**6*z**2 + 360*x*y**7*z**2 + 
    -   45*y**8*z**2 + 120*x**7*z**3 + 840*x**6*y*z**3 + 
    -   2520*x**5*y**2*z**3 + 4200*x**4*y**3*z**3 + 
    -   4200*x**3*y**4*z**3 + 2520*x**2*y**5*z**3 + 
    -   840*x*y**6*z**3 + 120*y**7*z**3 + 210*x**6*z**4 + 
    -   1260*x**5*y*z**4 + 3150*x**4*y**2*z**4 + 
    -   4200*x**3*y**3*z**4 + 3150*x**2*y**4*z**4 + 
    -   1260*x*y**5*z**4 + 210*y**6*z**4 + 252*x**5*z**5 + 
    -   1260*x**4*y*z**5 + 2520*x**3*y**2*z**5 + 
    -   2520*x**2*y**3*z**5 + 1260*x*y**4*z**5 + 
    -   252*y**5*z**5 + 210*x**4*z**6 + 840*x**3*y*z**6 + 
    -   1260*x**2*y**2*z**6 + 840*x*y**3*z**6 + 
    -   210*y**4*z**6 + 120*x**3*z**7 + 360*x**2*y*z**7 + 
    -   360*x*y**2*z**7 + 120*y**3*z**7 + 45*x**2*z**8 + 
    -   90*x*y*z**8 + 45*y**2*z**8 + 10*x*z**9 + 
    -   10*y*z**9 + z**10

To use in a program you should take out the "" and it is better to change the continuation character in something that is not used in Fortran like the &. The file will then look like

        res=x**10 + 10*x**9*y + 45*x**8*y**2 + 
    &   120*x**7*y**3 + 210*x**6*y**4 + 252*x**5*y**5 + 
    &   210*x**4*y**6 + 120*x**3*y**7 + 45*x**2*y**8 + 
    &   10*x*y**9 + y**10 + 10*x**9*z + 90*x**8*y*z + 
    &   360*x**7*y**2*z + 840*x**6*y**3*z + 
    &   1260*x**5*y**4*z + 1260*x**4*y**5*z + 
    &   840*x**3*y**6*z + 360*x**2*y**7*z + 90*x*y**8*z + 
    &   10*y**9*z + 45*x**8*z**2 + 360*x**7*y*z**2 + 
    &   1260*x**6*y**2*z**2 + 2520*x**5*y**3*z**2 + 
    &   3150*x**4*y**4*z**2 + 2520*x**3*y**5*z**2 + 
    &   1260*x**2*y**6*z**2 + 360*x*y**7*z**2 + 
    &   45*y**8*z**2 + 120*x**7*z**3 + 840*x**6*y*z**3 + 
    &   2520*x**5*y**2*z**3 + 4200*x**4*y**3*z**3 + 
    &   4200*x**3*y**4*z**3 + 2520*x**2*y**5*z**3 + 
    &   840*x*y**6*z**3 + 120*y**7*z**3 + 210*x**6*z**4 + 
    &   1260*x**5*y*z**4 + 3150*x**4*y**2*z**4 + 
    &   4200*x**3*y**3*z**4 + 3150*x**2*y**4*z**4 + 
    &   1260*x*y**5*z**4 + 210*y**6*z**4 + 252*x**5*z**5 + 
    &   1260*x**4*y*z**5 + 2520*x**3*y**2*z**5 + 
    &   2520*x**2*y**3*z**5 + 1260*x*y**4*z**5 + 
    &   252*y**5*z**5 + 210*x**4*z**6 + 840*x**3*y*z**6 + 
    &   1260*x**2*y**2*z**6 + 840*x*y**3*z**6 + 
    &   210*y**4*z**6 + 120*x**3*z**7 + 360*x**2*y*z**7 + 
    &   360*x*y**2*z**7 + 120*y**3*z**7 + 45*x**2*z**8 + 
    &   90*x*y*z**8 + 45*y**2*z**8 + 10*x*z**9 + 
    &   10*y*z**9 + z**10

One can use PageWidth up to 72 in Fortran 77. I prefer to be below because this way the file looks more clear One can then convert into Fortran 90, using some standard converter

How to Export from Mathematica into Fortran Using Format.m

Format.m is a program to produce a nice output into Fortran, including arrays. It was done by M. Sofroniou. It can be obtained here If you try to load it as is, it will complain about not finding Utilities`FilterOptions`, a package that no longer ships with Mathematica 10. To fix this: Change

BeginPackage["Format`", "Utilities`FilterOptions`"]

to

BeginPackage["Format`"]. Add FilterOptions[fun_, opts___] := Sequence@@FilterRules[{opts}, Options[fun]] right after

Begin["Private`"].

How to use Mathematica in batch mode

first use at now Then at the prompt do >math -noprompt -script input_file Get out with CTRL D

Main Page

Mathematica and OneLoop in FeynCalc

Use of TID instead of OneLoop result=(-I / Pi^2) ( amp // TID[#, k, ToPaVe -> True] & ) Do not forget the parethesis

Main Page

Managing my Library of Papers

The papers in MyLibary are organized by keywords. Here is a list of those keywords: switch ($ACT) {

case 0:
  echo "";
  break;
case 1:
  $statement = $connection->query("SELECT * FROM database_name WHERE authors LIKE '%romao%' ORDER BY year $sort, spires $sort ");
  $TITLE="Papers by Jorge Romão";
  break;
case 2:
  $statement =$connection->query("SELECT * FROM database_name WHERE  project LIKE
  '%mylib-sm%' ORDER BY year $sort,firstauthor");
  $TITLE="Articles on the Standard Model";
  break;
case 3:
  $statement = $connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-review%' ORDER BY year $sort,firstauthor");
  $TITLE="Review Articles";
  break;
case 4:
  $statement=$connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-susy%' ORDER BY year $sort,firstauthor");
  $TITLE="SUSY (General)";
  break;
case 5:
  $statement =$connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-mssm%'  ORDER BY year $sort,firstauthor");
  $TITLE="Articles on the MSSM";
  break;
 case 6:
  $statement = $connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-rparity%' ORDER BY year $sort,firstauthor ");
  $TITLE="Articles on R-Parity";
  break;
case 7:
  $statement=$connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-nmssm%' ORDER BY year $sort,firstauthor ");
  $TITLE="Articles on the NMSSM";
  break;
case 8:
  $statement =$connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-lfv%' ORDER BY year $sort,firstauthor ");
  $TITLE="Articles on Lepton Flavour Violation";
  break;
case 9:
  $statement = $connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-neutrinos%' ORDER BY year $sort,firstauthor ");
  $TITLE="Articles on Neutrinos";
  break;
case 10:
  $statement = $connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-darkmatter%' ORDER BY year $sort,firstauthor");
  $TITLE="Articles on Dark Matter";
  break;
case 11:
  $statement = $connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-gut%' ORDER BY year $sort,firstauthor");
  $TITLE="Articles on GUT";
  break;
case 12:
  $statement = $connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-seesaw%'  ORDER BY year $sort,firstauthor");
  $TITLE="Articles on Seesaw Models";
  break;
  
case 13:
  $statement = $connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-leptogenesis%'  ORDER BY year $sort,firstauthor");
  $TITLE="Articles on Leptogenesis";
  break;
case 14:
  $statement = $connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-electromagnetism%' ORDER BY year $sort,firstauthor");
  $TITLE="Articles on Electromagnetism";
  break;
case 15:
  $statement = $connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-quantum-mechanics%' ORDER BY year $sort,firstauthor ");
  $TITLE="Articles on Quantum Mechanics";
  break;
case 16:
  $statement = $connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-field-theory%' ORDER BY year $sort,firstauthor");
  $TITLE="Articles on Quantum Field Theory";
  break;
case 17:
  $statement = $connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-gravity%' ORDER BY year $sort,firstauthor");
  $TITLE="Articles on Gravitation";
  break;
case 18:
  $statement = $connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-divulgacao%' ORDER BY year $sort,firstauthor");
  $TITLE="Articles on Science Divulgation";
  break;
case 19;
$statement = $connection->query("SELECT * FROM database_name WHERE authors LIKE '%romao%' OR project LIKE '%mylib%' ORDER BY year $sort,firstauthor");
$TITLE="All papers in My Library";
break;
case 20:
  $statement = $connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-atwork1%' ORDER BY year $sort,firstauthor");
  $TITLE="Papers for work 1";
  break;
case 21:
    $statement = $connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-atwork2%' ORDER BY year $sort,firstauthor");
    $TITLE="Papers for work 2";
       break;
case 22:
    $statement = $connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-atwork3%' ORDER BY year $sort,firstauthor");
    $TITLE="Papers for work 3";
       break;
case 23:
    $statement = $connection->query("SELECT * FROM database_name WHERE  project LIKE '%mylib-atwork4%' ORDER BY year $sort,firstauthor");
    $TITLE="Papers for work 4";
       break;


Main Page

Tips on Unix commands

sort

If your locale does not use . as the numeric separator, like $ locale LANG=en_US.UTF-8 LC_CTYPE=pt_PT.UTF-8 LC_NUMERIC=pt_PT.UTF-8 LC_TIME=pt_PT.UTF-8 LC_MONETARY=pt_PT.UTF-8 then numeric sort does not work

To solve this use the following command sort -g <(sed 's/\./,/' file) | sed 's/\,/./' For sorting reverse sort -gr <(sed 's/\./,/' file) | sed 's/\,/./'

Main Page

Tips Gnuplot

Output files

set size 0.895,0.5 set term postscript portrait enhanced color solid lw 2 set output "plot.eps" PNG output with approximately the same ratio set size 0.8,0.5 set terminal pngcairo dashed enhanced font "arial,20" lw 2 crop size 900,1200 set output "plot.png"

Syntax for labels

set label 1 at 200,3e-5 font "*,16" "label"

Use of awk

Sometimes one wants to make cuts in the data. One simple way to make cuts is to use awk. The syntax is plot "<awk -f cuts.awk datafile.dat" with lines ls 1 An example of the cuts.awk file could be

   function minvec(vec,   i, ret)
   {

for (i in vec) { if (ret == "" || vec[i] < ret) ret = vec[i] } return ret

   }
  
   function tan(x,ret)
   {

ret=sin(x)/cos(x) return ret

   }
  
   function pot2(x,ret)
   {

ret=x*x return ret

   }
   function abs(x,ret)
   {

ret=sqrt(x*x) return ret

   }
     function sgn(x,ret)
   {

ret=x/abs(x) return ret

   }
 

{

   if(abs($3-1) < 0.2)  {c1=1} else {c1=0}  
   if(c1==1) print $23,(pot2(246)*$30/tan($18))

}

Make 1D histograms with gnuplot

binwidth=2 bin(x,width)=width*floor(x/width) plot 'file.dat' using (bin($1,binwidth)):(1.0) smooth freq with boxes

Fill Region defined by points

Suppose you have a region defined by a set of points. For instance in file.dat you have (the first point must be equal to the last one) 1 1 1 3 3 3 3 1 1 1 To fill the inside of the region you do gnuplot> set xrange [0:4] gnuplot> set yrange [0:4] gnuplot> plot "file.dat" with filledcurves ls 1 One can make it less solid with the command set style fill solid 0.2 The number can be in the interval 0 (white) 1 (full color) Main Page

Tips LaTeX

feynmp-auto LaTeX package

Using feynmp-auto LaTeX package. The standard code is like \documentclass[a4paper,12pt,twoside]{report}

\usepackage{subcaption} \usepackage{feynmp-auto}

\makeatletter \setlength{\@fptop}{10pt} \makeatother

\pagestyle{empty} \begin{document}

\begin{figure}[htp] \centering % \begin{subfigure}{2.5cm} \begin{fmffile}{5} \begin{fmfgraph*}(100,100) \fmfset{arrow_len}{3mm} \fmfset{arrow_ang}{20} \fmfleft{nJ1} \fmflabel{$Z$}{nJ1} \fmfright{nJ2,nJ4} \fmf{photon,tension=4}{nJ1,J4J1nJ1} \fmf{fermion,label=$b$,label.side=right,tension=4}{nJ2J5J2,nJ2} \fmf{fermion,label=$b$,label.side=right,tension=4}{nJ4,J6nJ4J3} \fmf{photon,label=$W^{+}$,label.side=left,tension=1,label.dist=3thick}{nJ2J5J2,J4J1nJ1} \fmf{scalar,label=$H_a^{+}$,label.side=left,tension=1,label.dist=3thick}{J4J1nJ1,J6nJ4J3} \fmf{fermion,label=$t$,label.side=left,tension=1,label.dist=3thick}{J6nJ4J3,nJ2J5J2} \end{fmfgraph*} \end{fmffile} \end{subfigure} \end{figure} % \end{document} Now if you want to put an arrow in the W line you define a wiggly line with an arrow

\documentclass[a4paper,12pt,twoside]{report}

\usepackage{subcaption} \usepackage{feynmp-auto}

\makeatletter \setlength{\@fptop}{10pt} \makeatother


\pagestyle{empty} \begin{document}

\begin{figure}[htp] \centering % \begin{subfigure}{2.5cm} \begin{fmffile}{5} \begin{fmfgraph*}(100,100) \fmfcmd{% style_def wiggly_arrow expr p = cdraw (wiggly p); shrink (1); cfill (arrow p); endshrink; enddef;} \fmfset{arrow_len}{3mm} \fmfset{arrow_ang}{20} \fmfleft{nJ1} \fmflabel{$Z$}{nJ1} \fmfright{nJ2,nJ4} \fmf{photon,tension=4}{nJ1,J4J1nJ1} \fmf{fermion,label=$b$,label.side=right,tension=4}{nJ2J5J2,nJ2} \fmf{fermion,label=$b$,label.side=right,tension=4}{nJ4,J6nJ4J3} \fmf{wiggly_arrow,label=$W^{+}$,label.side=left,tension=1,label.dist=3thick}{nJ2J5J2,J4J1nJ1} \fmf{scalar,label=$H_a^{+}$,label.side=left,tension=1,label.dist=3thick}{J4J1nJ1,J6nJ4J3} \fmf{fermion,label=$t$,label.side=left,tension=1,label.dist=3thick}{J6nJ4J3,nJ2J5J2} \end{fmfgraph*} \end{fmffile} \end{subfigure} \end{figure} %

\end{document} Of course you have to use mpost

latex file.tex mpost 5.mp latex file.tex

Arial Fonts in PDFLaTeX

To use Arial fonts in LaTeX use the hevet package. Here is an example \documentclass[12pt]{article} \usepackage{graphicx} % % For arial in math mode % \usepackage{helvet} \renewcommand{\familydefault}{\sfdefault} \usepackage{

           newtxsf,
           textcomp,
           amsmath
          }

\usepackage[bold]{mathastext}

\usepackage{geometry}

\geometry{
papersize={248.5mm,196.5mm},
total={250mm,197mm},
left=0mm,
top=0mm,
}

\setlength{\unitlength}{1mm} \pagestyle{empty}

\begin{document}

\begin{minipage}{1.0\linewidth} \begin{picture}(248.5,196.5)(6.25,-0.)

\includegraphics[scale=1]{./Ratios-DgR-MZ-Neutrals-v2.pdf}   

\end{picture}

\put(-260,119){\includegraphics[scale=0.3]{blank.pdf}}
\put(-260,105){\includegraphics[scale=0.3]{blank.pdf}}
\put(-260,100){\includegraphics[scale=0.3]{blank.pdf}}
\put(-260,90){\includegraphics[scale=0.3]{blank.pdf}}

\put(-253,105){\scalebox{2.1}{\rotatebox{90}{$\mathbf{R_{ g_{Rb}^n}}$}}} \put(-108,0){\includegraphics[scale=0.3]{blank.pdf}} \put(-121,0){\includegraphics[scale=0.3]{blank.pdf}} \put(-130,0){\includegraphics[scale=0.3]{blank.pdf}} \put(-140,0){\includegraphics[scale=0.3]{blank.pdf}} \put(-140,6){\scalebox{2.1}{\bf$\mathbf{m_3}$ (GeV)}} \end{minipage}

\end{document} This example also shows how to modify labels using pdflatex. Im summary Use a blank fig to supperimpose on the label Then right on top of the blank figure

Main Page

Tips on Windows OS

Repair unreadable disk

Run the command

chkdsk /f d:

where d is the drive letter you want to check

Go Back to Main Page

Main Page