use of org.openscience.cdk.interfaces.IReactionSet in project cdk by cdk.
the class IDCreator method createIDsForChemModel.
private static void createIDsForChemModel(IChemModel model, List<String> tabuList) {
if (tabuList == null)
tabuList = ChemModelManipulator.getAllIDs(model);
if (null == model.getID()) {
chemModelCount = setID(CHEMMODEL_PREFIX, chemModelCount, model, tabuList);
}
ICrystal crystal = model.getCrystal();
if (crystal != null) {
if (policy == OBJECT_UNIQUE_POLICY) {
atomCount = 0;
bondCount = 0;
}
createIDsForAtomContainer(crystal, tabuList);
}
IAtomContainerSet moleculeSet = model.getMoleculeSet();
if (moleculeSet != null) {
if (policy == OBJECT_UNIQUE_POLICY) {
atomContainerSetCount = 0;
atomContainerCount = 0;
}
createIDsForAtomContainerSet(moleculeSet, tabuList);
}
IReactionSet reactionSet = model.getReactionSet();
if (reactionSet != null) {
if (policy == OBJECT_UNIQUE_POLICY) {
reactionSetCount = 0;
reactionCount = 0;
}
createIDsForReactionSet(reactionSet, tabuList);
}
}
use of org.openscience.cdk.interfaces.IReactionSet in project cdk by cdk.
the class ReactionSetTest method testReactionSet.
@Test
public void testReactionSet() {
IReactionSet reactionSet = new ReactionSet();
Assert.assertNotNull(reactionSet);
}
use of org.openscience.cdk.interfaces.IReactionSet in project cdk by cdk.
the class ChemModelTest method testChemModel.
@Test
public void testChemModel() {
IChemModel chemModel = new ChemModel();
Assert.assertNotNull(chemModel);
Assert.assertTrue(chemModel.isEmpty());
IAtom atom = new Atom("N");
IAtomContainer mol = new AtomContainer();
IAtomContainerSet mset = new AtomContainerSet();
mol.addAtom(atom);
mset.addAtomContainer(mol);
chemModel.setMoleculeSet(mset);
Assert.assertFalse(chemModel.isEmpty());
mol.removeAtomOnly(atom);
Assert.assertFalse(chemModel.isEmpty());
chemModel.setMoleculeSet(null);
Assert.assertTrue(chemModel.isEmpty());
IChemModel model1 = new ChemModel();
mol.addAtom(atom);
IReaction react = new Reaction();
react.addReactant(mol);
IReactionSet rset = new ReactionSet();
rset.addReaction(react);
model1.setReactionSet(rset);
Assert.assertFalse(model1.isEmpty());
mol.removeAtomOnly(atom);
Assert.assertFalse(model1.isEmpty());
model1.setReactionSet(null);
Assert.assertTrue(model1.isEmpty());
IChemModel model2 = new ChemModel();
mol.addAtom(atom);
IRingSet ringset = new RingSet();
ringset.add(mset);
model2.setRingSet(ringset);
Assert.assertFalse(model2.isEmpty());
mol.removeAtomOnly(atom);
Assert.assertFalse(model2.isEmpty());
model2.setRingSet(null);
Assert.assertTrue(model2.isEmpty());
IChemModel model3 = new ChemModel();
mol.addAtom(atom);
ICrystal cry = new Crystal(mol);
model3.setCrystal(cry);
Assert.assertFalse(model3.isEmpty());
mol.removeAtomOnly(atom);
Assert.assertFalse(model3.isEmpty());
model3.setCrystal(null);
Assert.assertTrue(model3.isEmpty());
}
use of org.openscience.cdk.interfaces.IReactionSet in project cdk by cdk.
the class RadicalSiteRrBetaReactionTest method testInitiate_IAtomContainerSet_IAtomContainerSet.
/**
* A unit test suite for JUnit. Reaction:
* Manually put of the center active.
*/
@Test
@Override
public void testInitiate_IAtomContainerSet_IAtomContainerSet() throws Exception {
IReactionProcess type = new RadicalSiteRrBetaReaction();
IAtomContainerSet setOfReactants = getExampleReactants();
IAtomContainer molecule = setOfReactants.getAtomContainer(0);
/* initiate */
molecule.getAtom(0).setFlag(CDKConstants.REACTIVE_CENTER, true);
molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true);
molecule.getAtom(4).setFlag(CDKConstants.REACTIVE_CENTER, true);
molecule.getBond(0).setFlag(CDKConstants.REACTIVE_CENTER, true);
List<IParameterReact> paramList = new ArrayList<>();
IParameterReact param = new SetReactionCenter();
param.setParameter(Boolean.TRUE);
paramList.add(param);
type.setParameterList(paramList);
IReactionSet setOfReactions = type.initiate(setOfReactants, null);
Assert.assertEquals(1, setOfReactions.getReactionCount());
Assert.assertEquals(1, setOfReactions.getReaction(0).getProductCount());
IAtomContainer product = setOfReactions.getReaction(0).getProducts().getAtomContainer(0);
IAtomContainer molecule2 = getExpectedProducts().getAtomContainer(0);
assertEquals(molecule2, product);
}
use of org.openscience.cdk.interfaces.IReactionSet in project cdk by cdk.
the class RadicalSiteRrDeltaReactionTest method testCDKConstants_REACTIVE_CENTER.
/**
* A unit test suite for JUnit.
*/
@Test
public void testCDKConstants_REACTIVE_CENTER() throws Exception {
IReactionProcess type = new RadicalSiteRrDeltaReaction();
IAtomContainerSet setOfReactants = getExampleReactants();
IAtomContainer molecule = setOfReactants.getAtomContainer(0);
/* manually put the reactive center */
molecule.getAtom(0).setFlag(CDKConstants.REACTIVE_CENTER, true);
molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true);
molecule.getAtom(6).setFlag(CDKConstants.REACTIVE_CENTER, true);
molecule.getBond(0).setFlag(CDKConstants.REACTIVE_CENTER, true);
List<IParameterReact> paramList = new ArrayList<>();
IParameterReact param = new SetReactionCenter();
param.setParameter(Boolean.TRUE);
paramList.add(param);
type.setParameterList(paramList);
/* initiate */
IReactionSet setOfReactions = type.initiate(setOfReactants, null);
Assert.assertEquals(1, setOfReactions.getReactionCount());
IAtomContainer reactant = setOfReactions.getReaction(0).getReactants().getAtomContainer(0);
Assert.assertTrue(molecule.getAtom(0).getFlag(CDKConstants.REACTIVE_CENTER));
Assert.assertTrue(reactant.getAtom(0).getFlag(CDKConstants.REACTIVE_CENTER));
Assert.assertTrue(molecule.getAtom(1).getFlag(CDKConstants.REACTIVE_CENTER));
Assert.assertTrue(reactant.getAtom(1).getFlag(CDKConstants.REACTIVE_CENTER));
Assert.assertTrue(molecule.getAtom(6).getFlag(CDKConstants.REACTIVE_CENTER));
Assert.assertTrue(reactant.getAtom(6).getFlag(CDKConstants.REACTIVE_CENTER));
Assert.assertTrue(molecule.getBond(0).getFlag(CDKConstants.REACTIVE_CENTER));
Assert.assertTrue(reactant.getBond(0).getFlag(CDKConstants.REACTIVE_CENTER));
}
Aggregations