[cctbxbb] Error in fractional coordinates returned by cctbx

Petrus H Zwart PHZwart at lbl.gov
Thu Dec 28 14:19:51 PST 2006


Hi David,

The fmod_positive doesn't work on a flex.vec3_double unfortunately.

The hack below does however work. It involves a python loop over the sites, which is not so nice of course.
I wasn't able to find a python implementation of the coordinates.h class somehow. I hope this does the trick for now:

  p1struc = icsd_structure.expand_to_p1()
  sites = p1struc.sites_frac()
  tmp_sites = flex.vec3_double()
  for site in sites:
    site = tuple(flex.fmod_positive(flex.double(site),1))
    tmp_sites.append( site )
  p1struc.set_sites_frac( tmp_sites )
  p1struc.show_summary().show_scatterers()
  print "OK"

HTH

Peter






> Peter,
> 
> Thanks for the input...  You are correct that for a protein mod(1) 
> would be less than helpful.  My issue is that without it I am 
> unable to get the correct supercell structure of this and other 
> inorganic crystals.
> 
> Is there a way via cctbx to get mod(1) values?
> 
> Thanks
> Andrew 
> 
> ----- Original Message -----
> From: Petrus H Zwart <PHZwart at lbl.gov>
> Date: Thursday, December 28, 2006 2:52 pm
> Subject: Re: [cctbxbb] Error in fractional coordinates returned by 
> cctbx
> > Hi Andrew, 
> > 
> > I guess what happens is this:
> > 
> > When you use the expand_to_p1() command, the symmetry operators 
> > for P 32 2 1 are applied on the fractional coordniates as given. 
> > You expect a mod(1) operator to be carried out as well.
> > 
> > The advantage of not applying this operator is that you do not 
> > loose 'connectivity' between atoms.
> > I can imagine that this is not a real issue for certain 
> inorganic 
> > compounds, but for organic compounds and proteins not having the 
> > 'intuitive' connectivity in the coordinates (atoms close to each 
> > other are bonded) this is an issue.
> > 
> > I agree with Eric that the negative fractional do not fit in 
> your 
> > view of a perfect world view either.
> > 
> > I guess Ralf/the cctbx has something somewhere to do the mod(1) 
> > operation to get the fractional coordinates in the range you 
> like. 
> > 
> > HTH
> > 
> > Peter
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > ----- Original Message -----
> > From: David A Carr <dcarr2 at gmu.edu>
> > Date: Thursday, December 28, 2006 10:59 am
> > Subject: [cctbxbb] Error in fractional coordinates returned by cctbx
> > To: cctbxbb at phenix-online.org
> > 
> > > Hello,
> > > 
> > > I have encountered the following inconsistency when working 
> with 
> > > cctbx.  The compound I am working with is as follows.
> > > 
> > > #Silicon Dioxide Quartz low.
> > > #Si O2
> > > #ICSD Coll Number 62410
> > > 
> > > label="Si", site=(0.4643,0.0,0.6667)
> > > label="O", site=(0.411,0.2773,0.7783)
> > > 
> > > unit_cell="4.8430, 4.8430, 5.3480, 90.0, 90.0, 120.0",
> > > 
> > > space_group_symbol="P 32 2 1"
> > > 
> > > 
> > > 
> > > The error is can be seen in the below.  In the second and 
> third 
> > Si 
> > > lines the z value is not a fraction of the unit. Similarly two 
> > of 
> > > the oxygens are placed outside the unit cell.  Why does cctbx 
> > > place these outside of the unit cell?   
> > > 
> > > Number of scatterers: 9
> > > At special positions: 0
> > > Unit cell: (4.843, 4.843, 5.348, 90, 90, 120)
> > > Space group: P 1 (No. 1)
> > > Label, Scattering, Multiplicity, Coordinates, Occupancy, Uiso
> > > Si1  Si     1 ( 0.4643  0.0000  0.6667) 1.00 0.0000
> > > Si1  Si     1 ( 0.0000  0.4643  1.3333) 1.00 0.0000
> > > Si1  Si     1 (-0.4643 -0.4643  1.0000) 1.00 0.0000
> > > O1   O      1 ( 0.4110  0.2773  0.7783) 1.00 0.0000
> > > O1   O      1 (-0.2773  0.1337  1.4450) 1.00 0.0000
> > > O1   O      1 (-0.1337 -0.4110  1.1116) 1.00 0.0000
> > > O1   O      1 ( 0.1337 -0.2773 -0.4450) 1.00 0.0000
> > > O1   O      1 (-0.4110 -0.1337 -0.1116) 1.00 0.0000
> > > O1   O      1 ( 0.2773  0.4110 -0.7783) 1.00 0.0000
> > > 
> > > Below shows the expected fractional coordinates as  expected.  
> > > Based on the space group P 32 2 1.
> > > 
> > > 0.4643  0.0000  0.6667
> > > 0.0000  0.4643  0.3333
> > > -0.4643 -0.4643  0.0000
> > > 0.4110  0.2773  0.7783
> > > -0.2773  0.1337  0.4450
> > > -0.1337 -0.4110  0.1116
> > > 0.1337 -0.2773 -0.4450
> > > -0.4110 -0.1337 -0.1116
> > > 0.2773  0.4110 -0.7783 
> > > 
> > > Any insight into this would be of help.  I am hoping to use 
> > cctbx 
> > > as a part of our current software development project.
> > > 
> > > 
> > > Thanks,
> > > 
> > > D.Andrew Carr
> > > dcarr2 at gmu.edu
> > > 
> > > 
> > > # Below is the code that generates the error
> > > #  posted above.
> > > #---------------------------------------------------
> > > from cctbx import xray
> > > from cctbx import crystal
> > > from cctbx.array_family import flex
> > > 
> > > def demo():
> > >  crystal_symmetry = crystal.symmetry(
> > >    unit_cell="4.8430, 4.8430, 5.3480, 90.0, 90.0, 120.0",
> > >    space_group_symbol="P 32 2 1")
> > >  scatterers = flex.xray_scatterer()
> > >  scatterers.append(xray.scatterer(
> > >    label="Si", site=(0.4643,0.0,0.6667)))
> > >  scatterers.append(xray.scatterer(
> > >    label="O", site=(0.411,0.2773,0.7783)))
> > >  icsd_structure = xray.structure(
> > >    crystal_symmetry=crystal_symmetry,
> > >    scatterers=scatterers)
> > >  print "ICSD Structure"
> > >  icsd_structure.show_summary().show_scatterers()
> > >  print
> > >  icsd_structure.show_distances(distance_cutoff=2.5)
> > >  print "Primitive"
> > >  primitive_structure = icsd_structure.primitive_setting()
> > >  primitive_structure.show_summary().show_scatterers()
> > >  print
> > >  p1_structure = primitive_structure.expand_to_p1()
> > >  p1_structure.show_summary().show_scatterers()
> > >  print
> > >  print "Expanded to P1"
> > >  icsd_structure.expand_to_p1().show_summary().show_scatterers()
> > >  print "OK"
> > > 
> > > if (__name__ == "__main__"):
> > >  demo()
> > > 
> > > 
> > _______________________________________________
> > cctbxbb mailing list
> > cctbxbb at phenix-online.org
> > http://www.phenix-online.org/mailman/listinfo/cctbxbb
> > 
> 


More information about the cctbxbb mailing list