Search in sources :

Example 6 with ParticleMolecularTypePattern

use of cbit.vcell.math.ParticleMolecularTypePattern in project vcell by virtualcell.

the class XmlReader method getParticleMolecularTypePattern.

private ParticleMolecularTypePattern getParticleMolecularTypePattern(Element param, MathDescription mathDescription) throws XmlParseException {
    String molecularTypeName = unMangle(param.getAttributeValue(XMLTags.NameAttrTag));
    String matchLabel = unMangle(param.getAttributeValue(XMLTags.ParticleMolecularTypePatternMatchLabelAttrTag));
    ParticleMolecularType particleMolecularType = mathDescription.getParticleMolecularType(molecularTypeName);
    if (particleMolecularType != null) {
        ParticleMolecularTypePattern var = new ParticleMolecularTypePattern(particleMolecularType);
        if (matchLabel != null) {
            var.setMatchLabel(matchLabel);
        }
        List<Element> componentPatternList = param.getChildren(XMLTags.ParticleMolecularComponentPatternTag, vcNamespace);
        for (Element componentPattern : componentPatternList) {
            ParticleMolecularComponentPattern p = getParticleMolecularComponentPattern(componentPattern, particleMolecularType);
            var.addMolecularComponentPattern(p);
        }
        return var;
    } else {
        throw new XmlParseException("failed to find ParticleMolecularType named " + molecularTypeName);
    }
}
Also used : ParticleMolecularComponentPattern(cbit.vcell.math.ParticleMolecularComponentPattern) Element(org.jdom.Element) ParticleMolecularType(cbit.vcell.math.ParticleMolecularType) ParticleMolecularTypePattern(cbit.vcell.math.ParticleMolecularTypePattern)

Example 7 with ParticleMolecularTypePattern

use of cbit.vcell.math.ParticleMolecularTypePattern in project vcell by virtualcell.

the class NFsimXMLWriter method getObservableParticipantPattern.

private static Element getObservableParticipantPattern(String prefix0, String prefix1, VolumeParticleSpeciesPattern reactantSpeciesPattern, String patternElementName, ParticleObservable.Sequence sequence, Integer quantity) throws SolverException {
    Element reactionParticipantPatternElement = new Element(patternElementName);
    String patternID = prefix0 + "_" + prefix1;
    reactionParticipantPatternElement.setAttribute("id", patternID);
    // reactionParticipantPatternElement.setAttribute("name", reactantSpeciesPattern.getName());
    if (sequence != ParticleObservable.Sequence.Multimolecular) {
        String relation = sequence == ParticleObservable.Sequence.PolymerLengthEqual ? "==" : ">";
        reactionParticipantPatternElement.setAttribute("relation", relation);
        reactionParticipantPatternElement.setAttribute("quantity", quantity + "");
    }
    Element listOfMoleculesElement = new Element("ListOfMolecules");
    HashMap<Bond, BondSites> bondSiteMapping = new HashMap<Bond, BondSites>();
    for (int moleculeIndex = 0; moleculeIndex < reactantSpeciesPattern.getParticleMolecularTypePatterns().size(); moleculeIndex++) {
        ParticleMolecularTypePattern molecularTypePattern = reactantSpeciesPattern.getParticleMolecularTypePatterns().get(moleculeIndex);
        Element moleculeElement = new Element("Molecule");
        String moleculeID = patternID + "_M" + (moleculeIndex + 1);
        moleculeElement.setAttribute("id", moleculeID);
        moleculeElement.setAttribute("name", molecularTypePattern.getMolecularType().getName());
        Element listOfComponentsElement = getListOfComponents(moleculeID, reactantSpeciesPattern, molecularTypePattern, bondSiteMapping);
        if (listOfComponentsElement != null) {
            moleculeElement.addContent(listOfComponentsElement);
        }
        listOfMoleculesElement.addContent(moleculeElement);
    }
    reactionParticipantPatternElement.addContent(listOfMoleculesElement);
    if (bondSiteMapping.size() > 0) {
        Element listOfBondsElement = getListOfBonds(bondSiteMapping);
        reactionParticipantPatternElement.addContent(listOfBondsElement);
    }
    return reactionParticipantPatternElement;
}
Also used : HashMap(java.util.HashMap) Element(org.jdom.Element) ParticleMolecularTypePattern(cbit.vcell.math.ParticleMolecularTypePattern)

Aggregations

ParticleMolecularTypePattern (cbit.vcell.math.ParticleMolecularTypePattern)7 Element (org.jdom.Element)6 VolumeParticleSpeciesPattern (cbit.vcell.math.VolumeParticleSpeciesPattern)4 ParticleMolecularComponentPattern (cbit.vcell.math.ParticleMolecularComponentPattern)3 ParticleMolecularType (cbit.vcell.math.ParticleMolecularType)3 CompartmentSubDomain (cbit.vcell.math.CompartmentSubDomain)2 ParticleComponentStateDefinition (cbit.vcell.math.ParticleComponentStateDefinition)2 ParticleComponentStatePattern (cbit.vcell.math.ParticleComponentStatePattern)2 ParticleMolecularComponent (cbit.vcell.math.ParticleMolecularComponent)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Action (cbit.vcell.math.Action)1 FilamentSubDomain (cbit.vcell.math.FilamentSubDomain)1 JumpProcessRateDefinition (cbit.vcell.math.JumpProcessRateDefinition)1 MacroscopicRateConstant (cbit.vcell.math.MacroscopicRateConstant)1 MathDescription (cbit.vcell.math.MathDescription)1 MathException (cbit.vcell.math.MathException)1 MathRuleFactory (cbit.vcell.math.MathRuleFactory)1 MathRuleEntry (cbit.vcell.math.MathRuleFactory.MathRuleEntry)1 MembraneParticleVariable (cbit.vcell.math.MembraneParticleVariable)1