==========================================================
 
      TUNE THE MACHINE
 
      this routine set the tune of the lattice given at imput.
      qx,qy are the final tunes wanted, and
      rq is an error parameters defined as
 
      rq = sqrt((qx-qx0)^2 + (qy-qy0)^2)
      where qx0,qy0 are the original tune of the input lattice
 
      if everything geos well rq is evry small like 10^-6
      but if the algorithm fails then rq is large
 
      It is better not to change the tune of the original file
      more than 0.4  (good luck).
 
      WARNING: this soubroutine tries to set the tune by
      changing a family of 2 quadrupoles, focusing and defocusng:
      if the lattice is composed only by constant focusing elements
      it does not work....
 
 ==========================================================
 
subroutine TUNEMACHINE(qx,qy,rq)
 
COMMONS: 
common-initi.f
common-mml-lattice.f
common-2Dsc-simulation.f
 
SUBROUTINES USED:
  UPDATE_QUAD_STORED_WITH_LATTICE
  betanew
  CHANGEQUAD
  messages_n
 
micromap-index
Mon Jul 17 08:57:35 CEST 2017