def get_e_torsions(mol): mol.e_torsions = 0.0 for p in range(mol.n_torsions): tor = mol.torsions[p] c1 = mol.atoms[tor.at1].coords c2 = mol.atoms[tor.at2].coords c3 = mol.atoms[tor.at3].coords c4 = mol.atoms[tor.at4].coords tor.t_ijkl = geomcalc.get_t_ijkl(c1, c2, c3, c4) tor.e = get_e_torsion(tor.t_ijkl, tor.v_n, tor.gam, tor.n, tor.paths) mol.e_torsions += tor.e
def get_g_torsions(mol): mol.g_torsions = np.zeros((mol.n_atoms, 3)) for p in range(mol.n_torsions): tor = mol.torsions[p] c1 = mol.atoms[tor.at1].coords c2 = mol.atoms[tor.at2].coords c3 = mol.atoms[tor.at3].coords c4 = mol.atoms[tor.at4].coords tor.t_ijkl = geomcalc.get_t_ijkl(c1, c2, c3, c4) tor.g = get_g_torsion(tor.t_ijkl, tor.v_n, tor.gam, tor.n, tor.paths) dir1, dir2, dir3, dir4 = get_gdir_torsion(c1, c2, c3, c4) mol.g_torsions[tor.at1] += tor.g * dir1 mol.g_torsions[tor.at2] += tor.g * dir2 mol.g_torsions[tor.at3] += tor.g * dir3 mol.g_torsions[tor.at4] += tor.g * dir4
def get_torsions(mol): for j in range(mol.n_atoms): n_jbonds = len(mol.bond_tree[j]) for a in range(n_jbonds): k = mol.bond_tree[j][a] if (k < j): continue n_kbonds = len(mol.bond_tree[k]) for b in range(n_jbonds): i = mol.bond_tree[j][b] if (i == k): continue for c in range(n_kbonds): l = mol.bond_tree[k][c] if (l == j or l == i): continue t_ijkl = geomcalc.get_t_ijkl(mol.atoms[i].coords, mol.atoms[j].coords, mol.atoms[k].coords, mol.atoms[l].coords) v_n, gamma, nfold, paths = param.get_torsion_param(mol.atoms[i].attype, mol.atoms[j].attype, mol.atoms[k].attype, mol.atoms[l].attype) if (v_n > 0.0): mol.torsions.append(molecule.torsion(i, j, k, l, t_ijkl, v_n, gamma, nfold, paths)) mol.n_torsions = len(mol.torsions)