コード例 #1
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
void sSCut(void)
{
	dest=ATPOP;
	len=ML(dest);
	lens=ATPOP;
	ML(dest)=max(0,len-lens);
}
コード例 #2
0
 P serialize_member( const T& t, P end, const member_if<ML, MR, RU>& memb )
 {
     typedef typename ML::type typeL;
     if ( !( _get_value(t, ML()) == typeL() ) )
         return serialize_member( t, end, ML() );
     return serialize_member( t, end, MR() );
 }
コード例 #3
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
void sStSets(void)
{
  dest=ATPOP;
  len=ML(DBAdr+V_COUNT);
  symb=(char)ATPOP;
  ML(dest)=len;
  dest=dest+(int32)DsspMem+4;
  for (i=0;i<len;i++)
	  *(char*)(dest++)=symb;
  //strnset((char*)dest,(char)symb,len);  
}
コード例 #4
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
void sStSet(void)
{
  dest=ATPOP;
  lend=ML(DBAdr+V_COUNT);
  lens=ATPOP;
  source=(int32)DsspMem+ATPOP;
  len=min(lens,lend);
  ML(dest)=len;
  dest=dest+(int32)DsspMem+4;
  strncpy((char*)dest,(char*)source,len);  
}
コード例 #5
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
 void _VctrAllSet (void) {	// Assign value to every item Vctr[i] 
	// Top= base address of Vector, SupTop = value to be assigned
	int32 i,cnt,size,A,V;
	cnt=ML(DBAdr+V_COUNT);
	size=ML(DBAdr+V_SIZE);
 	DA_SETTYPEI;	
	A= ATPOP; V= ATPOP;
	for (i=0; i<cnt; i++) {
		APUSH(V); APUSH(A+i*size);
		DA_EXEC(T_ALLSET);	// !!! for Vctr[i]
	}
 }
コード例 #6
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
void sSCmp(void)
{
  dest=ATPOP;
  len=ML(dest);
  dest=dest+(int32)DsspMem+4;
  lend=ML(DBAdr+V_COUNT);
  lens=ATPOP;
  source=ATPOP+(int32)DsspMem;
  sEnd=*(char*)(source+lens); *(char*)(source+lens)=0;
  dEnd=*(char*)(dest+len); *(char*)(dest+len)=0;
  AINS; AT=-(int32)strcmp((char*)dest,(char*)source);
  *(char*)(dest+len)=dEnd;
  *(char*)(source+lens)=sEnd;
 }
コード例 #7
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
void sSAddB(void)
{
  dest=ATPOP;
  len=ML(dest);
  lend=ML(DBAdr+V_COUNT);
  if (len<lend)
  {
	  ML(dest)++;
      dest=dest+(int32)DsspMem+4+len;
	  *(char*)dest=(char)ATPOP;
  }
  else
  {ADEL;}
}
コード例 #8
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
void sSAdd(void)
{
  dest=ATPOP;
  len=ML(dest);
  lend=ML(DBAdr+V_COUNT);
  lens=ATPOP;
  source=ATPOP+(int32)DsspMem;
  ML(dest)=min(lend,len+lens);
  dest=dest+(int32)DsspMem+4;
  dest=dest+len;
  for (i=0;i<(lend-len);i++)
   {
      *(char*)(dest++)=*(char*)(source++);
   }
}
コード例 #9
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
void sSSsb(void)
{
  dest=ATPOP;
  len=ML(dest);
  dest=dest+(int32)DsspMem+4;
  lend=ML(DBAdr+V_COUNT);
  lens=ATPOP;
  source=ATPOP+(int32)DsspMem;
  sEnd=*(char*)(source+lens); *(char*)(source+lens)=0;
  dEnd=*(char*)(dest+len); *(char*)(dest+len)=0;
  result=strstr((char*)dest,(char*)source);
  *(char*)(dest+len)=dEnd;
  *(char*)(source+lens)=sEnd;
  AINS; AT=(int32)result-dest;
  AINS; if (result==NULL) AT=0; else AT=1;
}
コード例 #10
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
 void _VctrAdrI (void)	{ // Calculate Address of Vctr[i] 
	// AITEM(1) = index; AT= base address of Vector
	_TstVctrInd();
	AITEM(1)=AT+AITEM(1)*ML(DBAdr+V_SIZE); 
	ADEL;
	// AT= address of item Vector[index]
 }
コード例 #11
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
void sStVal(void)
{
  AT=AT+4;
  APUSHCOPYn(1);
  AT=AT-4;
  AT=ML(AT);
}
コード例 #12
0
ファイル: Riccati.cpp プロジェクト: YingzhouLi/Elemental
void Riccati
( ElementalMatrix<F>& WPre,
  ElementalMatrix<F>& X, 
  SignCtrl<Base<F>> ctrl )
{
    DEBUG_CSE

    DistMatrixReadProxy<F,F,MC,MR> WProx( WPre );
    auto& W = WProx.Get();

    const Grid& g = W.Grid();
    Sign( W, ctrl );
    const Int n = W.Height()/2;
    DistMatrix<F> WTL(g), WTR(g),
                  WBL(g), WBR(g);
    PartitionDownDiagonal
    ( W, WTL, WTR,
         WBL, WBR, n );

    // (ML, MR) = sgn(W) - I
    ShiftDiagonal( W, F(-1) );

    // Solve for X in ML X = -MR
    DistMatrix<F> ML(g), MR(g);
    PartitionRight( W, ML, MR, n );
    MR *= -1;
    ls::Overwrite( NORMAL, ML, MR, X );
}
コード例 #13
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
 void _StructSt (void) { // Assign values to Structure from the address
	int32	Adr;
	 Adr = AT; AT=ML(TypeAdr+T_SIZE);
	 APUSH(Adr);
	 // A-Astack contains now: [Address, Number of bytes, StructAddress ]
	 _MoveB (); // execute !!!SB
 }
コード例 #14
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
 void _StructSt0 (void) { // Assign zero to every byte of Structure 
	int32	Adr;
	 Adr = AT; AT=0;
	 APUSH(Adr);
	 APUSH(ML(TypeAdr+T_SIZE));
	 // A-Astack contains now: [0, Address, Number of bytes ]
	 _SetB(); // execute !!!MB
 }
コード例 #15
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
 void _ArrAdrI (void)	{ // Calculate Address of Arr[i1,..,ik] 
	// AITEM(p) = index (ip) of item, p=1,..,k
	// AT= base address of Vector
	int32 p,i,k;
	k= ML(DBAdr+V_DIMENSION); 
	i=0; // calculate I= (...(I1*L2+I2)*L2+...)*Lk+Ik
	for (p=1; p<=k; p++) {
		i= i*ML(DBAdr+V_LIMITS+p-1)+AITEM(p);
		// Test index out of range
		if ( AITEM(p)>=ML(DBAdr+V_LIMITS+p-1) ) {
			printf(" index out of range \n");
			exit(77);	// Wrong Index !!!!!
		}//if
	}//for
	AITEM(k)=AT+i*ML(DBAdr+V_SIZE); 
	ADELn(k);
	// AT= address of item Arr[i1,..,ik]
 }
コード例 #16
0
ファイル: kern.c プロジェクト: Ntropy/DSSP-C
 void _GTP (void) { // GTP
        // Push to A-stack the following value in body
        // of that procedure, from where the procedure,
        // including GTP, was called.
        lptr    Rpc; int32 Val;
        Rpc= (lptr)CT; Val=ML((bptr)Rpc);
        Rpc++; CT=(int32)Rpc;
        APUSH(Val);
 }
コード例 #17
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
//void sVDimQ(void)
//void sVSizeQ(void)
void sSDsb(void) // [N,I,A]
{
  dest=ATPOP;
  lend=ML(DBAdr+V_COUNT);
  len=ML(dest);
  if ((!(len<AT))&&(!(lend<AT)))
   {
	  lens=ATPOP;
	  if (lend>0)
	    ML(dest)=max(0,len-AT);
	  dest=dest+(int32)DsspMem+4+lens;
	  j=ATPOP;
	  for (i=j;i<(lend-lens);i++)
		   *((char*)dest+i-j)=*((char*)dest+i);
   }
  else
  { ADEL;ADEL;}
}
コード例 #18
0
ファイル: kern.c プロジェクト: Ntropy/DSSP-C
void _Call (void)
{    // CALLTELO
     // cmd->  CALLTELO
     //    +1     ADR  // address of DSSP-procedure
     //    +2    ... // address of this position
     //              // will be in C-STACK
     CPUSH(cmd+2);
     cmd = (lptr)ML(cmd+1);
     EXECMD;
}
コード例 #19
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
void sSDel(void)
{
  dest=ATPOP;
  len=ML(DBAdr+V_COUNT);
  lend=ML(dest);
  if ((!(len<AT))&&(!(lend<AT)))
   {
	  if (lend>0)
	    ML(dest)--;
	  dest=dest+(int32)DsspMem+4+AT;
	  j=ATPOP;
	  for (i=1;i<(lend-j);i++)
		   *((char*)dest+i-1)=*((char*)dest+i);
   }
  else
   {
    ADEL;
   }
}
コード例 #20
0
ファイル: kern.c プロジェクト: Ntropy/DSSP-C
 void _DOFor (void) {   // DO-  //  DO-  BODY
         // N DO- P means execute [i] P for i=N,..,1
        if (--AT>=0) {  // decrement parameter and then test it
                cmd= (lptr)ML(pc);
                pc--;   // so that pc points again to DO- position
                EXECMD;
        } else { // terminate loop, if AT  became <0
                pc++;
                ADEL;   // pop parameter
        }
 }
コード例 #21
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
void sSIns(void)
{
  dest=ATPOP;
  len=ML(DBAdr+V_COUNT);
  lend=ML(dest);
  if (!(len<AT))
   {
	  if (lend<len)
	    ML(dest)++;
	  dest=dest+(int32)DsspMem+4+AT;
	  j=ATPOP;
	  for (i=(lend-j);i>=1;i--)
		   *((char*)dest+i)=*((char*)dest+i-1);
	  *(char*)dest=(char)ATPOP;
   }
  else
   {
    ADEL;ADEL;
   }
}
コード例 #22
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
void sSIsb(void)
{
  dest=ATPOP;
  j=ATPOP;
  len=ML(dest);
  lend=ML(DBAdr+V_COUNT);
  lens=ATPOP;
  source=ATPOP+(int32)DsspMem;
  if (!(len<j))
  {
      ML(dest)=min(lend,len+lens);
      dest=dest+(int32)DsspMem+4;
      dest=dest+j;
  	  for (i=(lend-j-lens);i>1;i--)
		   *((char*)dest+i)=*((char*)dest+i-lens);
      for (i=0;i<min(lens,lend-j);i++)
           *((char*)dest+i)=*((char*)source+i);
  }


}
コード例 #23
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
void _arg2str(void) // ARG2STR
{
 	GETCMD;		
 	DA_SETDB;	
 	DA_GETADR;	
 	DA_SETTYPE;
	i=0;
	dest=ATPOP;
	lend=ML(DBAdr+V_COUNT);
	ML(dest)=len=0;
	dest+=((int32)DsspMem+4);
    for (j=param_st;j<argc_gl;j++)
          {
           len=min((unsigned)(i+strlen(argv_gl[j])),(unsigned)lend);
           strncpy((char*)(dest+i),argv_gl[j],len-i);
           if ((i>=lend) || (j==argc_gl-1)) break;
           i=len;*(char*)(dest+i)=' ';i++;
          }
	dest-=((int32)DsspMem+4);
	ML(dest)=len;
}
コード例 #24
0
ファイル: data_sun.c プロジェクト: Ntropy/DSSP-C
void sSOvr(void)
{
  dest=ATPOP;
  len=ML(DBAdr+V_COUNT);
  if (!(len<AT))
   {
	   dest=dest+(int32)DsspMem+ATPOP+4;
	   *(char*)dest=(char)ATPOP;
   }
  else
   {
    ADEL;ADEL;
   }
}
コード例 #25
0
ファイル: scalar_mul.C プロジェクト: syncom/libg2hec
bool_t ML(divisor& x, const divisor& a, const ZZ& n)
// Montgomery's ladder: used to defend side channel attacks
// cf. Alg. 13.35 of HOEHCC
{
  assert(a.is_valid_divisor());

  bool_t OK = TRUE;

  long nbits = NumBits(n);

  divisor b1, b2;


  if ( !nbits ) { // n = 0
    x.set_unit();
    return OK;
  }

  if ( n < 0) {
    OK = OK && ML(x, a, -n);
    OK = OK && dnegate(x, x);
    return OK;
  }

  // Case n > 0
  b1 = a; b2 = a + a;     
  for ( --nbits; OK && nbits > 0; --nbits) {
    if ( !bit(n, nbits - 1) ) {
      OK = OK && add(b2, b1, b2); // b2 = b1 + b2
      OK = OK && add(b1, b1, b1); // b1 = [2]*b1

    } else { 
      OK = OK && add(b1, b1, b2); // b1 = b1 + b2;
      OK = OK && add(b2, b2, b2); // b2 = [2]*b2;

      assert(OK);  

    }

  }

  assert(b1.is_valid_divisor());
  x = b1;

  return OK;

}
コード例 #26
0
ファイル: kern.c プロジェクト: Ntropy/DSSP-C
void _Br1 (void) {     // BR1
        CPOP(pc);
        if (AITEM(1)==AT)
        {       ADELn(2);
                GETCMD;
                // looking for ELSE
                while (ML(pc)!=cmd_Else) pc++;
                pc +=2; // so that pc points after P0
                EXECMD;
        } else {
                ADEL;
                pc++;
                GETCMD;
                CPUSH(pc);
                pc=PCADR(cmd_BR1);
                EXECMD;
        }
 }
コード例 #27
0
ファイル: llfindlocale.cpp プロジェクト: AlchemyDev/Carbon
    }
  }
}


#ifdef WIN32
#include <stdio.h>
#define ML(pn,sn) MAKELANGID(LANG_##pn, SUBLANG_##pn##_##sn)
#define MLN(pn) MAKELANGID(LANG_##pn, SUBLANG_DEFAULT)
#define RML(pn,sn) MAKELANGID(LANG_##pn, SUBLANG_##sn)
struct IDToCode {
  LANGID id;
  char*  code;
};
static const IDToCode both_to_code[] = {
  {ML(ENGLISH,US),           "en_US.ISO_8859-1"},
  {ML(ENGLISH,CAN),          "en_CA"}, /* english / canadian */
  {ML(ENGLISH,UK),           "en_GB"},
  {ML(ENGLISH,EIRE),         "en_IE"},
  {ML(ENGLISH,AUS),          "en_AU"},
  {MLN(GERMAN),              "de_DE"},
  {MLN(SPANISH),             "es_ES"},
  {ML(SPANISH,MEXICAN),      "es_MX"},
  {MLN(FRENCH),              "fr_FR"},
  {ML(FRENCH,CANADIAN),      "fr_CA"},
  {ML(FRENCH,BELGIAN),       "fr_BE"}, /* ? */
  {ML(DUTCH,BELGIAN),        "nl_BE"}, /* ? */
  {ML(PORTUGUESE,BRAZILIAN), "pt_BR"},
  {MLN(PORTUGUESE),          "pt_PT"},
  {MLN(SWEDISH),             "sv_SE"},
  {ML(CHINESE,HONGKONG),     "zh_HK"},
コード例 #28
0
ファイル: R3DLuminance.cpp プロジェクト: voovrat/Render3D
void R3DLuminance::calculateLuminance(std::list<double> *luminance)
{

std::list<R3DLight>::iterator light_it;

int N = m_triangles->size();
int Nsegm = m_Ntheta * m_Nphi + 2;

std::list<int> *segments = new std::list<int>[ Nsegm ];
bool *isVisible = new bool[N];

//LineSegment *rayList = new LineSegment[N];
R3DPoint *midPoint = new R3DPoint[N];

// initialize with zeros
int i;
luminance->clear();
for(i=0;i<N;i++)
  luminance->push_back( 0 );


// calculate luminance: light by light 
for(light_it = m_lights->begin();
    light_it != m_lights->end();
    light_it ++) 
{
    R3DPoint L = (*light_it).position;
    double power = (*light_it).power;

    for(i=0;i<Nsegm;i++) segments[i].clear();
    for(i=0;i<N;i++) isVisible[i] = true;
     
    std::set<int> S; //segment of triangles
    std::set<int>::iterator set_it;
    std::list<R3DTriangle>::iterator tri_it;


    int tri_idx;
    // add triangles to appropriate segments
    for(tri_it = m_triangles->begin(),   tri_idx = 0;
        tri_it != m_triangles->end();
        tri_it++,                        tri_idx ++ )
    {
        S.clear();
        getSegments( *tri_it, //R3DTriangle &T,
                     L ,//  R3DPoint &L, //light position 
                     &S //std::set<int> *segment_set
                    );

         if(DEBUG) std::cout<<"Triangle "<<*tri_it<<" SEGMENTS:"<<std::endl;

        for( set_it = S.begin(); set_it!=S.end(); set_it ++ )
        {
            if(DEBUG)
            {
              std::cout<<*set_it;
            }
           
	    segments[ *set_it ].push_back( tri_idx  ); 
        }
   
    }// tri_it

if(DEBUG)
{
	for(i=0;i<Nsegm;i++)
        {
          std::list<int>::iterator idx_it;


          printf("SEGMENT %d:\n",i); 
          for( idx_it = segments[i].begin(); idx_it!=segments[i].end(); idx_it++)     
          {
              std::cout<<"Triangle "<<*idx_it<<" : "<< *m_triIndex[ *idx_it ]<<std::endl;
          }

        }


}


    // intersect triangles inside the segments
    int segm_id;
    for(segm_id = 0; segm_id < Nsegm; segm_id++)
    {
          // go through all the triangles in the segment 
          std::list<int>::iterator idx_it1,idx_it2;
          for( idx_it1 = segments[ segm_id].begin();
               idx_it1 != segments[ segm_id].end();
               idx_it1++)
          {
                 R3DTriangle T1 = *m_triIndex[ *idx_it1 ];
                 R3DPoint M = (T1.A + T1.B + T1.C)/3;
                 
                 R3DLineSegment ML(M,L);
                 midPoint[ *idx_it1 ] = M;

                 // check if ML croses one of triangles in this segment
                 for(idx_it2 = segments[segm_id].begin();
                     idx_it2 != segments[segm_id].end();
                     idx_it2 ++ )
                 {
                     if ( *idx_it1 == *idx_it2) continue; //triangle coinside
                     R3DPoint X; //cross of the plane with 
                     R3DPlane P2 = *m_planeIndex[ *idx_it2 ];
                  
                     if(! intersect( ML, P2, &X)) continue; // ML does not intersect wuth the plane of second triangle
                     

                     R3DTriangle T2 = *m_triIndex[ *idx_it2 ];

                     if( T2.isInside(X)) //croos point (X) is inside T2
                     {
                          isVisible[ *idx_it1 ] = false; // T2 covers T1
                          break;  
                     } 

                 }//idx_it2
          }// idx_it1

    } //segm_id
  
//    std::list<double>::iterator lum_it;
    std::list<double>::iterator lum_it;
    for( i=0, lum_it = luminance->begin(); 
         i<N; 
         i++, lum_it++)
    {
       if(!isVisible[i]) continue;

        R3DPlane P = *m_planeIndex[i];
       
       R3DLineSegment ML( midPoint[i], L);

     

       double normML = ML.m_direction.norm();
       double cos_phi = fabs( P.getNormal() * ML.m_direction )/normML;

      if(DEBUG)
         std::cout<<"M:"<<midPoint[i]<<" cos_phi="<<cos_phi<<"  normML="<<normML<<std::endl;
//       K = L.power / (normML * normML) * cos_phi;
       *lum_it += power / (normML * normML) * cos_phi;
    }
    



}// for light


delete [] segments;
delete [] isVisible;
delete [] midPoint;

}
コード例 #29
0
 P unserialize_member( T& t, P beg, P end, member_if<ML, MR, false>, bool& unserialized )
 {
     return unserialize_member(t, beg, end, ML(), unserialized);
 }
コード例 #30
0
ファイル: 2dx_ML.c プロジェクト: C-CINA/2dx
int main()
{ 
	int dir,m,i,j,k,n,num_line, Symmetry1;
	int num_images,  *pa,sx;   /*  Prepare for merge Nimages images together into a stack of num_images patches*/

	FILE *input;
	char oneline[100];
	char *c; 
        char *tmpstring;
        char *SYMname;
	char  *imagename, *profilename, *resultsfilename, *imagenumber, *temp_imagename;
	int oversizexy[2], realcellxy[2], realcellxy1[2];
	float angle[3];


        tmpstring=(char *)calloc(200,sizeof(char));
        SYMname=(char *)calloc(200,sizeof(char));
	imagename=(char *)calloc(400,sizeof(char));
	profilename=(char *)calloc(400,sizeof(char));
	imagenumber=(char *)calloc(200,sizeof(char));
	temp_imagename=(char *)calloc(200,sizeof(char));
	resultsfilename=(char *)calloc(200,sizeof(char));

	printf("\n2dx_ML: Performs Maximum Likelihood processing. \n");

	scanf("%d",&doMLorCC);
	if(doMLorCC==0)
		printf("Weights for ref calculation... = from Maximum Likelihood estimate\n");
	else
		printf("Weights for ref calculation... = from Cross-Correlation between particle and old reference\n");
	
	scanf("%s",resultsfilename);
	
	printf("Results File Name............. = %s \n",resultsfilename);

	input=fopen("2dx_image.cfg" ,"r"); 

	/*  input  parameters from 2dx_image.cfg to generate stacks*/

	printf("\nReading  Parameters for ML:\n");
        strcpy(tmpstring,"imagename");
	imagename=cgetline(input,tmpstring);
	strcpy(temp_imagename, imagename);
	strcat(imagename,".mrc");
	printf("Image Name..................... = %s \n",imagename);

        strcpy(tmpstring,"imagenumber");
	imagenumber=cgetline(input,tmpstring);
	printf("Image Number................... = %s \n",imagenumber);

	strcpy(profilename,"image_ctfcor_profile.dat");
	printf("Profile Name................... = %s \n",profilename);


        strcpy(tmpstring,"CS");
	if(fgetline(input,tmpstring,&CS)==0) 
 		printf("CS............................. = %f  \n",CS); 
        else
 		printf(":: ERROR in CS assignment.");

        strcpy(tmpstring,"KV");
	if(fgetline(input,tmpstring, &KV )==0)
		printf("KV............................. = %f  \n",KV); 
        else
 		printf(":: ERROR in KV assignment.");

        strcpy(tmpstring,"RESMIN");
	if(fgetline(input,tmpstring, &RESMIN )==0)  
		printf("RESMIN......................... = %f  \n",RESMIN); 
        else
 		printf(":: ERROR in RESMIN assignment.");

        strcpy(tmpstring,"RESMAX");
	if(fgetline(input,tmpstring,&RESMAX )==0) 
		printf("RESMAX......................... = %f  \n",RESMAX); 
        else
 		printf(":: ERROR in RESMAX assignment.");

        strcpy(tmpstring,"defocus");
	if(fgetline(input,tmpstring, defocus)==0)
	{ 
		DIFMID1=defocus[0];
		DIFMID2=defocus[1];
		ANGAST=defocus[2];
		printf("DFMID1,DFMID2,ANGAST........... = %f,%f,%f\n",DIFMID1,DIFMID2, ANGAST); 
	}

        strcpy(tmpstring,"ML_do_whiten");         
	if(*(cgetline(input,tmpstring))=='y')
	{   do_whiten =1;
		printf("do_whiten...................... = yes \n");
	}
	else
	{   do_whiten=0;
		printf("do_whiten...................... = no \n");
	}

        strcpy(tmpstring,"ML_correct_CTF");         
	if(*(cgetline(input,tmpstring))=='y')
	{   correct_CTF =1;
		printf("correct_CTF.................... = yes \n");
	}
	else
	{   correct_CTF=0;
		printf("correct_CTF.................... = no \n");
	}

        strcpy(tmpstring,"stepdigitizer");         
	if(fgetline(input,tmpstring,&DSTEP )==0)  
		printf("DSTEP.......................... = %f\n",DSTEP); 

        strcpy(tmpstring,"magnification");         
	if(fgetline(input,tmpstring, &XMAG)==0)
		printf("Magnification (XMAG)........... = %f \n",XMAG);
	/*
		 if(igetline(input, "ML_oversizexy", oversizexy)==0)  
		 {   oversized_x=oversizexy[0];
		 oversized_y=oversizexy[1];
		 printf("ML_oversizexy................. = %d,%d\n",oversized_x,oversized_y);
		 } 
		 else printf("parameter ML_oversizexy does not exists \n");   
	 */

        strcpy(tmpstring,"ML_realcellxy_outer");         
	if(igetline(input,tmpstring, realcellxy)==0)  
	{   realcell_x=realcellxy[0];
		realcell_y=realcellxy[1];
		printf("ML_realcellxy_outer............ = %d,%d\n",realcell_x,realcell_y);
	}
	else printf("parameter ML_realcellxy_outer does not exists \n");    
	/*    
				if(igetline(input, "ML_realcellxy_inner", realcellxy1)==0)  
				{   realcell_x1=realcellxy1[0];
				realcell_y1=realcellxy1[1];
				printf("ML_realcellxy_inner............ = %d,%d\n",realcell_x1,realcell_y1);
				} 
				else printf("parameter ML_realcell_xy1 does not exists \n");   
	 */
	realcell_x1=realcell_x;
	realcell_y1=realcell_y;

        strcpy(tmpstring,"ML_mask_radius");         
	if(igetline(input,tmpstring, &mask_radius)==0) 
		printf("Mask radius.................... = %d \n",mask_radius); 
	else printf("parameter ML_mask_radius does not exists \n");   

        strcpy(tmpstring,"ML_iteration");         
	if(igetline(input,tmpstring, &Iteration)==0) 
		printf("Iteration...................... = %d \n",Iteration); 
	else printf("parameter ML_iteration does not exists \n");   

        strcpy(tmpstring,"ML_threshold_method");         
	if(igetline(input,tmpstring, &threshold_method)==0) 
	{     
		if(threshold_method==0)
		{   
                        strcpy(tmpstring,"ML_absolute_threshold");      
			if(fgetline(input,tmpstring, &threshold)==0) 
				printf("Absolute Threshold value....... = %f \n",threshold);
			else  printf("parameter ML_absolute_threshold does not exists \n");     
		}
		else  
		{               
                        strcpy(tmpstring,"ML_relative_threshold");      
                        if(fgetline(input,tmpstring, &relative_threshold)==0)    
			printf("Percentage of peaks to use..... = %.2f\n",relative_threshold);
			else printf("parameter ML_relative_threshold does not exists \n");
		}
	}
	else printf("parameter ML_threshold_method does not exists \n");   

        strcpy(tmpstring,"ML_ref_ind");         
	if(igetline(input,tmpstring, &ref_ind)==0) 
	{    
		if ( ref_ind == 0 ) 
			printf("Initial Reference (ref_ind).... = average reference \n");
		else if ( ref_ind == 1 ) 
			printf("Initial Reference (ref_ind).... = random noise \n");
		else if ( ref_ind == 2 )
			printf("Initial Reference (ref_ind).... = random particle \n");
		else
			printf("::Initial Reference (ref_ind).... = ILLEGAL CHOICE !!!! \n");
	}
	else printf("parameter ML_ref_ind does not exists \n");   

	/*
		 if(igetline(input, "ML_DS_ratio", &DS_ratio)==0) 
		 printf("DS_ratio............................ = %d \n",DS_ratio); 
		 else printf("parameter DS_ratio does not exists \n");  
	 */
        strcpy(tmpstring,"ML_rotational_symmetry");      
	if(igetline(input,tmpstring, &Symmetry1)==0) 
	{   if(Symmetry1==0) Symmetry=1;
		else if(Symmetry1==1) Symmetry=2;
		else if(Symmetry1==2) Symmetry=3;
		else if(Symmetry1==3) Symmetry=4;
		else if(Symmetry1==4) Symmetry=5;
		else if(Symmetry1==5) Symmetry=6;
		printf("Rotational Symmetry of Particle = %d \n",Symmetry); 
	}
	else printf("parameter Symmetry does not exists \n");  

        strcpy(tmpstring,"ML_lp_method");      
	if(igetline(input,tmpstring, &lp_method)==0) 
	{   
		if(lp_method==1)
			printf("Low-Pass filter................ = Gaussian \n");
		else if(lp_method==2)
			printf("Low-Pass filter................ = Sharp cutoff \n");
		else
			printf("Low-Pass filter................ = None \n");
	}
	else printf("parameter ML_lp_method does not exists \n");   	

        strcpy(tmpstring,"ML_lp_radius");      
	if(fgetline(input,tmpstring,&lp_radius)==0)
		printf("lp_radius...................... = %f \n",lp_radius); 
	else printf("paramter lp_radius does not exists \n");

        strcpy(tmpstring,"ML_MinMaxStep_angle");      
	if(fgetline(input,tmpstring, angle)==0)
	{ 
		min_angle=angle[0];
		max_angle=angle[1];
		step_angle=angle[2];
		printf("min_angle,max_angle,step_angle. = %f,%f,%f \n",min_angle, max_angle, step_angle);
	}
	else printf("Angle parameters do not exists \n"); 

        strcpy(tmpstring,"ML_terminate_ML");      
	if(fgetline(input,tmpstring,&Terminate_ML)==0)
		printf("Terminate_ML................... = %f \n",Terminate_ML); 
	else printf("paramter ML_terminate does not exists \n");

        strcpy(tmpstring,"ML_B_factor");      
	if(fgetline(input,tmpstring,&B_fac)==0)
		printf("B_factor....................... = %f \n",B_fac); 
	else printf("paramter B_factor does not exists \n");

        strcpy(tmpstring,"ML_A_factor");      
	if(fgetline(input,tmpstring,&A)==0)
		printf("A_factor....................... = %f \n",A); 
	else printf("paramter A_factor does not exists \n");

        strcpy(tmpstring,"SYM");      
	SYMname=cgetline(input,tmpstring);
	printf("Space Group.................... = %s \n",SYMname);
        SYM=0;
        if(strncmp(SYMname,"p12",3) == 0) SYM=1;
        if(strncmp(SYMname,"p22",3) == 0) SYM=1;
        if(strncmp(SYMname,"p42",3) == 0) SYM=1;
        if(strncmp(SYMname,"p31",3) == 0) SYM=1;
        if(strncmp(SYMname,"p32",3) == 0) SYM=1;
        if(strncmp(SYMname,"p62",3) == 0) SYM=1;

        strcpy(tmpstring,"ctfrev");         
	if(*(cgetline(input,tmpstring))=='y')
	{    contrast=-1;
		printf("Contrast of final map.......... = positive\n");
	}
	else
	{   contrast=1;
		printf("Contrast of final map.......... = negative\n");
	}

        strcpy(tmpstring,"phaori");      
	if(fgetline(input,tmpstring,phaori)==0)
	{	
                printf("Phase Origin................... = %f %f\n",phaori[0],phaori[1]);
                if(SYM==1)
                {       
 		        printf(":: Adding 180deg phaseshift to phase origin, due to screw axis symmetry.\n");
                        phaori[0]+=180.0;
                }
        }
        else
 		printf(":: ERROR in Phase Origin assignment.");

        strcpy(tmpstring,"lattice");      
	if(fgetline(input,tmpstring,lattice)==0)
		printf("Reciprocal Lattice............. = %f %f %f %f\n",lattice[0],lattice[1],lattice[2],lattice[3]);
        else
 		printf(":: ERROR in Reciprocal Lattice assignment.");

	fclose(input);


	free(imagenumber); 
	free(temp_imagename); 

	printf("\n::Starting ML\n\n");
	fflush(stdout);

	/*   ML main program */

	ML(imagename, profilename,resultsfilename); 
	printf("\n::2dx_ML finished correctly\n\n");
	fflush(stdout);

	free(profilename); 
	free(imagename); 
	free(resultsfilename);  




	return 0;
}