Ejemplo n.º 1
0
/*>PDB *DupePDB(PDB *in)
   ---------------------
   Input:   PDB    *in     Input PDB linked list
   Returns: PDB    *       Duplicated PDB linked list
                           (NULL on allocation failure)

   Duplicates a PDB linked list. Allocates new linked list with identical
   data.

   11.10.95 Original   By: ACRM
   08.10.99 Initialise q to NULL
*/
PDB *DupePDB(PDB *in)
{
   PDB *out = NULL,
       *p, *q = NULL;

   for(p=in; p!=NULL; NEXT(p))
   {
      if(out==NULL)
      {
         INIT(out, PDB);
         q=out;
      }
      else
      {
         ALLOCNEXT(q, PDB);
      }
      if(q==NULL)
      {
         FREELIST(out, PDB);
         return(NULL);
      }
      
      CopyPDB(q, p);
   }
   
   return(out);
}
Ejemplo n.º 2
0
/****************************************************************************
 Generate a CA, CACB, NCAC model for a pdb
 *****************************************************************************/
int SimplifyPDB(struct atom_s *x, int n, char *model)
{
	struct atom_s *y;
	int m;

	y = AlloAtoms(n);

	if (!strcmp(model,"CA")) m = PDB2CA(x,y,n);
	else if (!strcmp(model,"CACB")) m = PDB2CACB(x,y,n);
    else if (!strcmp(model,"NCAC")) m = PDB2NCAC(x,y,n);
	else Error("Model not defined in SimplifyPDB");

	CopyPDB(y,x,m);

	free(y);
	return m;
}