// // // This software is copyrighted, 1997, by Jarrod A. Smith. // The NAB molecular manipulation language is copyrighted, 1995, // 1996, 1997, by Thomas J. Macke and David A. Case. // The following terms apply to all files associated with the software // unless explicitly disclaimed in individual files. // // The authors hereby grant permission to use, copy, modify, and re-distribute // this software and its documentation for any purpose, provided // that existing copyright notices are retained in all copies and that this // notice is included verbatim in any distributions. No written agreement, // license, or royalty fee is required for any of the authorized uses. // Modifications to this software may be distributed provided that // the nature of the modifications are clearly indicated. // // IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY // FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES // ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY // DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // // THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE // IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE // NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR // MODIFICATIONS. // // #define MAXMOL 1500 #define MAXSTRAND 50 #define MAXRES_PER_STRAND 500 #define MAXATOM 100000 #define MEANPDBFNAME "mean.pdb" #define ROT_EXT ".rot.pdb" #define USAGE "%s [-mat] [-rot] [-mean] [-sd] [-cmp pdbfile]\n [-pr atom_sel] [-fit atom_expr] [-calc atom_expr] pdbfiles\n", argv[1] // define death int die( string message ) { fprintf( stderr, "%s\n", message ); exit( -1 ); }; float rms_per_res[ MAXSTRAND, MAXRES_PER_STRAND ]; string prexpr; int per_res_rmsd( molecule mi, molecule mj ) { residue r; int rn, sn; string per_res_calcexpr, emsg; float pr_fit; for( r in mi ){ rn = r.resnum; sn = r.strandnum; per_res_calcexpr = sprintf( "%d:%d:%s", sn, rn, prexpr ); if ( rmsd( mi, per_res_calcexpr, mj, per_res_calcexpr, pr_fit ) ){ printf( "Warning: per_res_rmsd() couldn't find %s\n", per_res_calcexpr ); rms_per_res[sn, rn] = 0.0; continue; } rms_per_res[sn, rn] = rms_per_res[sn, rn] + pr_fit * pr_fit; } return( 1 ); }; // make filenames for output rotated structures string make_rot_fname( string fname ) { int nf, i; string rotfname, fields[256]; nf = split( fname, fields, "." ); rotfname = fields[1]; for( i=2; i %s\n", n_mol, pdbfname[ n_mol ], rotpdbfname[n_mol]); }else{ printf( "Molecule %d = %s\n", n_mol, pdbfname[ n_mol ] ); } if( n_mol > 1 ){ check_input_mol( m[n_mol], m[n_mol - 1] ); } }else{ fprintf( stderr, "Cannot get pdb file %s. Bye.\n", argv[ac] ); exit(-1); } } } // if per-residue rmsds are requested, initialize the array that stores them if( pr ){ m_temp=m[1]; for( r in m_temp ){ rms_per_res[ r.strandnum, r.resnum ] = 0.0; } } // some sanity checks if( n_mol < 2 ) die( "ERROR: At least 2 pdb structures are required. Bye." ); if ( ! (n_fitatoms = countmolatoms( m[1], fitexpr )) ) die( "ERROR: No atoms defined by the fit atom expression " + fitexpr ); if ( ! (n_calcatoms = countmolatoms( m[1], calcexpr )) ) die( "ERROR: No atoms defined by the calc atom expression " + calcexpr ); // Report the filename for the mean structure if requested if( mean ){ printf( "\n-mean : Mean structure will be output to \"%s\"\n", MEANPDBFNAME); } // report the fit and calc atom expressions if ( fitexpr == NULL ) printf( "\nAll atom fit.\n"); else printf( "\n-fit : Fitting on the atom expression \"%s\" : %d atoms.\n", fitexpr, n_fitatoms ); if ( calcexpr == NULL ) printf( "All atom RMSDs.\n"); else printf( "-calc : Calculating on the atom expression \"%s\" : %d atoms.\n\n", calcexpr, n_calcatoms ); // compute the pairwise RMSDs and the overall rms difference for ( i=2; i<=n_mol; i=i+1 ){ for ( j=1; j