def mol_tester(lbl, molstr, pg, sigma, refgeomang, isbohr=False, iso=False): symmol = qcdb.Molecule(molstr) if iso is not False: if isinstance(iso, int): iso = [iso] for at in iso: # mass needn't make sense for element, just breaking the symmetry symmol.set_mass(at, 2.014) symmol.update_geometry() symmol.axis_representation() assert compare_strings(pg, symmol.get_full_point_group(), pg + " point group: " + lbl) assert compare_integers(sigma, symmol.rotational_symmetry_number(), pg + " sigma") if isbohr: geom_now = symmol.full_geometry() else: geom_now = qcdb.mscale(symmol.full_geometry(), qcel.constants.bohr2angstroms) if refgeomang: assert compare_matrices(refgeomang, geom_now, 6, pg + " orientation")
[ -0.707106781187, -0.000000000000, -0.627971015380]] geom_h2of = \ [[ 0.000000000000, 0.000000000000, -0.079135765807], [ -0.000000000000, 0.707106781187, 0.627971015380], [ 0.000000000000, -0.707106781187, 0.627971015380]] h2oA = qcdb.Molecule(""" O H 1 1.0 H 1 1.0 2 90.0 """) h2oA.update_geometry() #h2oA.print_out() geom_now = qcdb.mscale(h2oA.geometry(), qcdb.psi_bohr2angstroms) qcdb.compare_matrices(geom_h2oa, geom_now, 6, "H2O A geometry and orientation") #TEST h2oB = qcdb.Molecule(""" O 0.000000000000 0.000000000000 -0.079135765807 H 0.000000000000 -0.707106781187 0.627971015380 H 0.000000000000 0.707106781187 0.627971015380 """) h2oB.update_geometry() #h2oB.print_out() geom_now = qcdb.mscale(h2oB.geometry(), qcdb.psi_bohr2angstroms) qcdb.compare_matrices(geom_h2ob, geom_now, 6, "H2O B geometry and orientation") #TEST h2oC = qcdb.Molecule("""
def test_mints4(): #! A demonstration of mixed Cartesian/ZMatrix geometry specification, using variables, for #! the benzene-hydronium complex. Atoms can be placed using ZMatrix coordinates, whether they belong #! to the same fragment or not. Note that the Cartesian specification must come before the ZMatrix entries #! because the former define absolute positions, while the latter are relative. refENuc = 268.617178206572646 refGEOM = \ [[ 0.710500000000, -0.794637665924, -1.230622098778], [ 1.421000000000, -0.794637665924, 0.000000000000], [ 0.710500000000, -0.794637665924, 1.230622098778], [ -0.710500000000, -0.794637665924, 1.230622098778], [ 1.254500000000, -0.794637665924, -2.172857738095], [ -1.254500000000, -0.794637665924, 2.172857738095], [ -0.710500000000, -0.794637665924, -1.230622098778], [ -1.421000000000, -0.794637665924, 0.000000000000], [ 2.509000000000, -0.794637665924, 0.000000000000], [ 1.254500000000, -0.794637665924, 2.172857738095], [ -1.254500000000, -0.794637665924, -2.172857738095], [ -2.509000000000, -0.794637665924, 0.000000000000], [ 0.000000000000, 3.205362334076, 0.000000000000], [ 0.494974746831, 3.555362334076, -0.857321409974], [ 0.494974746831, 3.555362334076, 0.857321409974], [ -0.989949493661, 3.555362334076, 0.000000000000]] dimer = qcdb.Molecule(""" 1 1 # This part is just a normal Cartesian geometry specification for benzene C 0.710500000000 -0.794637665924 -1.230622098778 C 1.421000000000 -0.794637665924 0.000000000000 C 0.710500000000 -0.794637665924 1.230622098778 C -0.710500000000 -0.794637665924 1.230622098778 H 1.254500000000 -0.794637665924 -2.172857738095 H -1.254500000000 -0.794637665924 2.172857738095 C -0.710500000000 -0.794637665924 -1.230622098778 C -1.421000000000 -0.794637665924 0.000000000000 H 2.509000000000 -0.794637665924 0.000000000000 H 1.254500000000 -0.794637665924 2.172857738095 H -1.254500000000 -0.794637665924 -2.172857738095 H -2.509000000000 -0.794637665924 0.000000000000 # And the hydronium part is specified using a zmatrix, referencing the benzene coordinates X 1 CC 3 30 2 A2 O 13 R 1 90 2 90 H 14 OH 13 TDA 1 0 H 14 OH 15 TDA 13 A1 H 14 OH 15 TDA 13 -A1 CC = 1.421 CH = 1.088 A1 = 120.0 A2 = 180.0 OH = 1.05 R = 4.0 units angstrom """) dimer.update_geometry() assert compare_values(refENuc, dimer.nuclear_repulsion_energy(), 9, "Bz-H3O+: nuclear repulsion energy") geom_now = qcdb.mscale(dimer.geometry(), qcdb.psi_bohr2angstroms) assert compare_matrices(refGEOM, geom_now, 6, "Bz-H3O+: geometry and orientation")
def test_mints4(): #! A demonstration of mixed Cartesian/ZMatrix geometry specification, using variables, for #! the benzene-hydronium complex. Atoms can be placed using ZMatrix coordinates, whether they belong #! to the same fragment or not. Note that the Cartesian specification must come before the ZMatrix entries #! because the former define absolute positions, while the latter are relative. refENuc = 268.6171792624 refGEOM = \ [[ 0.710500000000, -0.794637665924, -1.230622098778], [ 1.421000000000, -0.794637665924, 0.000000000000], [ 0.710500000000, -0.794637665924, 1.230622098778], [ -0.710500000000, -0.794637665924, 1.230622098778], [ 1.254500000000, -0.794637665924, -2.172857738095], [ -1.254500000000, -0.794637665924, 2.172857738095], [ -0.710500000000, -0.794637665924, -1.230622098778], [ -1.421000000000, -0.794637665924, 0.000000000000], [ 2.509000000000, -0.794637665924, 0.000000000000], [ 1.254500000000, -0.794637665924, 2.172857738095], [ -1.254500000000, -0.794637665924, -2.172857738095], [ -2.509000000000, -0.794637665924, 0.000000000000], [ 0.000000000000, 3.205362334076, 0.000000000000], [ 0.494974746831, 3.555362334076, -0.857321409974], [ 0.494974746831, 3.555362334076, 0.857321409974], [ -0.989949493661, 3.555362334076, 0.000000000000]] dimer = qcdb.Molecule(""" 1 1 # This part is just a normal Cartesian geometry specification for benzene C 0.710500000000 -0.794637665924 -1.230622098778 C 1.421000000000 -0.794637665924 0.000000000000 C 0.710500000000 -0.794637665924 1.230622098778 C -0.710500000000 -0.794637665924 1.230622098778 H 1.254500000000 -0.794637665924 -2.172857738095 H -1.254500000000 -0.794637665924 2.172857738095 C -0.710500000000 -0.794637665924 -1.230622098778 C -1.421000000000 -0.794637665924 0.000000000000 H 2.509000000000 -0.794637665924 0.000000000000 H 1.254500000000 -0.794637665924 2.172857738095 H -1.254500000000 -0.794637665924 -2.172857738095 H -2.509000000000 -0.794637665924 0.000000000000 # And the hydronium part is specified using a zmatrix, referencing the benzene coordinates X 1 CC 3 30 2 A2 O 13 R 1 90 2 90 H 14 OH 13 TDA 1 0 H 14 OH 15 TDA 13 A1 H 14 OH 15 TDA 13 -A1 CC = 1.421 CH = 1.088 A1 = 120.0 A2 = 180.0 OH = 1.05 R = 4.0 units angstrom """) dimer.update_geometry() assert compare_values(refENuc, dimer.nuclear_repulsion_energy(), 9, "Bz-H3O+: nuclear repulsion energy") geom_now = qcdb.mscale(dimer.geometry(), qcdb.psi_bohr2angstroms) assert compare_matrices(refGEOM, geom_now, 6, "Bz-H3O+: geometry and orientation")