예제 #1
0
    def test_same_molecule(self):

        # Exact same
        self.assertFalse(
            self.predicate(
                other=clash.sphere(
                    centre=self.centre,
                    radius=self.radius,
                    molecule=self.molecule,
                    atom=self.atom + 1,
                    altloc=self.altloc,
                    symop=self.symop,
                )
            )
        )

        # Symmetry equivalent
        self.assertTrue(
            self.predicate(
                other=clash.sphere(
                    centre=self.centre,
                    radius=self.radius,
                    molecule=self.molecule,
                    atom=self.atom + 1,
                    altloc=self.altloc,
                    symop=self.symop2,
                )
            )
        )
        self.assertFalse(
            self.predicate(
                other=clash.sphere(
                    centre=(0, 0, 3 * self.radius),
                    radius=self.radius,
                    molecule=self.molecule,
                    atom=self.atom + 1,
                    altloc=self.altloc,
                    symop=self.symop2,
                )
            )
        )
        self.assertFalse(
            self.predicate(
                other=clash.sphere(
                    centre=self.centre,
                    radius=self.radius,
                    molecule=self.molecule,
                    atom=self.atom + 1,
                    altloc=clash.altloc_strategy.alternate(identifier="B"),
                    symop=self.symop2,
                )
            )
        )
예제 #2
0
  def test_same_molecule(self):

    # Exact same
    self.assertFalse(
      self.predicate(
        other = clash.sphere(
          centre = self.centre,
          radius = self.radius,
          molecule = self.molecule,
          atom = self.atom + 1,
          altloc = self.altloc,
          symop = self.symop,
          )
        )
      )

    # Symmetry equivalent
    self.assertTrue(
      self.predicate(
        other = clash.sphere(
          centre = self.centre,
          radius = self.radius,
          molecule = self.molecule,
          atom = self.atom + 1,
          altloc = self.altloc,
          symop = self.symop2,
          )
        )
      )
    self.assertFalse(
      self.predicate(
        other = clash.sphere(
          centre = ( 0, 0, 3 * self.radius ),
          radius = self.radius,
          molecule = self.molecule,
          atom = self.atom + 1,
          altloc = self.altloc,
          symop = self.symop2,
          )
        )
      )
    self.assertFalse(
      self.predicate(
        other = clash.sphere(
          centre = self.centre,
          radius = self.radius,
          molecule = self.molecule,
          atom = self.atom + 1,
          altloc = clash.altloc_strategy.alternate( identifier = "B" ),
          symop = self.symop2,
          )
        )
      )
예제 #3
0
  def test_structure(self):

    self.assertEqual( len( self.indexer ), 0 )

    sphere = clash.sphere(
      centre = self.centre,
      radius = self.radius,
      molecule = self.molecule,
      atom = self.atom,
      altloc = self.altloc,
      symop = self.symop,
      )

    self.indexer.add( object = sphere, position = sphere.centre )

    self.assertEqual( len( self.indexer ), 1 )

    closeby = self.indexer.close_to( centre = sphere.centre )
    self.assertEqual( len( closeby ), 1 )

    spheres = list( closeby )

    self.assertEqual( sphere.atom, spheres[0].atom )
    self.assertEqual( sphere.molecule, spheres[0].molecule )
    self.assertEqual( sphere.symop, spheres[0].symop )

    closeby = self.indexer.close_to( centre = [ c + 3 for c in self.centre ] )
    self.assertEqual( len( closeby ), 0 )
예제 #4
0
    def test_structure(self):

        self.assertEqual(len(self.indexer), 0)

        sphere = clash.sphere(
            centre=self.centre,
            radius=self.radius,
            molecule=self.molecule,
            atom=self.atom,
            altloc=self.altloc,
            symop=self.symop,
        )

        self.indexer.add(object=sphere, position=sphere.centre)

        self.assertEqual(len(self.indexer), 1)

        closeby = self.indexer.close_to(centre=sphere.centre)
        self.assertEqual(len(closeby), 1)

        spheres = list(closeby)

        self.assertEqual(sphere.atom, spheres[0].atom)
        self.assertEqual(sphere.molecule, spheres[0].molecule)
        self.assertEqual(sphere.symop, spheres[0].symop)

        closeby = self.indexer.close_to(centre=[c + 3 for c in self.centre])
        self.assertEqual(len(closeby), 0)
예제 #5
0
  def test_same_atom(self):

    # Exact same
    self.assertFalse(
      self.predicate(
        other = clash.sphere(
          centre = self.centre,
          radius = self.radius,
          molecule = self.molecule,
          atom = self.atom,
          altloc = self.altloc,
          symop = self.symop,
          )
        )
      )

    # Symmetry equivalent
    self.assertTrue(
      self.predicate(
        other = clash.sphere(
          centre = self.centre,
          radius = self.radius,
          molecule = self.molecule,
          atom = self.atom,
          altloc = self.altloc,
          symop = self.symop2,
          )
        )
      )
    self.assertFalse(
      self.predicate(
        other = clash.sphere(
          centre = ( 0, 0, 3 * self.radius ),
          radius = self.radius,
          molecule = self.molecule,
          atom = self.atom,
          altloc = self.altloc,
          symop = self.symop2,
          )
        )
      )
예제 #6
0
    def test_same_atom(self):

        # Exact same
        self.assertFalse(
            self.predicate(
                other=clash.sphere(
                    centre=self.centre,
                    radius=self.radius,
                    molecule=self.molecule,
                    atom=self.atom,
                    altloc=self.altloc,
                    symop=self.symop,
                )
            )
        )

        # Symmetry equivalent
        self.assertTrue(
            self.predicate(
                other=clash.sphere(
                    centre=self.centre,
                    radius=self.radius,
                    molecule=self.molecule,
                    atom=self.atom,
                    altloc=self.altloc,
                    symop=self.symop2,
                )
            )
        )
        self.assertFalse(
            self.predicate(
                other=clash.sphere(
                    centre=(0, 0, 3 * self.radius),
                    radius=self.radius,
                    molecule=self.molecule,
                    atom=self.atom,
                    altloc=self.altloc,
                    symop=self.symop2,
                )
            )
        )
예제 #7
0
    def test_altloc_a(self):

        sphere = clash.sphere(
            centre=self.centre,
            radius=self.radius,
            molecule=self.molecule,
            atom=self.atom,
            altloc=self.altloc_a,
            symop=self.symop,
        )
        self.check_sphere(sphere=sphere)
        self.check_altloc(sphere=sphere, interacting=[self.regular, self.altloc_a], noninteracting=[self.altloc_b])
예제 #8
0
    def test_altloc_c(self):

        sphere = clash.sphere(
            centre=self.centre,
            radius=self.radius,
            molecule=self.molecule,
            atom=self.atom,
            altloc=clash.altloc_strategy.alternate(identifier="C"),
            symop=self.symop,
        )
        self.check_sphere(sphere=sphere)
        self.check_altloc(sphere=sphere, interacting=[self.regular], noninteracting=[self.altloc_a, self.altloc_b])
예제 #9
0
  def test_other_molecules(self):

    self.assertTrue(
      self.predicate(
        other = clash.sphere(
          centre = self.centre,
          radius = self.radius,
          molecule = self.molecule + 1,
          atom = self.atom,
          altloc = self.altloc,
          symop = self.symop,
          )
        )
      )
    self.assertTrue(
      self.predicate(
        other = clash.sphere(
          centre = self.centre,
          radius = self.radius,
          molecule = self.molecule + 1,
          atom = self.atom,
          altloc = self.altloc,
          symop = self.symop2,
          )
        )
      )
    self.assertFalse(
      self.predicate(
        other = clash.sphere(
          centre = self.centre,
          radius = self.radius,
          molecule = self.molecule + 1,
          atom = self.atom,
          altloc = clash.altloc_strategy.alternate( identifier = "B" ),
          symop = self.symop,
          )
        )
      )
예제 #10
0
    def test_other_molecules(self):

        self.assertTrue(
            self.predicate(
                other=clash.sphere(
                    centre=self.centre,
                    radius=self.radius,
                    molecule=self.molecule + 1,
                    atom=self.atom,
                    altloc=self.altloc,
                    symop=self.symop,
                )
            )
        )
        self.assertTrue(
            self.predicate(
                other=clash.sphere(
                    centre=self.centre,
                    radius=self.radius,
                    molecule=self.molecule + 1,
                    atom=self.atom,
                    altloc=self.altloc,
                    symop=self.symop2,
                )
            )
        )
        self.assertFalse(
            self.predicate(
                other=clash.sphere(
                    centre=self.centre,
                    radius=self.radius,
                    molecule=self.molecule + 1,
                    atom=self.atom,
                    altloc=clash.altloc_strategy.alternate(identifier="B"),
                    symop=self.symop,
                )
            )
        )
예제 #11
0
  def test_regular(self):

    sphere = clash.sphere(
      centre = self.centre,
      radius = self.radius,
      molecule = self.molecule,
      atom = self.atom,
      altloc = self.regular,
      symop = self.symop,
      )
    self.check_sphere( sphere = sphere )
    self.check_altloc(
      sphere = sphere,
      interacting = [ self.regular, self.altloc_a, self.altloc_b],
      )
예제 #12
0
  def test_altloc_c(self):

    sphere = clash.sphere(
      centre = self.centre,
      radius = self.radius,
      molecule = self.molecule,
      atom = self.atom,
      altloc = clash.altloc_strategy.alternate( identifier = "C" ),
      symop = self.symop,
      )
    self.check_sphere( sphere = sphere )
    self.check_altloc(
      sphere = sphere,
      interacting = [ self.regular ],
      noninteracting = [ self.altloc_a, self.altloc_b ],
      )
예제 #13
0
  def setUp(self):

    self.centre = ( 0, 0, 0 )
    self.radius = 1.7
    self.molecule = 0
    self.atom = 0
    self.symop = clash.sgtbx.rt_mx( ( 1, 0, 0, 0, 1, 0, 0, 0, 1 ), ( 0, 0, 0 ) )
    self.symop2 = clash.sgtbx.rt_mx( ( 1, 0, 0, 0, 1, 0, 0, 0, 1 ), ( 0, 0, 1 ) )
    self.altloc = clash.altloc_strategy.alternate( identifier = "A" )

    self.predicate = clash.overlap_interaction_predicate(
      object = clash.sphere(
        centre = self.centre,
        radius = self.radius,
        molecule = self.molecule,
        atom = self.atom,
        altloc = self.altloc,
        symop = self.symop,
        ),
      tolerance = 0,
      )
예제 #14
0
    def setUp(self):

        self.centre = (0, 0, 0)
        self.radius = 1.7
        self.molecule = 0
        self.atom = 0
        self.symop = clash.sgtbx.rt_mx((1, 0, 0, 0, 1, 0, 0, 0, 1), (0, 0, 0))
        self.symop2 = clash.sgtbx.rt_mx((1, 0, 0, 0, 1, 0, 0, 0, 1), (0, 0, 1))
        self.altloc = clash.altloc_strategy.alternate(identifier="A")

        self.predicate = clash.overlap_interaction_predicate(
            object=clash.sphere(
                centre=self.centre,
                radius=self.radius,
                molecule=self.molecule,
                atom=self.atom,
                altloc=self.altloc,
                symop=self.symop,
            ),
            tolerance=0,
        )