def get_gdir_angle(coords1, coords2, coords3): r_ji = geomcalc.get_r_ij(coords2, coords1) r_jk = geomcalc.get_r_ij(coords2, coords3) u_ji = geomcalc.get_u_ij(coords2, coords1) u_jk = geomcalc.get_u_ij(coords2, coords3) cp = geomcalc.get_ucp(u_ji, u_jk) gdir1 = geomcalc.get_ucp(u_ji, cp) / r_ji gdir3 = geomcalc.get_ucp(cp, u_jk) / r_jk gdir2 = -1.0 * (gdir1 + gdir3) return gdir1, gdir2, gdir3
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_bonds(mol): mol.e_bonds = 0.0 for p in range(mol.n_bonds): bond = mol.bonds[p] c1 = mol.atoms[bond.at1].coords c2 = mol.atoms[bond.at2].coords bond.r_ij = geomcalc.get_r_ij(c1, c2) bond.e = get_e_bond(bond.r_ij, bond.r_eq, bond.k_b) mol.e_bonds += bond.e
def get_bonds(mol): for i in range(mol.n_atoms): for a in range(len(mol.bond_tree[i])): j = mol.bond_tree[i][a] if (i < j): r_ij = geomcalc.get_r_ij(mol.atoms[i].coords, mol.atoms[j].coords) k_b, r_eq = param.get_bond_param(mol.atoms[i].attype, mol.atoms[j].attype) if (k_b > 0.0): mol.bonds.append(molecule.bond(i, j, r_ij, r_eq, k_b)) mol.n_bonds = len(mol.bonds)
def get_g_bonds(mol): mol.g_bonds = np.zeros((mol.n_atoms, 3)) for p in range(mol.n_bonds): bond = mol.bonds[p] c1 = mol.atoms[bond.at1].coords c2 = mol.atoms[bond.at2].coords bond.r_ij = geomcalc.get_r_ij(c1, c2) bond.g = get_g_bond(bond.r_ij, bond.r_eq, bond.k_b) dir1, dir2 = get_gdir_inter(c1, c2) mol.g_bonds[bond.at1] += bond.g * dir1 mol.g_bonds[bond.at2] += bond.g * dir2
def get_e_nonbonded(mol): mol.e_nonbonded, mol.e_vdw, mol.e_elst = 0.0, 0.0, 0.0 # van der waals and electrostatic energy for i in range(mol.n_atoms): atom1 = mol.atoms[i] for j in range(i+1, mol.n_atoms): atom2 = mol.atoms[j] if (j in mol.nonints[i]): continue r_ij = geomcalc.get_r_ij(atom1.coords, atom2.coords) eps_ij = atom1.sreps * atom2.sreps ro_ij = atom1.ro + atom2.ro mol.e_elst += get_e_elst_ij(r_ij, atom1.charge, atom2.charge, mol.dielectric) mol.e_vdw += get_e_vdw_ij(r_ij, eps_ij, ro_ij)
def get_e_nonbonded(mol): mol.e_nonbonded, mol.e_vdw, mol.e_elst = 0.0, 0.0, 0.0 # van der waals and electrostatic energy for i in range(mol.n_atoms): atom1 = mol.atoms[i] for j in range(i + 1, mol.n_atoms): atom2 = mol.atoms[j] if (j in mol.nonints[i]): continue r_ij = geomcalc.get_r_ij(atom1.coords, atom2.coords) eps_ij = atom1.sreps * atom2.sreps ro_ij = atom1.ro + atom2.ro mol.e_elst += get_e_elst_ij(r_ij, atom1.charge, atom2.charge, mol.dielectric) mol.e_vdw += get_e_vdw_ij(r_ij, eps_ij, ro_ij)
def get_g_nonbonded(mol): mol.g_nonbonded = np.zeros((mol.n_atoms, 3)) mol.g_vdw = np.zeros((mol.n_atoms, 3)) mol.g_elst = np.zeros((mol.n_atoms, 3)) # van der waals and electrostatic energy for i in range(mol.n_atoms): atom1 = mol.atoms[i] for j in range(i+1, mol.n_atoms): if (j in mol.nonints[i]): continue atom2 = mol.atoms[j] dir1, dir2 = get_gdir_inter(atom1.coords, atom2.coords) r_ij = geomcalc.get_r_ij(atom1.coords, atom2.coords) eps_ij = atom1.sreps * atom2.sreps ro_ij = atom1.ro + atom2.ro g_elst = get_g_elst_ij(r_ij, atom1.charge, atom2.charge, mol.dielectric) g_vdw = get_g_vdw_ij(r_ij, eps_ij, ro_ij) mol.g_vdw[i] += g_vdw * dir1 mol.g_vdw[j] += g_vdw * dir2 mol.g_elst[i] += g_elst * dir1 mol.g_elst[j] += g_elst * dir2
def get_g_nonbonded(mol): mol.g_nonbonded = np.zeros((mol.n_atoms, 3)) mol.g_vdw = np.zeros((mol.n_atoms, 3)) mol.g_elst = np.zeros((mol.n_atoms, 3)) # van der waals and electrostatic energy for i in range(mol.n_atoms): atom1 = mol.atoms[i] for j in range(i + 1, mol.n_atoms): if (j in mol.nonints[i]): continue atom2 = mol.atoms[j] dir1, dir2 = get_gdir_inter(atom1.coords, atom2.coords) r_ij = geomcalc.get_r_ij(atom1.coords, atom2.coords) eps_ij = atom1.sreps * atom2.sreps ro_ij = atom1.ro + atom2.ro g_elst = get_g_elst_ij(r_ij, atom1.charge, atom2.charge, mol.dielectric) g_vdw = get_g_vdw_ij(r_ij, eps_ij, ro_ij) mol.g_vdw[i] += g_vdw * dir1 mol.g_vdw[j] += g_vdw * dir2 mol.g_elst[i] += g_elst * dir1 mol.g_elst[j] += g_elst * dir2