def get_gdir_torsion(coords1, coords2, coords3, coords4): r_kl = geomcalc.get_r_ij(coords3, coords4) r_ij = geomcalc.get_r_ij(coords1, coords2) u_ji = geomcalc.get_u_ij(coords2, coords1) u_jk = geomcalc.get_u_ij(coords2, coords3) u_kj = geomcalc.get_u_ij(coords3, coords2) u_kl = geomcalc.get_u_ij(coords3, coords4) a_ijk = geomcalc.get_a_ijk(coords1, coords2, coords3) a_lkj = geomcalc.get_a_ijk(coords4, coords3, coords2) gdir1 = geomcalc.get_ucp(u_ji, u_jk) gdir4 = geomcalc.get_ucp(u_kl, u_kj) gdir1 /= r_ij * math.sin(geomcalc.deg2rad() * a_ijk) gdir4 /= r_kl * math.sin(geomcalc.deg2rad() * a_lkj) gdir2 = -0.5 * (gdir1 + gdir4) gdir3 = 1.0 * gdir2 return gdir1, gdir2, gdir3, gdir4
def get_e_angles(mol): mol.e_angles = 0.0 for p in range(mol.n_angles): ang = mol.angles[p] c1 = mol.atoms[ang.at1].coords c2 = mol.atoms[ang.at2].coords c3 = mol.atoms[ang.at3].coords ang.a_ijk = geomcalc.get_a_ijk(c1, c2, c3) ang.e = get_e_angle(ang.a_ijk, ang.a_eq, ang.k_a) mol.e_angles += ang.e
def get_angles(mol): for j in range(mol.n_atoms): n_jbonds = len(mol.bond_tree[j]) for a in range(n_jbonds): i = mol.bond_tree[j][a] for b in range(a+1, n_jbonds): k = mol.bond_tree[j][b] a_ijk = geomcalc.get_a_ijk(mol.atoms[i].coords, mol.atoms[j].coords, mol.atoms[k].coords) k_a, a_eq = param.get_angle_param(mol.atoms[i].attype, mol.atoms[j].attype, mol.atoms[k].attype) if (k_a > 0.0): mol.angles.append(molecule.angle(i, j, k, a_ijk, a_eq, k_a)) mol.n_angles = len(mol.angles)
def get_g_angles(mol): mol.g_angles = np.zeros((mol.n_atoms, 3)) for p in range(mol.n_angles): ang = mol.angles[p] c1 = mol.atoms[ang.at1].coords c2 = mol.atoms[ang.at2].coords c3 = mol.atoms[ang.at3].coords ang.a_ijk = geomcalc.get_a_ijk(c1, c2, c3) ang.g = get_g_angle(ang.a_ijk, ang.a_eq, ang.k_a) dir1, dir2, dir3 = get_gdir_angle(c1, c2, c3) mol.g_angles[ang.at1] += ang.g * dir1 mol.g_angles[ang.at2] += ang.g * dir2 mol.g_angles[ang.at3] += ang.g * dir3