コード例 #1
0
 def test_resp_noopt_orient(self, dmso_opt, ref):
     charge_options = psiresp.ChargeOptions(equivalent_methyls=True)
     orientation_options = psiresp.OrientationOptions(n_reorientations=2)
     r = self.cls.from_molecules([dmso_opt],
                                 orientation_options=orientation_options)
     charges = r.run(charge_constraint_options=charge_options)
     assert_allclose(charges, ref, rtol=0.05, atol=1e-4)
コード例 #2
0
 def test_resp_opt(self, ref):
     mol = [mol_from_file(self.molfile)]
     orientation_options = psiresp.OrientationOptions(n_reorientations=2)
     charge_options = psiresp.ChargeOptions(equivalent_methyls=True)
     r = self.cls.from_molecules(mol,
                                 optimize_geometry=True,
                                 orientation_options=orientation_options)
     charges = r.run(charge_options=charge_options)
     assert_allclose(charges, ref, rtol=0.05, atol=1e-3)
コード例 #3
0
 def test_resp_noopt(self, ref):
     orientation_options = psiresp.OrientationOptions(n_reorientations=2)
     opt = [mol_from_file('{}_c1_ATB_opt.xyz'.format(self.molname))]
     charge_options = psiresp.ChargeOptions(equivalent_methyls=True)
     r = self.cls.from_molecules(opt,
                                 optimize_geometry=False,
                                 orientation_options=orientation_options)
     charges = r.run(charge_options=charge_options)
     # no idea which point density ATB uses
     assert_allclose(charges, ref, rtol=0.05, atol=1e-3)
コード例 #4
0
 def nme2ala2(self):
     mols = [mol_from_file(f) for f in self.nme2ala2_names]
     orient = [(5, 18, 19), (19, 18, 5), (6, 19, 20), (20, 19, 6)]
     or_options = psiresp.OrientationOptions(reorientations=orient,
                                             keep_original=False)
     chrconstrs = {0: [20, 21, 22, 23, 24, 25], 0.6163: [18], -0.5722: [19]}
     chrequivs = [[10, 14], [11, 12, 13, 15, 16, 17]]
     ch_options = psiresp.ChargeOptions(charge_equivalences=chrequivs,
                                        charge_constraints=chrconstrs,
                                        equivalent_sp3_hydrogens=False)
     resp = psiresp.Resp.from_molecules(
         mols,
         charge=0,
         orientation_options=or_options,
         charge_constraint_options=ch_options,
         optimize_geometry=self.opt,
         name='nme2ala2')
     return resp
コード例 #5
0
 def methylammonium(self):
     mols = [mol_from_file(f) for f in self.methylammonium_names]
     orient = [(1, 5, 7), (7, 5, 1)]
     or_options = psiresp.OrientationOptions(reorientations=orient,
                                             keep_original=False)
     chrconstrs = []
     chrequivs = [[6, 7, 8]]
     ch_options = psiresp.ChargeOptions(charge_equivalences=chrequivs,
                                        charge_constraints=chrconstrs,
                                        equivalent_sp3_hydrogens=False)
     resp = psiresp.Resp.from_molecules(
         mols,
         charge=1,
         multiplicity=1,
         orientation_options=or_options,
         charge_constraint_options=ch_options,
         optimize_geometry=self.opt,
         name='methylammonium')
     return resp
コード例 #6
0
    def test_multi_mol(self, stage_2, a, nme2ala2, methylammonium, redname):
        multifit_charges = charges_from_red_file(f"amm_dimethyl_{redname}.dat")
        xyz = methylammonium.conformers[0].orientations[0].coordinates
        r = psiresp.MultiResp([methylammonium, nme2ala2])
        chrconstrs = {
            0: [(1, 1), (1, 2), (1, 3), (1, 4), (2, 1), (2, 2), (2, 3), (2, 4),
                (2, 5), (2, 6), (2, 7), (2, 8)]
        }
        ch_options = psiresp.ChargeOptions(charge_constraints=[chrconstrs],
                                           equivalent_sp3_hydrogens=False)
        charges = r.run(stage_2=stage_2,
                        hyp_a1=a,
                        charge_constraint_options=ch_options)
        ref_con = multifit_charges[0][[
            0, 1, 2, 3
        ]].sum() + multifit_charges[1][[0, 1, 2, 3, 4, 5, 6, 7]].sum()
        assert_almost_equal(ref_con, 0)
        constraint = charges[0][[0, 1, 2, 3]].sum() + charges[1][[
            0, 1, 2, 3, 4, 5, 6, 7
        ]].sum()
        assert_almost_equal(constraint, 0)

        for charge, ref in zip(charges, multifit_charges):
            assert_allclose(charge, ref, rtol=self.rtol, atol=self.atol)
コード例 #7
0
 def test_resp_noopt_noorient(self, dmso_orients, ref):
     charge_options = psiresp.ChargeOptions(equivalent_methyls=True)
     r = self.cls.from_molecules(dmso_orients, charge=0)
     charges = r.run(charge_constraint_options=charge_options)
     assert_allclose(charges, ref, rtol=0.05, atol=1e-4)