Skip to content

Commit

Permalink
Update tests to work with new format restraints
Browse files Browse the repository at this point in the history
  • Loading branch information
pemsley committed Sep 25, 2018
1 parent 14266ab commit 92b0972
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 78 deletions.
14 changes: 10 additions & 4 deletions greg-tests/01-pdb+mtz.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1989,15 +1989,21 @@
(greg-testcase "update monomer restraints" #t
(lambda ()

(let ((atom-pair (list " CB " " CG "))
;; this test needs a refinment map

(let ((atom-pair ; (list " CB " " CG ")) ;; round the wrong way in the new dictionary
(list " CG " " CB "))
(m (monomer-restraints "TYR")))

(if (not m)
(begin
(format #t " update bond restraints - no momomer restraints~%")
(throw 'fail)))

(let ((n (strip-bond-from-restraints atom-pair m)))
;; let's delete both ways
;;
(let* ((n-t (strip-bond-from-restraints atom-pair m))
(n (strip-bond-from-restraints (reverse atom-pair) n-t)))
(set-monomer-restraints "TYR" n)

(let ((imol (new-molecule-by-atom-selection imol-rnase "//A/30")))
Expand All @@ -2007,7 +2013,7 @@

(let ((atom-1 (get-atom imol "A" 30 "" " CB "))
(atom-2 (get-atom imol "A" 30 "" " CG ")))

(format #t " Bond-length: ~s: ~%"
(bond-length (list-ref atom-1 2) (list-ref atom-2 2)))

Expand Down Expand Up @@ -2037,7 +2043,7 @@
(begin
(format #t "FAIL plane atom ~s~%" atom)
(throw 'fail)))))

(format #t " Bond-length: ~s: ~%"
(bond-length (list-ref atom-1 2) (list-ref atom-2 2)))
(bond-length-within-tolerance? atom-1 atom-2 1.512 0.04))))))))))
Expand Down
84 changes: 43 additions & 41 deletions greg-tests/03-ligand.scm
Original file line number Diff line number Diff line change
Expand Up @@ -242,49 +242,51 @@
(format #t "fail to move atom back to start d2~%"))
#t)))))))))))))))))

(greg-testcase "Test dipole" #t
(lambda ()

(let ((imol (greg-pdb "dipole-residues.pdb")))

(if (not (valid-model-molecule? imol))
(begin
(format #t "dipole-residues.pdb not found~%")
#f)

(let* ((residue-specs
(list
(list "A" 1 "")
(list "A" 2 "")
(list "A" 3 "")))
(dipole (add-dipole-for-residues imol residue-specs)))

(if (not dipole)
(begin
(format #t "bad dipole ~s~%" dipole)
#f)
(let ((d (car dipole))
(dip (cadr dipole)))

(let ((dip-x (list-ref dip 0))
(dip-y (list-ref dip 1))
(dip-z (list-ref dip 2)))

(format #t "info:: dipole components ~s ~%" dip)

(if (not (and (close-float? dip-y 0)
(close-float? dip-z 0)))
(begin
(format #t "bad dipole y z components ~s ~s~%"
dip-y dip-z)
#f)
;; no partial charges in the dictionary now.
;;
;(greg-testcase "Test dipole" #t
; (lambda ()

; (let ((imol (greg-pdb "dipole-residues.pdb")))

; (if (not (valid-model-molecule? imol))
; (begin
; (format #t "dipole-residues.pdb not found~%")
; #f)

; (let* ((residue-specs
; (list
; (list "A" 1 "")
; (list "A" 2 "")
; (list "A" 3 "")))
; (dipole (add-dipole-for-residues imol residue-specs)))

; (if (not dipole)
; (begin
; (format #t "bad dipole ~s~%" dipole)
; #f)
; (let ((d (car dipole))
; (dip (cadr dipole)))

; (let ((dip-x (list-ref dip 0))
; (dip-y (list-ref dip 1))
; (dip-z (list-ref dip 2)))

; (format #t "info:: dipole components ~s ~%" dip)

; (if (not (and (close-float? dip-y 0)
; (close-float? dip-z 0)))
; (begin
; (format #t "bad dipole y z components ~s ~s~%"
; dip-y dip-z)
; #f)

;; dipole points in the negative x direction
(if (and (< dip-x 0)
(> dip-x -20))
; ;; dipole points in the negative x direction
; (if (and (< dip-x 0)
; (> dip-x -20))

#t
#f))))))))))
; #t
; #f))))))))))


(greg-testcase "Reading new dictionary restraints replaces" ;; not adds
Expand Down
6 changes: 4 additions & 2 deletions python-tests/01_pdb_mtz.py
Original file line number Diff line number Diff line change
Expand Up @@ -1610,8 +1610,10 @@ def test33_0(self):
m = monomer_restraints("TYR")
self.failUnless(m, " update bond restraints - no momomer restraints")

n = strip_bond_from_restraints(atom_pair, m)
set_monomer_restraints("TYR", n)
n1 = strip_bond_from_restraints(atom_pair, m)
atom_pair.reverse()
n2 = strip_bond_from_restraints(atom_pair, n1)
set_monomer_restraints("TYR", n2)

imol = new_molecule_by_atom_selection(imol_rnase, "//A/30")

Expand Down
25 changes: 1 addition & 24 deletions python-tests/03_ligand.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,32 +120,9 @@ def test06_0(self):
def test08_0(self):
"""Test dipole"""

imol = unittest_pdb("dipole-residues.pdb")
self.assertTrue(True)

self.failUnless(valid_model_molecule_qm(imol), "dipole-residues.pdb not found")

residue_specs = [["A", 1, ""],
["A", 2, ""],
["A", 3, ""]]
dipole = add_dipole_for_residues(imol, residue_specs)

self.failIf(not dipole, "bad dipole %s" %dipole)

d = dipole[0]
dip = dipole[1]

dip_x = dip[0]
dip_y = dip[1]
dip_z = dip[2]

print "info:: dipole components", dip

self.failUnlessAlmostEqual(dip_y, 0.0, 2, "bad dipole y component %s" %dip_y)
self.failUnlessAlmostEqual(dip_z, 0.0, 2, "bad dipole z component %s" %dip_z)

self.failUnless(dip_x < 0 and dip_x > -20)


def test09_0(self):
"""Reading new dictionary restraints replaces"""

Expand Down
1 change: 0 additions & 1 deletion src/c-interface-info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2587,7 +2587,6 @@ void fill_single_map_properties_dialog(GtkWidget *window, int imol) {
GtkWidget *rb_2 = lookup_widget(window, "displayed_map_style_as_cut_glass_radiobutton");
GtkWidget *rb_3 = lookup_widget(window, "displayed_map_style_as_transparent_radiobutton");
GtkWidget *scale = lookup_widget(window, "map_opacity_hscale");


graphics_info_t g;
if (g.molecules[imol].draw_it_for_solid_density_surface) {
Expand Down
20 changes: 14 additions & 6 deletions src/testing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2259,13 +2259,21 @@ int test_OXT_in_restraints() {
} else {
bool v1 = geom.OXT_in_residue_restraints_p("TRP");
bool v2 = geom.OXT_in_residue_restraints_p("BCS");
if (v1 == 0)
if (v2 == 1)
r = 1;
else
std::cout << "fail to find OXT in BSC" << std::endl;

// This doesn't work for new restraints (which *do* have OXTs)
// if (v1 == 0)
// if (v2 == 1)
// r = 1;
// else
// std::cout << "fail to find OXT in BSC" << std::endl;
// else
// std::cout << "Fail to not find OXT in TRP" << std::endl;

if (v2 == 1)
r = 1;
else
std::cout << "Fail to not find OXT in TRP" << std::endl;
std::cout << "fail to find OXT in BSC" << std::endl;

}
return r;
}
Expand Down

0 comments on commit 92b0972

Please sign in to comment.