input_state.cc

来自「c++编写的并行拉马克遗传算法的程序。实现分析对接程序」· CC 代码 · 共 59 行

CC
59 行
字号
/* input_state.cc */#include <math.h>#ifdef sgi    #include <stdio.h>    #include <string.h>    #include "input_state.h"#else    extern "C"    {	#include <stdio.h>	#include <string.h>        #include "input_state.h"    }#endif#define LINELEN 132int input_state( State *S,		 FILE  *fp,		 char  line[LINE_LEN],		 int   ntor,		 int   *p_istep,		 float *p_energy,		 float *p_eint,		 char  *p_lastmove ){    int i, istep, status;    float energy, eint;    char lastmove;    char myline[LINELEN];#ifdef DEBUG    fprintf(stderr, "line=|%s|\n", line);#endif /* DEBUG */    status = sscanf(line, "%*s %d %1s %f %f %lf %lf %lf %lf %lf %lf %lf", &istep, &lastmove, &energy, &eint,  &(S->T.x), &(S->T.y), &(S->T.z),  &(S->Q.nx), &(S->Q.ny), &(S->Q.nz),  &(S->Q.ang) );    if (status != 0) {	S->Q.ang = Rad( S->Q.ang );	mkUnitQuat( &(S->Q) );        *p_istep = istep;	*p_energy = energy;	*p_eint = eint;	*p_lastmove = lastmove;        for (i=0; i<ntor; i++) {	    (void) fgets(myline, LINELEN, fp);            sscanf(myline, "%lf", &(S->tor[i]) ); /* input torsions are in degrees */            S->tor[i] = Rad( S->tor[i] );    /* now in radians */        }    }    return( status );}/* EOF */

⌨️ 快捷键说明

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