# Constraints in Avogadro2

Follow up of Avogadro 2 Docs

It would be cool to have the interface from Avogadro1 (or something similar/better) to implement the addition of constraints.

A new json entry might do the trick for passing the constraints to scripts for fixing certain coordinates (position, distance, angle, torsion):

{'constraints':
{
'position':[atom_id1, atom_id2,...],
'distance':[(atom_id1, atom_id2, dist1'),...]
'angle':[(atom_id1, atom_id2, atom_id3, angle1),...],
'dihedral':[(atom_id1, atom_id2, atom_id3, atom_id3, torsion1),...]
}
}


Together with being able to pass multiple fileformats, it should be straightforward to implement these constraints using the appropriate functions in RDKit before minimization.

I would also like to get these functionality using the Parsley forcefield/OpenMM but the implementation seems not as straightforward.

Yeah, I’m not 100% sold on the user interface. I’d like to adopt the Atom / Bond / Angle / Torsion spreadsheets from Avogadro 1 and then make it possible to add a constraint from that dialog.

Ideas welcome.

The JSON seems reasonable. The catch is:

• Implementing the UI
• Adding the constraint code to the new force field engine
• Passing the constraints into CJSON and other sources. (commands, generators, etc.)

I can imagine it would be nice to pass the constraints to QM interfaces to enable constrained optimization in Gaussian / Orca, etc.

OpenMM integration would be very nice - beyond Python are you willing to do some C++? If so, I’m happy to give some pointers.

Keeping the spreadsheet dialog from Avogadro1 was exactly what I had in mind.

I admit that I did not think at all about the QM input generators - I agree that it would be nice to be able to apply the constraints there, too. I have only some modest experience with MOPAC, setting the optimization flags for specific coordinates is rather tedious within the input file itself (maybe I miss a trick or two).
What comes to my mind is something like ASE. That could provide a generic interface for implementing constraints but might also bring a loss in flexibility further down the line because of the calculator interfaces implemented there.

Definitely willing to do some C++ - but no experience. I would like to try but that’s something in the longer term. My knowledge of C++ is superficial to point that I was even confused by the expression “give some pointers” (in combination with an insufficient command of English ).