# LINCS warning during energy minimizations

**URL:** <https://gromacs.bioexcel.eu/t/lincs-warning-during-energy-minimizations/5404>\
**Category:** User discussions\
**Tags:** mdp-parameters, grompp, mdrun, simulation-setup\
**Created:** [December 9, 2022, 5:50pm UTC](https://gromacs.bioexcel.eu/t/lincs-warning-during-energy-minimizations/5404 "2022-12-09T17:50:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![arunrathod](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@arunrathod](https://gromacs.bioexcel.eu/u/arunrathod)\
**Post date:** [December 9, 2022, 5:50pm UTC](https://gromacs.bioexcel.eu/t/lincs-warning-during-energy-minimizations/5404/1 "2022-12-09T17:50:59Z")

</div>

GROMACS version: 2020.6  
GROMACS modification: Yes/No

I am trying to minimize the energy of the system, during which I got some warnings related to the LINCS, specifically “relative constraint deviation after LINCS” (WARNING PASTED BELOW).

**I have some queries about the LINCS WARNING**

1. What is the meaning of this LINCS WARNING (below mentioned)

2. If ignore the LINCS WARNING, how much it will affect my system

3. Is good to use export GMX\_MAXCONSTRWARN=-1 (when I am using this option minimization run without LINCS WARNING)

4. Is that necessary? to use the LINCS option during the energy minimization step (because I have gone through your lysozyme in water tutorial, in minim. mdp, where, not mentioned the LINCS Constraints and at all)

LINCS WARNING!!!  
Step= 35, Dmax= 1.5e-01 nm, Epot= inf Fmax= 4.68238e+05, atom= 1292  
Step 36, time 0.036 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.001044, max 0.025237 (between atoms 1301 and 1303)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1298 1299 32.7 0.1111 0.1124 0.1111  
1298 1300 35.1 0.1111 0.1134 0.1111  
1301 1302 36.0 0.1111 0.1133 0.1111  
1301 1303 42.7 0.1111 0.1139 0.1111  
Step= 36, Dmax= 7.4e-02 nm, Epot= -1.32439e+05 Fmax= 4.62382e+04, atom= 1302  
Step 37, time 0.037 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.001667, max 0.060448 (between atoms 1301 and 1303)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1301 1302 45.6 0.1133 0.1089 0.1111  
Step= 37, Dmax= 8.9e-02 nm, Epot= -1.39633e+05 Fmax= 1.03698e+04, atom= 1302  
Step 38, time 0.038 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.008752, max 0.231415 (between atoms 1292 and 1293)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1418 1419 38.0 0.1108 0.1133 0.1111  
1418 1420 48.0 0.1101 0.1113 0.1111  
1304 1305 70.2 0.1113 0.1296 0.1111  
1304 1306 53.0 0.1113 0.1217 0.1111  
1415 1416 36.0 0.1111 0.1084 0.1111  
1415 1417 48.4 0.1111 0.1134 0.1111  
1292 1293 90.0 0.1112 0.1368 0.1111  
1292 1294 83.8 0.1112 0.1231 0.1111  
1298 1299 33.7 0.1111 0.1097 0.1111  
1301 1302 69.5 0.1089 0.1137 0.1111  
Step= 38, Dmax= 1.1e-01 nm, Epot= -1.47797e+05 Fmax= 3.63084e+05, atom= 1292  
Step 39, time 0.039 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.009534, max 0.304708 (between atoms 1292 and 1293)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1418 1419 90.1 0.1133 0.1186 0.1111  
1418 1420 69.0 0.1113 0.1192 0.1111  
1415 1416 44.9 0.1084 0.1096 0.1111  
1292 1293 90.1 0.1368 0.1450 0.1111  
1292 1294 90.1 0.1231 0.1299 0.1111  
1301 1302 30.6 0.1137 0.1079 0.1111  
Step= 39, Dmax= 1.3e-01 nm, Epot= -1.64661e+05 Fmax= 3.25678e+04, atom= 9873  
Step 40, time 0.04 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.009707, max 0.340706 (between atoms 1292 and 1294)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1304 1305 54.8 0.1111 0.1216 0.1111  
1304 1306 52.6 0.1111 0.1243 0.1111  
1415 1416 54.5 0.1096 0.1137 0.1111  
1415 1417 42.2 0.1051 0.1071 0.1111  
1292 1293 79.3 0.1450 0.1114 0.1111  
1292 1294 90.2 0.1299 0.1490 0.1111  
Step 40, time 0.04 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.003170, max 0.093022 (between atoms 1289 and 1290)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1295 1296 31.7 0.1111 0.1094 0.1111  
1289 1290 53.3 0.1111 0.1214 0.1111  
1289 1291 57.0 0.1111 0.1206 0.1111  
Step= 40, Dmax= 1.5e-01 nm, Epot= 4.70992e+06 Fmax= 5.62122e+08, atom= 9873  
Step 41, time 0.041 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.000477, max 0.012111 (between atoms 1304 and 1306)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1292 1294 40.4 0.1299 0.1120 0.1111

Energy minimization (mdp options)  
define = -DPOSRES -DPOSRES\_FC\_LIPID=1000.0 -DDIHRES -DDIHRES\_FC=1000.0  
integrator = steep  
emtol = 1000.0  
nsteps = 5000  
nstlist = 10  
cutoff-scheme = Verlet  
rlist = 1.2  
vdwtype = Cut-off  
vdw-modifier = Force-switch  
rvdw\_switch = 1.0  
rvdw = 1.2  
coulombtype = PME  
rcoulomb = 1.2  
;  
constraints = h-bonds  
constraint\_algorithm = LINCS

Thank you in advance

---

<div class="post-metadata">

**Author:** ![therealchrisneale](https://avatars.discourse-cdn.com/v4/letter/t/779978/32.png) [@therealchrisneale](https://gromacs.bioexcel.eu/u/therealchrisneale)\
**Post date:** [December 9, 2022, 7:36pm UTC](https://gromacs.bioexcel.eu/t/lincs-warning-during-energy-minimizations/5404/2 "2022-12-09T19:36:03Z")

</div>

I’d be concerned about the Epot=inf at step 35. Look how large your Dmax is getting (0.15 nm step size!). I personally modify gromacs to set an upper bound on Dmax (there’s an online post with a feature request about this somewhere, but I can’t find it). You can get the same basic behavior by running a few cycles of EM with nstep=10. Each time you restart, the step size will be reset back to the default (small) value. You can set emstep yourself to something smaller than default (0.01 nm) but it may climb too high again anyway without either putting a hard cap on the step size or running a few iterations of short EM to hack in the desired behavior.

It does look like you have some not-great contacts in your initial structure, and there’s no way I could guess from here if that’s a problem or not, but anyway the above is a technical fix that should be paired with a careful assessment of atoms 1292, 1302, and overall structural changes over the course of EM.

---

<div class="post-metadata">

**Author:** ![arunrathod](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@arunrathod](https://gromacs.bioexcel.eu/u/arunrathod)\
**Post date:** [December 9, 2022, 8:00pm UTC](https://gromacs.bioexcel.eu/t/lincs-warning-during-energy-minimizations/5404/3 "2022-12-09T20:00:25Z")

</div>

@therealchrisneale, I just wanted to say thank you for your time and valuable reply. Just out of curiosity, is making such changes in the em.mdp file fundamentally correct?

---

<div class="post-metadata">

**Author:** ![therealchrisneale](https://avatars.discourse-cdn.com/v4/letter/t/779978/32.png) [@therealchrisneale](https://gromacs.bioexcel.eu/u/therealchrisneale)\
**Post date:** [December 9, 2022, 8:10pm UTC](https://gromacs.bioexcel.eu/t/lincs-warning-during-energy-minimizations/5404/4 "2022-12-09T20:10:06Z")

</div>

what changes? running 10 repeat mdrun iterations with nsteps=10 and then a single run with nsteps=5000 instead of 1 single run with nsteps=5000? Sure. Why not?

---

<div class="post-metadata">

**Author:** ![arunrathod](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@arunrathod](https://gromacs.bioexcel.eu/u/arunrathod)\
**Post date:** [December 9, 2022, 8:58pm UTC](https://gromacs.bioexcel.eu/t/lincs-warning-during-energy-minimizations/5404/5 "2022-12-09T20:58:19Z")

</div>

You’re saying I should start with nstep = 10 (with 10 repeats) every time?  
But the LINCS warning was observed after Step 35, so how could it minimize the system energy after the 35 steps if I am using Step 10?

One more additional concern is that playing around with emtol does make sense??. Recently, I read somewhere else that repeating emtol from higher to lower (i.e., emtol = 1000 followed by 100, 10) might help to solve the LINCS warnings.

Thank you in advance

---

<div class="post-metadata">

**Author:** ![therealchrisneale](https://avatars.discourse-cdn.com/v4/letter/t/779978/32.png) [@therealchrisneale](https://gromacs.bioexcel.eu/u/therealchrisneale)\
**Post date:** [December 9, 2022, 10:14pm UTC](https://gromacs.bioexcel.eu/t/lincs-warning-during-energy-minimizations/5404/6 "2022-12-09T22:14:34Z")

</div>

I didn’t suggest changing emtol (though that’s not going to affect your issue anyway). I did say that you might change emstep to a smaller value, but that it’s going to get too big anyway (likely). Every time an EM step improves the energy, the step size increases by something like 1.2x. If you start at 0.01 nm (default) and have 35 steps all improving the energy because the conformation was poor, then the maximum step size will increase from 0.01 to 1.0 nm (clearly not a good thing!). Note that the gromacs .mdp options page for 2018 says " A steepest descent algorithm for energy minimization. The maximum step size is emstep". This is actually not true. There is no maximum step size in the gmx EM steep algorithm (though I argue that there should be).

If you use nstep=10 (2 repeats), and all steps improve the total potential energy, then your max step size will go from 0.01 nm to 0.06 nm in 10 steps, then you restart a new EM from that conformation and your step size is reset to 0.01 nm and may again grow to 0.06 nm. However, in a single EM of nstep=20, your step size would grow from 0.01 nm to 0.38 nm.

It’s not a super efficient way to do things, but hopefully this clarifies what the issue is and how you can get around it.

If you want to get more intuition on this, then save the .xtc every single step and visualize it. I suspect you will see some atoms starting to oscillate back and forth by larger and larger amounts in a single long EM. It may then stabilize and Dmax will go down or it will blow up. Depends on the system. All I can say is that gmx EM is _way_ more stable if you modify the source code to put a hard cap on Dmax or you can do something pretty similar by running iterations of very short EM at the start.

---

<div class="post-metadata">

**Author:** ![therealchrisneale](https://avatars.discourse-cdn.com/v4/letter/t/779978/32.png) [@therealchrisneale](https://gromacs.bioexcel.eu/u/therealchrisneale)\
**Post date:** [December 9, 2022, 10:59pm UTC](https://gromacs.bioexcel.eu/t/lincs-warning-during-energy-minimizations/5404/7 "2022-12-09T22:59:24Z")

</div>

PS: iterating through EM runs with successively smaller emtol values is probably only going to help in the same way it would help to just set nsteps to 10 (with the later being a more robust fix anyway). Every time you restart (for whatever reason) Dmax goes back to start at emstep.

---

<div class="post-metadata">

**Author:** ![arunrathod](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@arunrathod](https://gromacs.bioexcel.eu/u/arunrathod)\
**Post date:** [December 10, 2022, 6:22am UTC](https://gromacs.bioexcel.eu/t/lincs-warning-during-energy-minimizations/5404/8 "2022-12-10T06:22:50Z")

</div>

@therealchrisneale Thank you so much, I will work on it, and get back to you

---

<div class="post-metadata">

**Author:** ![Qing\_Chow](https://avatars.discourse-cdn.com/v4/letter/q/4491bb/32.png) [@Qing\_Chow](https://gromacs.bioexcel.eu/u/Qing_Chow)\
**Post date:** [January 24, 2024, 10:23am UTC](https://gromacs.bioexcel.eu/t/lincs-warning-during-energy-minimizations/5404/9 "2024-01-24T10:23:10Z")

</div>

did you get a progress in the LINCS warning, I got the same warning today when I run the NPT equilibration.  
50000 steps, 100.0 ps.  
step 37000, will finish Tue Jan 23 23:05:48 2024  
Step 37030, time 74.06 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.000110, max 0.003846 (between atoms 1445 and 1447)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1445 1446 30.3 0.1120 0.1116 0.1120

Step 37032, time 74.064 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.000145, max 0.005250 (between atoms 1445 and 1446)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1445 1447 32.2 0.1120 0.1125 0.1120

Step 37095, time 74.19 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.000089, max 0.003235 (between atoms 1445 and 1447)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1445 1446 31.7 0.1120 0.1117 0.1120  
step 37100, will finish Tue Jan 23 23:05:41 2024  
Step 37102, time 74.204 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.000088, max 0.003665 (between atoms 1445 and 1447)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1445 1446 32.5 0.1120 0.1122 0.1120

Step 37115, time 74.23 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.000105, max 0.003939 (between atoms 1445 and 1446)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1445 1447 30.7 0.1120 0.1124 0.1120

Step 37120, time 74.24 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.000156, max 0.005498 (between atoms 1445 and 1447)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1445 1446 31.8 0.1120 0.1126 0.1120  
1445 1447 31.0 0.1120 0.1126 0.1120

Step 37141, time 74.282 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.000088, max 0.003065 (between atoms 1445 and 1446)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1445 1447 30.7 0.1120 0.1117 0.1120

Step 37184, time 74.368 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.000118, max 0.004546 (between atoms 1445 and 1447)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1445 1446 30.7 0.1120 0.1124 0.1120

Step 37186, time 74.372 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.000111, max 0.003719 (between atoms 1445 and 1446)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1445 1447 34.4 0.1120 0.1116 0.1120

Step 37188, time 74.376 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.000123, max 0.005265 (between atoms 1445 and 1447)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1445 1446 39.0 0.1120 0.1123 0.1120

Step 37191, time 74.382 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.010711, max 0.499483 (between atoms 1448 and 1450)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1445 1446 90.0 0.1119 0.1349 0.1120  
1448 1450 90.0 0.1120 0.1679 0.1120

Step 37192, time 74.384 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 1.128464, max 56.658459 (between atoms 1448 and 1450)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1445 1446 73.1 0.1349 0.1119 0.1120  
1448 1449 90.0 0.1123 0.3581 0.1120  
1448 1450 90.0 0.1679 6.4577 0.1120  
1454 1455 90.0 0.1120 0.5667 0.1120  
1454 1456 90.0 0.1120 0.1895 0.1120  
Wrote pdb files with previous and current coordinates

Step 37193, time 74.386 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 0.340347, max 9.746684 (between atoms 1454 and 1456)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1439 1440 30.7 0.1120 0.1120 0.1120  
1445 1446 90.0 0.1119 0.2684 0.1120  
1445 1447 34.6 0.1109 0.1069 0.1120  
2635 2637 37.7 0.1120 0.1120 0.1120  
1451 1452 90.0 0.1120 0.4947 0.1120  
1451 1453 90.0 0.1120 0.5318 0.1120  
1448 1449 90.0 0.3581 0.9455 0.1120  
1448 1450 90.0 6.4577 0.4845 0.1120  
1454 1455 90.0 0.5667 0.9633 0.1120  
1454 1456 90.0 0.1895 1.2036 0.1120  
1460 1462 90.0 0.1120 0.7636 0.1120  
1457 1458 90.0 0.1120 0.1517 0.1120  
1457 1459 90.0 0.1120 0.5177 0.1120  
Wrote pdb files with previous and current coordinates

Step 37194, time 74.388 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 19.979134, max 981.033752 (between atoms 1448 and 1449)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
2629 2630 90.0 0.1120 0.9001 0.1120  
2629 2631 90.0 0.1120 0.9151 0.1120  
2632 2633 90.0 0.1120 12.9397 0.1120  
2632 2634 90.0 0.1120 9.8845 0.1120  
1445 1446 90.0 0.2684 1.8414 0.1120  
1445 1447 90.0 0.1069 1.8924 0.1120  
1451 1452 90.0 0.4947 4.4056 0.1120  
1451 1453 90.0 0.5318 3.3565 0.1120  
1448 1449 90.0 0.9455 109.9878 0.1120  
1448 1450 90.0 0.4845 18.5182 0.1120  
1454 1455 46.9 0.9633 0.1086 0.1120  
1454 1456 90.0 1.2036 0.2468 0.1120  
1460 1461 90.0 0.1116 0.1472 0.1120  
1460 1462 90.0 0.7636 0.2128 0.1120  
1460 1463 36.8 0.1114 0.1106 0.1120  
1457 1458 90.0 0.1517 0.5163 0.1120  
Wrote pdb files with previous and current coordinates

Step 37195, time 74.39 (ps) LINCS WARNING  
relative constraint deviation after LINCS:  
rms 18415.175781, max 680639.937500 (between atoms 1448 and 1449)  
bonds that rotated more than 30 degrees:  
atom 1 atom 2 angle previous, current, constraint length  
1434 1435 66.4 0.1130 0.1189 0.1130  
1434 1436 76.5 0.1130 0.1179 0.1130  
2767 2768 90.0 0.1120 0.9175 0.1120  
2767 2769 90.0 0.1120 27.3763 0.1120  
1439 1440 90.0 0.1120 1.7916 0.1120  
2629 2630 90.0 0.9001 9886.8096 0.1120  
2629 2631 90.0 0.9151 9927.5000 0.1120  
2626 2627 90.0 0.1120 0.7882 0.1120  
2626 2628 90.0 0.1120 0.8667 0.1120  
2632 2633 90.0 12.9397 12469.8701 0.1120  
2632 2634 90.0 9.8845 8941.7686 0.1120  
1442 1443 90.0 0.1120 7.2420 0.1120  
1442 1444 90.0 0.1120 14.6514 0.1120  
1445 1446 90.0 1.8414 16406.4219 0.1120  
1445 1447 90.0 1.8924 16849.8242 0.1120  
2635 2636 90.0 0.1121 6862.5122 0.1120  
2635 2637 90.0 0.1120 9237.9316 0.1120  
1451 1452 90.0 4.4056 39611.3984 0.1120  
1451 1453 90.0 3.3565 44051.6875 0.1120  
1448 1449 90.0 109.9878 76231.7891 0.1120  
1448 1450 90.0 18.5182 18885.8027 0.1120  
1454 1455 90.0 0.1086 861.8229 0.1120  
1454 1456 90.0 0.2468 936.9543 0.1120  
1460 1462 90.0 0.2128 0.7195 0.1120  
1460 1463 74.9 0.1106 0.1081 0.1120  
1457 1458 90.0 0.5163 0.5380 0.1120  
1457 1459 90.0 0.1143 0.6832 0.1120  
2047 2048 90.0 0.1120 1.0029 0.1120  
2047 2049 90.0 0.1120 1.7277 0.1120  
2047 2050 90.0 0.1120 5.6166 0.1120
