Atom & Bond Properties

Hi,

Has anyone tought about how to represent atom and bond properties? If
we make QAbstractTableModels for them, we could allow the user to edit
fields like atom type, charge, bond order, other columns such as
valence, index would be read-only. Does this sound good?

Tim

Hi Tim,

I think it’s a great idea, because sometimes you want to also edit the
exact coordinates for an atom. I think I’d put this into a new
extension, say something in the Build menu: “Cartesian Editor.” And I
think you hit on the right implementation.

I’ve had similar ideas for a Z-matrix editor, but haven’t had the time.

Being able to edit the properties is important – right now, you can’t
set the formal charge on an atom, the isotope, anything like that.

Cheers,
-Geoff

It seems like I need to change some declarations in openbabel to make this work:

OBAtom* OBMol::GetAtom(int idx); ----> OBAtom* OBMol::GetAtom(int idx) const;

should I just replace them? Will there be any problem with other code?

Tim

On Dec 5, 2007 4:12 PM, Geoffrey Hutchison geoff.hutchison@gmail.com wrote:

Hi Tim,

I think it’s a great idea, because sometimes you want to also edit the
exact coordinates for an atom. I think I’d put this into a new
extension, say something in the Build menu: “Cartesian Editor.” And I
think you hit on the right implementation.

I’ve had similar ideas for a Z-matrix editor, but haven’t had the time.

Being able to edit the properties is important – right now, you can’t
set the formal charge on an atom, the isotope, anything like that.

Cheers,
-Geoff

It’s in svn now :smiley:

I just picked some properties to test it, feel free to change them or
their order. I think there is alot mere we can implement this way, now
that there are examples, it is very easy to add more models.

Tim

On Dec 5, 2007 4:12 PM, Geoffrey Hutchison geoff.hutchison@gmail.com wrote:

Hi Tim,

I think it’s a great idea, because sometimes you want to also edit the
exact coordinates for an atom. I think I’d put this into a new
extension, say something in the Build menu: “Cartesian Editor.” And I
think you hit on the right implementation.

I’ve had similar ideas for a Z-matrix editor, but haven’t had the time.

Being able to edit the properties is important – right now, you can’t
set the formal charge on an atom, the isotope, anything like that.

Cheers,
-Geoff

On Dec 5, 2007, at 4:24 PM, Tim Vandermeersch wrote:

OBAtom* OBMol::GetAtom(int idx); ----> OBAtom* OBMol::GetAtom(int
idx) const;

should I just replace them? Will there be any problem with other code?

There should not be problems with other code by making a Get()
function declared const.

But you should be careful – some of these functions cannot be const
because they modify themselves or other objects. For example:

void OBAtom::GetResidue()

((OBMol*)GetParent())->SetChainsPerceived();
if ( chainsparser.PerceiveChains(((OBMol)GetParent())) )
return _residue;

Otherwise (e.g., OBMol::GetAtom()) please feel free to make the
methods more “const-correct.”

Cheers,
-Geoff

I solved it by using a pointer instead… no, changes are needed…

On Dec 6, 2007 3:22 PM, Geoffrey Hutchison geoff.hutchison@gmail.com wrote:

On Dec 5, 2007, at 4:24 PM, Tim Vandermeersch wrote:

OBAtom* OBMol::GetAtom(int idx); ----> OBAtom* OBMol::GetAtom(int
idx) const;

should I just replace them? Will there be any problem with other code?

There should not be problems with other code by making a Get()
function declared const.

But you should be careful – some of these functions cannot be const
because they modify themselves or other objects. For example:

void OBAtom::GetResidue()

((OBMol*)GetParent())->SetChainsPerceived();
if ( chainsparser.PerceiveChains(((OBMol)GetParent())) )
return _residue;

Otherwise (e.g., OBMol::GetAtom()) please feel free to make the
methods more “const-correct.”

Cheers,
-Geoff

But shouldn’t GetResidue theoretcially be const too? Might need to
bring ‘const_cast’ or ‘mutable’ out of the C++ vault to handle this
situation.


Donald

(Thu, Dec 06, 2007 at 09:22:25AM -0500) Geoffrey Hutchison geoff.hutchison@gmail.com:

On Dec 5, 2007, at 4:24 PM, Tim Vandermeersch wrote:

OBAtom* OBMol::GetAtom(int idx); ----> OBAtom* OBMol::GetAtom(int
idx) const;

should I just replace them? Will there be any problem with other code?

There should not be problems with other code by making a Get()
function declared const.

But you should be careful – some of these functions cannot be const
because they modify themselves or other objects. For example:

void OBAtom::GetResidue()

((OBMol*)GetParent())->SetChainsPerceived();
if ( chainsparser.PerceiveChains(((OBMol)GetParent())) )
return _residue;

Otherwise (e.g., OBMol::GetAtom()) please feel free to make the
methods more “const-correct.”

Cheers,
-Geoff


SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
avogadro-devel List Signup and Options

There is now a PropertiesModel and PropertiesView class. New tables of
properties can easily be added. We could also place them in a dock I
think, bu tI don’t know how…

Tim

We could also place them in a dock I think, bu tI don’t know how…

Lets not. I like the current solution with separate windows.

Just my $0.02,
-Geoff

Ok, you can set the windows to always on top if you want to view the
changes while you are editing. I suppose this also works on other
platfroms?

Tim

On Dec 7, 2007 2:53 PM, Geoffrey Hutchison geoff.hutchison@gmail.com wrote:

We could also place them in a dock I think, bu tI don’t know how…

Lets not. I like the current solution with separate windows.

Just my $0.02,
-Geoff