/// <summary> /// Ensures that the molecule is using the <paramref name="moleculeFormulaToUse" /> for its start value, /// either directly or via the StartValue parameter. /// </summary> /// <remarks> /// The <paramref name="moleculeFormulaToUse" /> can be changed since this is suppose to be a clone of the /// original molecule start value /// </remarks> private void updateMoleculeAmountFormula(IMoleculeAmount molecule, IFormula moleculeFormulaToUse) { if (moleculeFormulaToUse.IsAmountBased()) { molecule.Formula = moleculeFormulaToUse; return; } //molecule is concentration based var startValue = molecule.EntityAt <IParameter>(Constants.Parameters.START_VALUE); startValue.Formula = moleculeFormulaToUse; startValue.Dimension = startValue.Formula.Dimension; _concentrationBasedFormulaUpdater.UpdateRelativePathForStartValueMolecule(molecule, moleculeFormulaToUse); molecule.Formula = _formulaFactory.CreateMoleculeAmountReferenceToStartValue(startValue); }