create MEFlow in Java

User 870ab5b546

24-10-2006 18:00:51

Hi,





I see that I can create an MEFlow object with the constructor MEFlow(MPoint p1, MPoint p2, int ne). But MEFlow arrows point from an electron source to an electron sink. Sources are MolAtoms or MolBonds, and sinks are MolAtoms, MolBonds, or MolAtom[2]s. Neither are MPoints. Furthermore, there is no method setSource() or setSink() in the API. How do I create an MEFlow that points, say, from a MolBond to a MolAtom[2]?





-- Bob

User 870ab5b546

26-10-2006 11:03:12

Hi guys,





I'm anxious to hear your answer to this question. My program is generating buggy output, and I can't fix it until I can set MEFlow sources and sinks in Java.





-- Bob

ChemAxon 7c2d26e5cf

26-10-2006 14:00:56

We are already checking the issue.

User 870ab5b546

17-11-2006 19:05:37

Hi Tamas,





Will the JChem API soon contain MEFlow.setSource() and MEFlow.setSink() methods?





-- Bob

User f359e526a1

24-11-2006 21:33:12

Sorry being late with the answer, but we are discussing whether is it really needed to add it to the API. Is not there an other possible easy way to change the endpoints for you (since it was designed not to set/get endpoints)?

User 870ab5b546

24-11-2006 22:17:46

Well, that depends on how getMolObject(int i) works. Suppose I have atom A with coordinates (x1, y1, z1) and atom B with coordinates (x2, y2, z2), and I set the second endpoint of an MEFlow object called flow to ((x1 + x2)/2, (y1 + y2)/2, (z1 + z2)/2). Will flow.getMolObject(E_SINK) give me a MolBond corresponding to A-B (if A and B are connected) or a MolAtom[2] whose members are A and B (if A and B are not connected)? If the answer is no, it won't, then yes, we need setSource() and setSink() methods.





And even if the answer is yes, how am I supposed to tell that the point ((x1 + x2)/2, (y1 + y2)/2, (z1 + z2)/2) will not be interpreted ambiguously as, e.g., either the MolBond A-B or the MolAtom[2] {C, D}?





Clearly, Marvin has a way of setting sources and sinks of electron-flow arrows. I'm simply asking for the same thing in the API.

User ef5e605ae6

27-11-2006 17:10:23

Hi Bob,





Both the bond and the MolAtom[2] type end points are MAtomSetPoints in MEFlow. So you have to use new MAtomSetPoint(atoms), where atoms = new MolAtom[] {bond.getAtom1(), bond.getAtom2()} in case of the bond. Sorry for the incomplete documentation. I wrote a few additional words about this in the MAtomSetPoint doc and added a @see link in the MEFlow constructor's api doc.





Peter
bobgr wrote:
I see that I can create an MEFlow object with the constructor MEFlow(MPoint p1, MPoint p2, int ne). But MEFlow arrows point from an electron source to an electron sink. Sources are MolAtoms or MolBonds, and sinks are MolAtoms, MolBonds, or MolAtom[2]s. Neither are MPoints. Furthermore, there is no method setSource() or setSink() in the API. How do I create an MEFlow that points, say, from a MolBond to a MolAtom[2]?

User 870ab5b546

28-11-2006 14:33:35

Let me see if I understand what you are saying. To create a two-electron MEFlow pointing from srcBond to an incipient bond between snkAtom1 and snkAtom2, I would write:





Code:
MAtomSetPoint srcPt = new MAtomSetPoint({srcBond.getAtom1(),  srcBond.getAtom2()});


MAtomSetPoint snkPt = new MAtomSetPoint({snkAtom1,  snkAtom2});


MEFlow flow = new MEFlow(srcPt, snkPt, 2);








And to create a one-electron MEFlow pointing from srcBond to the atom snkAtom3, I would write:





Code:
MAtomSetPoint srcPt = new MAtomSetPoint({srcBond.getAtom1(),  srcBond.getAtom2()});


MAtomSetPoint snkPt = new MAtomSetPoint({snkAtom3});


MEFlow flow = new MEFlow(srcPt, snkPt, 1);








Right?

User ef5e605ae6

28-11-2006 23:08:50

Yes. If you are not sure, then you can also try to draw it in msketch and view the source in MRV format. You will find an MEFlow definition with MAtomSetPoint end points, containing references to atoms only (also in case of a bond source).