⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tornorvec.cc

📁 c++编写的并行拉马克遗传算法的程序。实现分析对接程序
💻 CC
字号:
/* torNorVec.cc */#include <math.h>#ifdef sgi    #include <stdio.h>    #include <stdlib.h>    #include "torNorVec.h"    #ifdef DEBUG	#include <ctype.h>    #endif /* DEBUG */#else    extern "C"    {	#include <stdio.h>	#include <stdlib.h>        #include "torNorVec.h"	#ifdef DEBUG	    #include <ctype.h>	#endif /* DEBUG */    }#endifextern FILE *logFile;void torNorVec( float crdpdb[MAX_ATOMS][SPACE],		int ntor,		int tlist[MAX_TORS][MAX_ATOMS],		float vt[MAX_TORS][SPACE] ){    register int XYZ = 0;    register int j = 0;    float magVec = 0.;    float imagVec = 0.;    float v[SPACE];    char error_message[LINE_LEN];    /*_____________________________________________________________      | Calculate normal vectors of torsion bonds,                 |      |____________________________________________________________|      |      Note: torsions must be rotated from leaves to root    |      |       or this pre-calculation of normal vectors will fail. |      |____________________________________________________________| */    pr( logFile, "\nCalculating normalized torsion vectors.\n\n" );    for (j=0; j<ntor; j++) {	for (XYZ = 0;  XYZ < SPACE;  XYZ++) {	    v[XYZ] = crdpdb[ tlist[j][ATM2] ][XYZ] - crdpdb[ tlist[j][ATM1] ][XYZ];#ifdef DEBUG		pr( logFile, "\n__norm__ Torsion %d, crdpdb[ %d,ATM2 ][%c] = %.3f, crdpdb[ %d,ATM1 ][%c] = %.3f\n",		    j, tlist[j][ATM2], toascii(88+XYZ), crdpdb[tlist[j][ATM2]][XYZ], 		    tlist[j][ATM1], toascii(88+XYZ), crdpdb[tlist[j][ATM1]][XYZ] );		flushLog; #endif /* DEBUG */	} /* XYZ */	magVec = hypotenuse( v[X], v[Y], v[Z] );  /* Magnitude of vector v[XYZ] */	if (magVec == 0.) {	    prStr( error_message, "Torsion %d, normal vector, magVec, is 0; imminent division by zero caught.", j );	    stop( error_message );	    exit( -1 );	}	imagVec = 1. / magVec;	for (XYZ = 0;  XYZ < SPACE;  XYZ++) {	    vt[j][XYZ] = v[XYZ] * imagVec;  /* Normalize. */	} /* XYZ */    } /* j */    flushLog;}/* EOF */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -