private float calculateABonds() {

		int n = model.aBonds.size();
		if (n <= 0)
			return 0;
		ABond aBond;
		float energy = 0;

		synchronized (model.aBonds) {

			for (int i = 0; i < n; i++) {

				aBond = model.aBonds.get(i);
				atom1 = aBond.getAtom1();
				atom2 = aBond.getAtom2();
				atom3 = aBond.getAtom3();
				if (!atom1.isMovable() && !atom2.isMovable() && !atom3.isMovable())
					continue;
				angle = aBond.getAngle();
				strength = aBond.getStrength();
				rxij = atom1.rx - atom2.rx;
				ryij = atom1.ry - atom2.ry;
				rzij = atom1.rz - atom2.rz;
				vector1.set(rxij, ryij, rzij);
				rxkj = atom3.rx - atom2.rx;
				rykj = atom3.ry - atom2.ry;
				rzkj = atom3.rz - atom2.rz;
				vector2.set(rxkj, rykj, rzkj);
				rijsq = rxij * rxij + ryij * ryij + rzij * rzij;
				rkjsq = rxkj * rxkj + rykj * rykj + rzkj * rzkj;
				rij = (float) Math.sqrt(rijsq);
				rkj = (float) Math.sqrt(rkjsq);
				sr2 = rxij * rxkj + ryij * rykj + rzij * rzkj;
				theta = vector1.angle(vector2);
				sintheta = (float) Math.sin(theta);
				if (Math.abs(sintheta) < MIN_SINTHETA) {// zero or 180 degree disaster
					sintheta = sintheta > 0 ? MIN_SINTHETA : -MIN_SINTHETA;
				}
				sr12 = theta - angle;
				sr6 = strength * sr12 / (sintheta * rij * rkj);

				rijsq = 1.0f / rijsq;
				rkjsq = 1.0f / rkjsq;
				fxi = sr6 * (rxkj - sr2 * rxij * rijsq);
				fyi = sr6 * (rykj - sr2 * ryij * rijsq);
				fzi = sr6 * (rzkj - sr2 * rzij * rijsq);
				fxk = sr6 * (rxij - sr2 * rxkj * rkjsq);
				fyk = sr6 * (ryij - sr2 * rykj * rkjsq);
				fzk = sr6 * (rzij - sr2 * rzkj * rkjsq);

				inverseMass1 = GF_CONVERSION_CONSTANT / atom1.mass;
				inverseMass2 = GF_CONVERSION_CONSTANT / atom2.mass;
				inverseMass3 = GF_CONVERSION_CONSTANT / atom3.mass;
				atom1.fx += fxi * inverseMass1;
				atom1.fy += fyi * inverseMass1;
				atom1.fz += fzi * inverseMass1;
				atom3.fx += fxk * inverseMass3;
				atom3.fy += fyk * inverseMass3;
				atom3.fz += fzk * inverseMass3;
				atom2.fx -= (fxi + fxk) * inverseMass2;
				atom2.fy -= (fyi + fyk) * inverseMass2;
				atom2.fz -= (fzi + fzk) * inverseMass2;

				energy += strength * sr12 * sr12;

			}

		}

		return energy * 0.5f;

	}