colin-daniels / sp2

Computational condensed matter research code written in C++. Primary applications relate to low-dimensional carbon nanomaterials, phonons, and structural optimization.
0 stars 0 forks source link

truly, honestly to god doing zero iterations in acgsd #15

Closed ExpHP closed 7 years ago

ExpHP commented 7 years ago

doing zero iterations with #12:

Using steepest descent.
 i:      0  v:   -11852.025739365 dv: -1.042281e-09  g:  6.937322e-05 
ACGSD Finished.

as evidenced by the presence of a "dv" value, even zero iterations does at least one full iteration and I believe it can potentially change the position.

I don't actually see any way to fix this that isn't horribly disgusting, because the control flow logic in the function is already so complicated. If I had two days worth of time to throw at it, I'd probably try to refactor out all the control flow logic into some sort of state machine first

ExpHP commented 7 years ago

wait a second, this is actually easy. (do while --> for (int iter=0; ...))

ExpHP commented 7 years ago

yuck, not so simple if we also want to allow zero iterations in the case of input structures that meet the grad_max or grad_norm condition. (which we should!)

ExpHP commented 7 years ago

now possible with the acgsd rewrite #19

(well, actually, you can't currently specify 0 iterations as the limit; but the point is, it's capable of exiting before doing an iteration if e.g. force is small enough)