void read_str_file() { int len = 1024; int readed = -1; STR buff; int file_line = 0; FILE* str_file; if( str_filename == NULL ) UNERR("str_filename not defined"); buff = (STR) malloc( sizeof(char) * len ); CHMEM(buff); str_file = fopen( str_filename, "r" ); if( str_file == NULL ) UNERR("Can't open str-file"); while( fgets( buff, len, str_file ) ) { if( readed ) /*Non empty line*/ { char* pos = strchr( buff, COMMENT_SIGN ); char* keyword; file_line++; if( pos ) *pos = '\0'; /* 'remove' comment */ if( !strlen(buff) ) continue; keyword = strtok( buff, " \t\n" ); if( !keyword ) continue; /* ok we have only spaces and tabs */ if( strcmp( keyword , SUB_TAG ) == 0 ) { parse_sub(); } else if( strcmp( keyword, BOND_TAG ) == 0 ) { parse_bond(); } else if( strcmp( keyword, ANGLE_TAG ) == 0 ) { parse_angle(); } else if( strcmp( keyword, DIHE_TAG ) == 0 ) { parse_dihe(); } else { warning( keyword, __FILE__, __LINE__ ); UNERR( "Unknow tag in str file" ); } } } end_sub(); end_angle(); end_angle_cos(); end_dihe(); end_dihe_angle(); end_bond(); free( buff ); fclose( str_file ); center_coords();/* Center coordinates */ }
point2 end() const { return mCenter + delta2::from_polar(mRadius, end_angle()); }