def __init__(self, geometry, formingBonds, breakingBonds): self.geometry = numpy.array(quantity.convertLength(geometry, "bohr")).T self.formingBonds = numpy.array(formingBonds, numpy.int) self.breakingBonds = numpy.array(breakingBonds, numpy.int) Nforming_bonds = self.formingBonds.shape[0] Nbreaking_bonds = self.breakingBonds.shape[0] self.formingBondLengths = numpy.empty(Nforming_bonds) self.breakingBondLengths = numpy.empty(Nbreaking_bonds) for m in range(Nforming_bonds): atom1 = self.formingBonds[m,0] - 1 atom2 = self.formingBonds[m,1] - 1 Rx = self.geometry[0,atom1] - self.geometry[0,atom2] Ry = self.geometry[1,atom1] - self.geometry[1,atom2] Rz = self.geometry[2,atom1] - self.geometry[2,atom2] R = math.sqrt(Rx * Rx + Ry * Ry + Rz * Rz) self.formingBondLengths[m] = R for m in range(Nbreaking_bonds): atom1 = self.breakingBonds[m,0] - 1 atom2 = self.breakingBonds[m,1] - 1 Rx = self.geometry[0,atom1] - self.geometry[0,atom2] Ry = self.geometry[1,atom1] - self.geometry[1,atom2] Rz = self.geometry[2,atom1] - self.geometry[2,atom2] R = math.sqrt(Rx * Rx + Ry * Ry + Rz * Rz) self.breakingBondLengths[m] = R
def __init__(self, geometry, formingBonds, breakingBonds): self.geometry = numpy.array(quantity.convertLength(geometry, "bohr")).T self.formingBonds = numpy.array(formingBonds, numpy.int) self.breakingBonds = numpy.array(breakingBonds, numpy.int) Nforming_bonds = self.formingBonds.shape[0] Nbreaking_bonds = self.breakingBonds.shape[0] self.formingBondLengths = numpy.empty(Nforming_bonds) self.breakingBondLengths = numpy.empty(Nbreaking_bonds) for m in range(Nforming_bonds): atom1 = self.formingBonds[m, 0] - 1 atom2 = self.formingBonds[m, 1] - 1 Rx = self.geometry[0, atom1] - self.geometry[0, atom2] Ry = self.geometry[1, atom1] - self.geometry[1, atom2] Rz = self.geometry[2, atom1] - self.geometry[2, atom2] R = math.sqrt(Rx * Rx + Ry * Ry + Rz * Rz) self.formingBondLengths[m] = R for m in range(Nbreaking_bonds): atom1 = self.breakingBonds[m, 0] - 1 atom2 = self.breakingBonds[m, 1] - 1 Rx = self.geometry[0, atom1] - self.geometry[0, atom2] Ry = self.geometry[1, atom1] - self.geometry[1, atom2] Rz = self.geometry[2, atom1] - self.geometry[2, atom2] R = math.sqrt(Rx * Rx + Ry * Ry + Rz * Rz) self.breakingBondLengths[m] = R
def __init__(self, atoms, reactant1Atoms, reactant2Atoms, Rinf): self.atoms = atoms self.mass = numpy.array([atomicMass[atom] for atom in atoms]) * 0.001 / constants.Na / 9.1093826e-31 self.reactant1Atoms = numpy.array(reactant1Atoms, numpy.int) self.reactant2Atoms = numpy.array(reactant2Atoms, numpy.int) self.Rinf = float(quantity.convertLength(Rinf, "bohr")) self.totalMass1 = sum([self.mass[j-1] for j in self.reactant1Atoms]) self.totalMass2 = sum([self.mass[j-1] for j in self.reactant2Atoms]) self.massFractions = numpy.empty_like(self.mass) for j in self.reactant1Atoms: self.massFractions[j-1] = self.mass[j-1] / self.totalMass1 for j in self.reactant2Atoms: self.massFractions[j-1] = self.mass[j-1] / self.totalMass2
def __init__(self, atoms, reactant1Atoms, reactant2Atoms, Rinf): self.atoms = atoms self.mass = numpy.array([atomicMass[atom] for atom in atoms ]) * 0.001 / constants.Na / 9.1093826e-31 self.reactant1Atoms = numpy.array(reactant1Atoms, numpy.int) self.reactant2Atoms = numpy.array(reactant2Atoms, numpy.int) self.Rinf = float(quantity.convertLength(Rinf, "bohr")) self.totalMass1 = sum([self.mass[j - 1] for j in self.reactant1Atoms]) self.totalMass2 = sum([self.mass[j - 1] for j in self.reactant2Atoms]) self.massFractions = numpy.empty_like(self.mass) for j in self.reactant1Atoms: self.massFractions[j - 1] = self.mass[j - 1] / self.totalMass1 for j in self.reactant2Atoms: self.massFractions[j - 1] = self.mass[j - 1] / self.totalMass2