# Matching a rigid body to a known fragment

The translation and rotation parameters of a known rigid body fragment within a unit cell can be determined by refining a rigid body against the known fragment. Consider a known fragment comprising two C atoms with sites named wC1 and wC2. Then create two more sites called C1 and C2 as follows:

```only_penalties
continue_after_convergence
xdd...
str...
site wC1... occ C 0
site wC2... occ C 0
...
site C1...
site C2...
...
rigid
z_matrix C1...
z_matrix C2...
rotate @...
rand_xyz 2
translate
tx ... val_on_continue = Val + Rand(-2, 2);
ty ... val_on_continue = Val + Rand(-2, 2);
tz ... val_on_continue = Val + Rand(-2, 2);

Distance_Restrain("C1 wC1", 0, 0, 0, 1)
Distance_Restrain("C2 wC2", 0, 0, 0, 1)```

Here the known site positions start with 'w'; these sites are not part of the rigid body. The sites named C1 and C2 are part of the rigid nody and only the rotate and translate parameters of the rigid body are refined. Note, the use of only_penalties. Also note that setting occupancies to zero means that the site can be used in penalties but it won’t take part in structure factor calculations if observed data were to be refined against.

Refinement would then fit the rigid body against the known site positions.

Alan Coelho 2011/08/25 19:13

This works as long as you don't have to consider symmetry equivalents of the C1 and wC1 sites for the mapping to work (e.g. atoms in adjacent unit cells). In that case you have to specify the full site label. The macro below might work for the more general case. The box_interaction sum is over all distances in the unit cell. Entering Z for site multiplicity should return the distance between the rigid body and target. It's untested.

```Match_Site(B4_1, O*, 1,  , 4, 1.2127903`)

macro Match_Site(s1, s2, wby, c, Z, Rcalc)
{
#m_ifarg c ""
#m_unique_not_refine c
#m_endif
box_interaction to_N 0 s1 s2 c = R;
local =c/Z;: Rcalc
penalty = (wby) c^2;
}```