# OESetCrystalSymmetry¶

bool OESetCrystalSymmetry(OEChem::OEMolBase &mol,
const OECrystalSymmetryParams &params,
bool force=false)


Sets the crystal symmetry stored in a OECrystalSymmetryParams object for a given molecule.

The above functions return false if the space group number (returned by OECrystalSymmetryParams.GetSpaceGroup) is not found or the symmetry cannot be set on the molecule because the constraints on the spacegroup are violated.

If force is set to true, then parameters that violate the constraints of the given spacegroup will be applied. (This is sometimes necessary based on slight rounding errors for deposited CRYST1 cards).

Note

Use this overloaded function in the supported wrapped languages: Python, Java and C#.

Example:

OECrystalSymmetryParams p = new OECrystalSymmetryParams(124.978f, 124.978f, 69.000f, 90.0f, 90.0f, 120.0f, 154, 4);
if (oebio.OESetCrystalSymmetry(mol, p)) {
System.out.print("a=" + p.GetA() + " b=" + p.GetB() + " c=" + p.GetC());
System.out.print(" alpha=" + p.GetAlpha() + " beta=" + p.GetBeta() + " gamma=" + p.GetGamma());
System.out.print(" spacegroup=" + p.GetSpaceGroup() + " z-value= " + p.GetZValue());
System.out.println();
}

bool OESetCrystalSymmetry(OEChem::OEMolBase &mol,
float a, float b, float c,
float alpha, float beta, float gamma,
unsigned int sgnumber, bool force=false)


Sets the crystal symmetry for a given molecule.

The above functions return false if the indicated space group number is not found or the symmetry cannot be set on the molecule because the constraints on the spacegroup are violated, such as a=b for tetragonal spacegroups.

If force is set to true, then parameters that violate the constraints of the given spacegroup will be applied. (This is sometimes necessary based on slight rounding errors for deposited CRYST1 cards).