예제 #1
0
	void processResData_ByRotID( const std::string& resName, ContainerType& data, RotamerLibrary& _RotLib )
	{
		// Sort the data to increase efficiency below
		std::stable_sort( data.begin(), data.end(), sortPsi);
		std::stable_sort( data.begin(), data.end(), sortPhi);		
		std::stable_sort( data.begin(), data.end(), sortRotID);

		ContainerType subdata;
		
		while( true )
		{
			if( data.size() > 0 && (subdata.size() == 0 || subdata[0].rotID.compare( data.back().rotID,0,4,0 )) )
			{
				subdata.push_back( data.back() );
				data.erase(data.end()-1); // rob the end, not the start (ContainerType<> perfomance reasons!)
			}
			else
			{
				ASSERT( data.size() == (36*36), ParseException, "Assumption error!");
				ASSERT( data[0].phi == -180.0 && data[0].psi == -180.0, ParseException, "Wrong phi/psi");
				for( size_t j = 1; j < data.size(); j++ )
				{	
					ASSERT( data[j].phi == (-180.0+(j/36)*10) && data[j].psi == (-180.0+(j%36)*10), ParseException, "Wrong phi/psi");			
				}
				processData( resName, subdata, _RotLib, 40.0 ); // 40 degree tollerance delta from data[0]
				subdata.clear();
				if( data.size() == 0 )
				{
					return;
				}
			}
		}		
	}
예제 #2
0
inline void clearCointainerOfPointers(ContainerType& container_) {
  typename ContainerType::iterator it = container_.begin();
  while (it != container_.end()) {
    delete *it;
    ++it;
  }
  container_.clear();
}
예제 #3
0
	void processResData_ByChis( const std::string& resName, ContainerType& data, RotamerLibrary& _RotLib )
	{
		const double tollerance = 12.0;

		// Ensure full chi arrays
		size_t largestSoFar = data[0].chis.size();
		for( size_t i = 1; i < data.size(); i++ )
		{
			if( data[i].chis.size() > largestSoFar )
			{
				largestSoFar = data[i].chis.size();
				i = 0; // reset
			}
			while( data[i].chis.size() < largestSoFar )
			{
				data[i].chis.push_back(0.0);
			}
		}

		size_t done = 0;
		std::vector<bool> taken(data.size());
		while( data.size() > done )
		{
			ContainerType subdata;
			bool on = false;
			for( int i = (int)data.size()-1; i >= 0; i-- )
			{
				if( taken[i] != true && (!on || equalChis( subdata[0], data[i], tollerance ) ) )
				{
					subdata.push_back( data[i] );
					taken[i] = true;
					on = true;
					done++;
				}
			}
			processData( resName, subdata, _RotLib, tollerance );
			subdata.clear();
		}
		data.clear();
	}
예제 #4
0
	void CharPtrArrayToStringContainer(unsigned int in_count,
	char **in_list, ContainerType &container, const char *name_string = NULL)
{
	container.clear();

	C_ListTypeString<unsigned int> tmp_list;
	//	Force it to look like a 'C_ListTypeString'...
	tmp_list.SetCount(in_count);
	tmp_list.SetList(in_list);
	//	Put the list into the container...
	tmp_list.ToContainer(container, name_string);
	//	Mustn't try to free when we leave this scope...
	tmp_list.Reset();
}
예제 #5
0
void BigInt::makeMultiplicationWithNumbersAndDigit(const ContainerType& numbers, RankType digit, ContainerType& result)
{
	result.clear();
	result.push_back(0);
	if (0 == digit)
	{
		return;
	}
	else if (1 == digit)
	{
		result = numbers;
	}
	else
	{
		for (int rankIndex = 0; rankIndex < numbers.size(); rankIndex++)
		{
			RankType multiplication = numbers[rankIndex] * digit;
			if (result.size() == rankIndex)
			{
				result.push_back(multiplication % kBaseValue);
			}
			else
			{
				result[rankIndex] += multiplication % kBaseValue;
			}

			if (result[rankIndex] / kBaseValue)
			{
				result[rankIndex] %= kBaseValue;
				result.push_back(1);
			}

			if (multiplication / kBaseValue)
			{
				if (result.size() == rankIndex + 1)
				{
					result.push_back(multiplication / kBaseValue);
				}
				else
				{
					result[rankIndex + 1] += multiplication / kBaseValue;
				}
			}
		}
	}
}
예제 #6
0
 void clear()
 {
     _buffer.clear();
 }