Page 1 of 1

incompatibility between Constraint::Weld and LocalEnergyMinimizer::minimizeEnergy ?

Posted: Fri Oct 14, 2016 2:22 am
by sam
Guys,

Is there an incompatibility between Constraint::Weld and LocalEnergyMinimizer::minimizeEnergy ?

I create one complex comprising proteins A and B, which are constrained to each other (I want them to stay together, moving as a single rigid body) and then apply springs to pull them onto another complex, comprising related proteins C and D. All four chains are Rigid, that is they have no internal degrees of freedom. C and D have no SimTK constraints per se, but their root mobilizer (connecting them to Ground) is of type Weld so they are immobile. When run the dynamics on this system, calling TimeStepper.stepTo(...), A and B stay together and move to align with D and C as expected. The only downside of calling the time integrator is that it is a bit slow compared to the minimizer. This is a very simple, low-dimensional problem, so it makes sense to just minimize.

However if I call LocalEnergyMinimizer::minimizeEnergy, A and B change their relative orientation, and are no longer in the same sort of complex. The constraints do not work, rather than holding A and B together they change the relative position and orientation of A vs. B. As such, A and B are also unable to align properly to C and D. C and D do remain fixed in their correct, initial position.

I verified that if I removed the Constraint::Weld, A gets aligned with C, and B gets aligned with D, as expected. However it is likely that the relative orientation of A vs. B is not exactly the same as it was initially. There are reasons why this can be a problem in my case.

I wonder if you could tell me whether Constraint::Weld is compatible with LocalEnergyMinimizer::minimizeEnergy ? Are there special considerations one needs to keep in mind? I think I got simbody from github in July 2015 using git clone https://github.com/simbody/simbody.git which hopefully gets the trunk release.

thanks

Sam

Re: incompatibility between Constraint::Weld and LocalEnergyMinimizer::minimizeEnergy ?

Posted: Fri Oct 14, 2016 11:36 am
by sherm
Hi, Sam. Looking at the LocalEnergyMinimizer code it does appear to respect position constraints so the Welds should work. Is there any possibility that the constraints are present but currently disabled in the starting State?

I don't see a test case in Simbody that verifies that behavior though. My suggestion would be to try a very simple system in Simbody (two balls welded together or something like that) and try energy minimizing to verify that the constraints are obeyed. You could also step through the minimizer code (or add printf's) to see how many constraints it thinks are active (the code is very short).

Regards,
Sherm

Re: incompatibility between Constraint::Weld and LocalEnergyMinimizer::minimizeEnergy ?

Posted: Sat Oct 15, 2016 3:46 am
by sam
In this case the complexes AB and CD are highly similar. So constraining A to B should give almost the same result as not constraining -- the differences should be on the order of tenths of Ångströms (there will be other situations in which this is not the case, hence the need for constraints). However if I have the constraint on, A and B radically change their relative position and orientation. This tells me that it is not a matter of the constraint being turned off, but rather a more insidiuous issue of how the constraint is interpreted in the minimizer. For example, maybe there is some odd cross-talk between the coordinates of A and B. If it were just an on-off issue, I would be more confident to dive in. Since the error is so odd, I am a bit afraid of diving in and looking for a subtle bug without at least talking about it first. I have always had issues like this with the minimizer, in a variety of situations, so I have avoided it all these years. I do think it is time to take it on though, because minimization by dynamics is often less efficient.

Sam

Re: incompatibility between Constraint::Weld and LocalEnergyMinimizer::minimizeEnergy ?

Posted: Sun Oct 16, 2016 1:18 pm
by sherm
Sam -- One possibility that occurs to me is that you may be starting LocalEnergyMinimizer our from an unassembled configuration (that is, the Weld constraint is not yet satisifed). That would mean the connected pieces must be pulled together before the energy minimization can start. From a long distance away, Weld constraints can be assembled upside-down (there is a bug filed about that somewhere). For them to be successfully assembled they have to be initially placed fairly close to the right assembled orientation.

I would suggest using the Assembler to ensure that your constraints are satisfied before starting the LocalEnergyMinimizer. You will still need to start out the Assembler run with the weld constraints roughly in the right orientation. But then you can visualize after the assembly to make sure the welds came together properly. After that LocalEnergyMinimizer should be able to maintain them.

Sherm