/** Returns a new UnitCell-object with crystal system constraints taken into
 *  account
 *
 *  This method constructs a new UnitCell-object based on the values of the
 *  supplied cell,
 *  but takes into account the constraints of the crystal system. For
 *  monoclinic, a unique b-axis is assumed.
 *
 *  It's useful for "cleaning" user input.
 *
 * @param unitCell :: UnitCell-object which should be constrained
 * @param crystalSystem :: Crystal system which is used for constraints
 * @return UnitCell-object with applied constraints
 */
UnitCell PoldiCreatePeaksFromCell::getConstrainedUnitCell(
    const UnitCell &unitCell, const PointGroup::CrystalSystem &crystalSystem,
    const Group::CoordinateSystem &coordinateSystem) const {
  switch (crystalSystem) {
  case PointGroup::CrystalSystem::Cubic:
    return UnitCell(unitCell.a(), unitCell.a(), unitCell.a());
  case PointGroup::CrystalSystem::Tetragonal:
    return UnitCell(unitCell.a(), unitCell.a(), unitCell.c());
  case PointGroup::CrystalSystem::Orthorhombic:
    return UnitCell(unitCell.a(), unitCell.b(), unitCell.c());
  case PointGroup::CrystalSystem::Monoclinic:
    return UnitCell(unitCell.a(), unitCell.b(), unitCell.c(), 90.0,
                    unitCell.beta(), 90.0);
  case PointGroup::CrystalSystem::Trigonal:
    if (coordinateSystem == Group::Orthogonal) {
      return UnitCell(unitCell.a(), unitCell.a(), unitCell.a(),
                      unitCell.alpha(), unitCell.alpha(), unitCell.alpha());
    }
  // fall through to hexagonal.
  case PointGroup::CrystalSystem::Hexagonal:
    return UnitCell(unitCell.a(), unitCell.a(), unitCell.c(), 90.0, 90.0,
                    120.0);
  default:
    return UnitCell(unitCell);
  }
}
/// Constructs a UnitCell-object from the algorithm properties.
UnitCell PoldiCreatePeaksFromCell::getUnitCellFromProperties() const {
  double a = getProperty("a");
  double b = getProperty("b");
  double c = getProperty("c");

  double alpha = getProperty("alpha");
  double beta = getProperty("beta");
  double gamma = getProperty("gamma");

  return UnitCell(a, b, c, alpha, beta, gamma);
}
Esempio n. 3
0
// Action_Vector::DoAction()
Action::RetType Action_Vector::DoAction(int frameNum, Frame* currentFrame, Frame** frameAddress) {
    switch ( mode_ ) {
    case MASK        :
        Mask(*currentFrame);
        break;
    case CENTER      :
        Vec_->AddVxyz( currentFrame->VCenterOfMass(mask_) );
        break;
    case DIPOLE      :
        Dipole(*currentFrame);
        break;
    case PRINCIPAL_X :
    case PRINCIPAL_Y :
    case PRINCIPAL_Z :
        Principal(*currentFrame);
        break;
    case CORRPLANE   :
        CorrPlane(*currentFrame);
        break;
    case BOX         :
        Vec_->AddVxyz( currentFrame->BoxCrd().Lengths() );
        break;
    case BOX_X       :
    case BOX_Y       :
    case BOX_Z       :
    case BOX_CTR     :
        UnitCell( currentFrame->BoxCrd() );
        break;
    case MINIMAGE    :
        MinImage( *currentFrame );
        break;
    default          :
        return Action::ERR; // NO_OP
    } // END switch over vectorMode
    if (Magnitude_ != 0) {
        float mag = (float)(sqrt(Vec_->Back().Magnitude2()));
        Magnitude_->Add(frameNum, &mag);
    }
    return Action::OK;
}
Esempio n. 4
0
dng_point dng_area_task::FindTileSize (const dng_rect &area) const
	{
	
	dng_rect repeatingTile1 = RepeatingTile1 ();
	dng_rect repeatingTile2 = RepeatingTile2 ();
	dng_rect repeatingTile3 = RepeatingTile3 ();
	
	if (repeatingTile1.IsEmpty ())
		{
		repeatingTile1 = area;
		}
	
	if (repeatingTile2.IsEmpty ())
		{
		repeatingTile2 = area;
		}
	
	if (repeatingTile3.IsEmpty ())
		{
		repeatingTile3 = area;
		}
		
	uint32 repeatV = Min_uint32 (Min_uint32 (repeatingTile1.H (),
											 repeatingTile2.H ()),
											 repeatingTile3.H ());
	
	uint32 repeatH = Min_uint32 (Min_uint32 (repeatingTile1.W (),
											 repeatingTile2.W ()),
											 repeatingTile3.W ());
	
	dng_point maxTileSize  = MaxTileSize ();

	dng_point tileSize (maxTileSize);
	
	tileSize.v = Min_int32 (tileSize.v, repeatV);
	tileSize.h = Min_int32 (tileSize.h, repeatH);
						
	uint32 countV = (repeatV + tileSize.v - 1) / tileSize.v;
	uint32 countH = (repeatH + tileSize.h - 1) / tileSize.h;
	
	tileSize.v = (repeatV + countV - 1) / countV;
	tileSize.h = (repeatH + countH - 1) / countH;
	
	dng_point unitCell = UnitCell ();
	
	tileSize.v = ((tileSize.v + unitCell.v - 1) / unitCell.v) * unitCell.v;
	tileSize.h = ((tileSize.h + unitCell.h - 1) / unitCell.h) * unitCell.h;
	
	if (tileSize.v > maxTileSize.v)
		{
		tileSize.v = (maxTileSize.v / unitCell.v) * unitCell.v;
		}
		
	if (tileSize.h > maxTileSize.h)
		{
		tileSize.h = (maxTileSize.h / unitCell.h) * unitCell.h;
		}
		
	return tileSize;
	
	}