File: PYMOL-2700.py

package info (click to toggle)
pymol 3.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 74,084 kB
  • sloc: cpp: 482,660; python: 89,328; ansic: 29,512; javascript: 6,792; sh: 84; makefile: 25
file content (27 lines) | stat: -rw-r--r-- 795 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'''
mol2 partial charge export
'''

from pymol import cmd, CmdException, testing, stored

class TestPYMOL2700(testing.PyMOLTestCase):

    @testing.requires_version('1.8.0.4')
    def testMol2PartialChargeExport(self):
        cmd.fragment('gly')

        charges_pre = []
        cmd.iterate('*', 'charges_pre.append(partial_charge)', space=locals())

        # fragment library has charges, but better check...
        self.assertTrue(sum(abs(c) for c in charges_pre) > 0.0)

        with testing.mktemp('.mol2') as filename:
            cmd.save(filename)
            cmd.delete('*')
            cmd.load(filename)

        charges_post = []
        cmd.iterate('*', 'charges_post.append(partial_charge)', space=locals())

        self.assertArrayEqual(charges_pre, charges_post, delta=1e-2)