minimum distance

645 views
Skip to first unread message

rose rahmani

unread,
Nov 1, 2021, 11:20:17 AM11/1/21
to PLUMED users
Hi,

I am quite disappointed by how plumed calculates the minimum distance. So I have to calculate the minimum distance between the center of mass of molecule A and any atom of the molecule B(which B in system 1:nanoparticle 2: slab 3: polymer). I have tried the MIN and ALT_MIN functions but both give a very unreasonable distances. I have changes the beta in MIN from 0.1-1 and in ALT_MIN from 10-19 but still the distances (SSD) in COLVAR file are incorrect. Could you please help me?

plumed.dat for MIN function:

 Append to existing files
#RESTART

# Flush open files
FLUSH STRIDE=500

# Include file with atom groups
polymer:    GROUP NDX_FILE=index.ndx NDX_GROUP=moleculeB
solute: GROUP NDX_FILE=index.ndx NDX_GROUP=moleculeA

# Center of mass of solute and the nearest atom on the surface
solute_COM: COM ATOMS=solute

# Minimum distance between Center of mass of solute and the nearest atom on the surface
d1: DISTANCES GROUPA=solute_COM GROUPB=moleculeB MIN={BETA=0.1}
SSD1: COMBINE ARG=d1.min PERIODIC=NO
d2: DISTANCES GROUPA=solute_COM GROUPB=moleculeB MIN={BETA=0.2}
SSD2: COMBINE ARG=d2.min PERIODIC=NO
d3: DISTANCES GROUPA=solute_COM GROUPB=moleculeB MIN={BETA=0.3}
SSD3: COMBINE ARG=d3.min PERIODIC=NO
d4: DISTANCES GROUPA=solute_COM GROUPB=moleculeB MIN={BETA=0.4}
SSD4: COMBINE ARG=d4.min PERIODIC=NO
d5: DISTANCES GROUPA=solute_COM GROUPB=moleculeB MIN={BETA=0.5}
SSD5: COMBINE ARG=d5.min PERIODIC=NO
d6: DISTANCES GROUPA=solute_COM GROUPB=moleculeB MIN={BETA=0.6}
SSD6: COMBINE ARG=d6.min PERIODIC=NO
d7: DISTANCES GROUPA=solute_COM GROUPB=moleculeB MIN={BETA=0.7}
SSD7: COMBINE ARG=d7.min PERIODIC=NO
d8: DISTANCES GROUPA=solute_COM GROUPB=moleculeB MIN={BETA=0.8}
SSD8: COMBINE ARG=d8.min PERIODIC=NO
d9: DISTANCES GROUPA=solute_COM GROUPB=moleculeB MIN={BETA=0.9}
SSD9: COMBINE ARG=d9.min PERIODIC=NO
d10: DISTANCES GROUPA=solute_COM GROUPB=moleculeB MIN={BETA=1.0}
SSD10: COMBINE ARG=d10.min PERIODIC=NO


# Run metadynamics with grid and multiple walkers
METAD ...
ARG=SSD1
SIGMA=0.05
HEIGHT=0.01
PACE=500
TEMP=300
GRID_MIN=-1
GRID_MAX=2
GRID_BIN=1000
GRID_WSTRIDE=100000
GRID_WFILE=GRID
FILE=HILLS
... METAD

# With an upper wall at 1.5 nm.
uwall: UPPER_WALLS ARG=SSD1 AT=1.5 KAPPA=400000.0 EXP=4 EPS=1.0 OFFSET=0


# Print results

##force: DUMPFORCES ARG=SSD FILE=FORCES
PRINT ARG=SSD1,SSD2,SSD3,SSD4,SSD5,SSD6,SSD7,SSD8,SSD9,SSD10 STRIDE=250 FILE=COLVAR
DUMPFORCES STRIDE=250 ARG=SSD1,SSD2,SSD3,SSD4,SSD5,SSD6,SSD7,SSD8,SSD9,SSD10 FILE=FORCES
------------------------------
file plumed.dat for ALT_MIN function is exactly the same except the Beta is from 10-19 in SSD1-SSD10
------------------------------
COLVAR for MIN function
#! FIELDS time SSD1 SSD2 SSD3 SSD4 SSD5 SSD6 SSD7 SSD8 SSD9 SSD10
 0.000000 0.024629 0.048186 0.070731 0.092320 0.113006 0.132836 0.151857 0.170110 0.187634 0.204466
 0.500000 0.024638 0.048217 0.070798 0.092434 0.113177 0.133071 0.152163 0.170492 0.188096 0.205011
 1.000000 0.024634 0.048205 0.070771 0.092386 0.113102 0.132966 0.152021 0.170308 0.187865 0.204727
 1.500000 0.024630 0.048186 0.070729 0.092314 0.112992 0.132809 0.151811 0.170038 0.187529 0.204318
 2.000000 0.024627 0.048178 0.070713 0.092289 0.112956 0.132763 0.151756 0.169976 0.187461 0.204248
 2.500000 0.024640 0.048226 0.070818 0.092469 0.113229 0.133145 0.152261 0.170617 0.188252 0.205199
 3.000000 0.024643 0.048239 0.070845 0.092512 0.113290 0.133224 0.152357 0.170728 0.188373 0.205327
 3.500000 0.024630 0.048190 0.070737 0.092327 0.113011 0.132837 0.151847 0.170083 0.187582 0.204380
 4.000000 0.024628 0.048181 0.070719 0.092298 0.112970 0.132783 0.151781 0.170007 0.187498 0.204291
 4.500000 0.024620 0.048151 0.070652 0.092181 0.112791 0.132529 0.151442 0.169571 0.186955 0.203631
 5.000000 0.024646 0.048251 0.070872 0.092564 0.113377 0.133356 0.152546 0.170987 0.188715 0.205767
 5.500000 0.024645 0.048245 0.070860 0.092543 0.113345 0.133311 0.152485 0.170907 0.188616 0.205646
 6.000000 0.024654 0.048282 0.070940 0.092680 0.113551 0.133597 0.152861 0.171382 0.189196 0.206339
 6.500000 0.024652 0.048271 0.070915 0.092635 0.113479 0.133492 0.152715 0.171189 0.188948 0.206028
 7.000000 0.024661 0.048310 0.071001 0.092786 0.113712 0.133824 0.153163 0.171767 0.189672 0.206913
 7.500000 0.024647 0.048253 0.070875 0.092568 0.113379 0.133355 0.152538 0.170969 0.188683 0.205717
 8.000000 0.024636 0.048210 0.070783 0.092407 0.113135 0.133011 0.152082 0.170386 0.187962 0.204846
 8.500000 0.024628 0.048180 0.070717 0.092292 0.112958 0.132762 0.151748 0.169956 0.187426 0.204193
 9.000000 0.024645 0.048246 0.070862 0.092544 0.113342 0.133303 0.152468 0.170878 0.188570 0.205578
 9.500000 0.024646 0.048251 0.070870 0.092556 0.113359 0.133322 0.152488 0.170897 0.188584 0.205584
 10.000000 0.024652 0.048272 0.070916 0.092636 0.113479 0.133491 0.152711 0.171180 0.188933 0.206004
 10.500000 0.024666 0.048329 0.071040 0.092851 0.113808 0.133954 0.153329 0.171972 0.189916 0.207197
 11.000000 0.024659 0.048301 0.070979 0.092746 0.113648 0.133728 0.153029 0.171588 0.189442 0.206624
 11.500000 0.024624 0.048166 0.070685 0.092237 0.112875 0.132646 0.151596 0.169766 0.187195 0.203919
 12.000000 0.024593 0.048047 0.070429 0.091800 0.112219 0.131740 0.150411 0.168278 0.185385 0.201770
 12.500000 0.024583 0.048009 0.070346 0.091660 0.112011 0.131453 0.150037 0.167811 0.184819 0.201103
 13.000000 0.024588 0.048028 0.070387 0.091730 0.112115 0.131597 0.150226 0.168048 0.185107 0.201443
 13.500000 0.024567 0.047946 0.070209 0.091423 0.111648 0.130942 0.149358 0.166943 0.183743 0.199801
 14.000000 0.024585 0.048015 0.070360 0.091684 0.112046 0.131501 0.150100 0.167890 0.184914 0.201215
 14.500000 0.024582 0.048002 0.070328 0.091625 0.111950 0.131359 0.149901 0.167624 0.184572 0.200784
 15.000000 0.024600 0.048071 0.070480 0.091888 0.112352 0.131923 0.150650 0.168579 0.185751 0.202206
 15.500000 0.024594 0.048050 0.070434 0.091807 0.112227 0.131744 0.150409 0.168265 0.185356 0.201720
 16.000000 0.024590 0.048033 0.070397 0.091743 0.112127 0.131602 0.150217 0.168016 0.185042 0.201333
 16.500000 0.024542 0.047847 0.069995 0.091055 0.111095 0.130172 0.148345 0.165663 0.182174 0.197923
 17.000000 0.024531 0.047805 0.069897 0.090877 0.110808 0.129749 0.147752 0.164867 0.181139 0.196610
 17.500000 0.024511 0.047729 0.069733 0.090598 0.110391 0.129174 0.147002 0.163928 0.179999 0.195260
 18.000000 0.024520 0.047763 0.069812 0.090741 0.110617 0.129504 0.147459 0.164534 0.180778 0.196236
 18.500000 0.024503 0.047696 0.069661 0.090472 0.110197 0.128896 0.146626 0.163437 0.179378 0.194490
 19.000000 0.024473 0.047579 0.069403 0.090022 0.109507 0.127920 0.145320 0.161761 0.177290 0.191953
 19.500000 0.024438 0.047443 0.069104 0.089503 0.108712 0.126798 0.143819 0.159829 0.174878 0.189010
 20.000000 0.024485 0.047625 0.069505 0.090202 0.109786 0.128320 0.145862 0.162465 0.178177 0.193044


real distances calculated by MDanalysis:

0.711076637594801

0.686211580552166

0.643828429356176

0.655394676722033

0.639169102386638

0.672585658402185

0.666359931603232

0.611693866272018

0.628466182696358

0.642281231862288

0.756539844889028

0.746638555494146

0.732929577401778

0.693738515204775

0.743420376680012

0.685330966523793

0.657062601540277

0.624187035718232

0.652108767605284

0.669640830575903

0.671257535300613

0.746591914567469

0.725660027643153

0.635305057080758

0.687070000700232

0.679291004874519

0.679411399190305

0.59069640811742

0.670761632997759

0.658171511320518

0.698035017031904

0.602673033689062

0.569681502117849

0.530175473723929

0.462883540226044

0.458177848776518

0.488587267795363

0.424275042905893

0.41243058215892

0.360551202649313

0.416974544258247
----------------------------
COLVAR file for ALT_MIN function
#! FIELDS time SSD1 SSD2 SSD3 SSD4 SSD5 SSD6 SSD7 SSD8 SSD9 SSD10
 0.000000 0.549416 0.574347 0.594329 0.610592 0.623999 0.635173 0.644572 0.652541 0.659344 0.665188
 0.500000 0.554333 0.578357 0.597466 0.612895 0.625507 0.635927 0.644610 0.651901 0.658064 0.663301
 1.000000 0.558022 0.580389 0.597792 0.611502 0.622412 0.631165 0.638236 0.643982 0.648673 0.652519
 1.500000 0.557384 0.581690 0.601063 0.616729 0.629546 0.640135 0.648952 0.656342 0.662570 0.667842
 2.000000 0.539867 0.564083 0.583282 0.598719 0.611272 0.621577 0.630102 0.637200 0.643142 0.648137
 2.500000 0.478907 0.503853 0.523868 0.540183 0.553660 0.564919 0.574418 0.582501 0.589432 0.595414
 3.000000 0.482584 0.507322 0.527213 0.543460 0.556905 0.568154 0.577652 0.585735 0.592660 0.598627
 3.500000 0.498742 0.523470 0.543426 0.559812 0.573464 0.584982 0.594804 0.603261 0.610604 0.617026
 4.000000 0.469489 0.493470 0.512606 0.528107 0.540820 0.551354 0.560159 0.567572 0.573851 0.579198
 4.500000 0.466318 0.490720 0.510180 0.525934 0.538850 0.549549 0.558494 0.566030 0.572421 0.577874
 5.000000 0.479990 0.504897 0.524873 0.541152 0.554599 0.565838 0.575326 0.583405 0.590339 0.596332
 5.500000 0.461869 0.485713 0.504724 0.520117 0.532743 0.543212 0.551976 0.559373 0.565662 0.571043
 6.000000 0.478155 0.502141 0.521289 0.536812 0.549556 0.560132 0.568988 0.576462 0.582811 0.588237
 6.500000 0.507557 0.532648 0.552875 0.569451 0.583227 0.594811 0.604654 0.613090 0.620377 0.626714
 7.000000 0.554502 0.579496 0.599427 0.615548 0.628738 0.639634 0.648706 0.656309 0.662717 0.668141
 7.500000 0.558463 0.578592 0.594009 0.605986 0.615406 0.622896 0.628907 0.633771 0.637736 0.640988
 8.000000 0.612665 0.636664 0.655628 0.670802 0.683063 0.693046 0.701223 0.707951 0.713507 0.718108
 8.500000 0.573743 0.598406 0.618205 0.634354 0.647704 0.658866 0.668289 0.676312 0.683192 0.689130
 9.000000 0.611399 0.636454 0.656602 0.673060 0.686680 0.698080 0.707711 0.715915 0.722955 0.729035
 9.500000 0.622490 0.646971 0.666596 0.682579 0.695772 0.706785 0.716068 0.723960 0.730719 0.736545
 10.000000 0.663934 0.688441 0.708069 0.724037 0.737197 0.748166 0.757394 0.765224 0.771914 0.777668
 10.500000 0.629660 0.653821 0.673146 0.688847 0.701772 0.712529 0.721565 0.729218 0.735742 0.741340
 11.000000 0.637746 0.662878 0.683105 0.699652 0.713376 0.724892 0.734655 0.743005 0.750201 0.756446
 11.500000 0.545921 0.570157 0.589622 0.605508 0.618644 0.629630 0.638905 0.646800 0.653569 0.659409
 12.000000 0.572249 0.596823 0.616538 0.632612 0.645897 0.657007 0.666393 0.674394 0.681267 0.687215
 12.500000 0.587088 0.612005 0.632018 0.648345 0.661838 0.673113 0.682622 0.690706 0.697629 0.703592
 13.000000 0.539198 0.564947 0.585752 0.602836 0.617056 0.629030 0.639213 0.647951 0.655505 0.662082
 13.500000 0.560561 0.585325 0.605252 0.621547 0.635052 0.646374 0.655960 0.664147 0.671191 0.677293
 14.000000 0.563397 0.588729 0.609173 0.625942 0.639885 0.651615 0.661583 0.670129 0.677514 0.683941
 14.500000 0.553638 0.578825 0.599145 0.615799 0.629628 0.641236 0.651070 0.659466 0.666683 0.672921
 15.000000 0.598250 0.623243 0.643356 0.659793 0.673397 0.684777 0.694382 0.702551 0.709546 0.715570
 15.500000 0.615440 0.639029 0.657840 0.673084 0.685608 0.696020 0.704767 0.712186 0.718531 0.723999
 16.000000 0.637262 0.662009 0.681892 0.698125 0.711562 0.722813 0.732331 0.740456 0.747446 0.753504
 16.500000 0.704454 0.728377 0.747500 0.763036 0.775834 0.786504 0.795493 0.803137 0.809693 0.815358
 17.000000 0.691167 0.715255 0.734637 0.750489 0.763635 0.774666 0.784020 0.792024 0.798929 0.804931
 17.500000 0.727344 0.751145 0.770119 0.785476 0.798061 0.808486 0.817200 0.824540 0.830767 0.836080
 18.000000 0.721093 0.745870 0.765805 0.782102 0.795608 0.806929 0.816514 0.824701 0.831747 0.837854
 18.500000 0.698742 0.721192 0.738963 0.753253 0.764901 0.774507 0.782511 0.789242 0.794948 0.799823
 19.000000 0.665273 0.687665 0.705428 0.719763 0.731506 0.741252 0.749436 0.756382 0.762335 0.767480
 19.500000 0.620310 0.641349 0.657915 0.671203 0.682040 0.691010 0.698535 0.704925 0.710414 0.715176
 20.000000 0.568207 0.590601 0.608345 0.622647 0.634346 0.644044 0.652178 0.659074 0.664978 0.670078

real distances calculated by MD analysis:

0.549416

0.554333

0.558022

0.557384

0.539867

0.478907

0.482584

0.498742

0.469489

0.466318

0.47999

0.461869

0.478155

0.507557

0.554502

0.558463

0.612665

0.573743

0.611399

0.62249

0.663934

0.62966

0.637746

0.545921

0.572249

0.587088

0.539198

0.560561

0.563397

0.553638

0.59825

0.61544

0.637262

0.704454

0.691167

0.727344

0.721093

0.698742

0.665273

0.62031

0.568207



Best,
Rose

Gareth Tribello

unread,
Nov 1, 2021, 11:26:48 AM11/1/21
to plumed...@googlegroups.com
There are two ways to proceed.  

(1) Set BETA much larger — think 10.

Or

(2) Use LOWEST instead of MIN.  That will give you the shortest of the distances you are calculating.  There is a discontinuity in the derivatives when you use this method (which is why people have traditionally used the formula that is used with MIN).  This discontinuity  doesn’t really matter in the grand scheme of things.

I hope this helps
Gareth

--
You received this message because you are subscribed to the Google Groups "PLUMED users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plumed-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/plumed-users/610795c3-62e4-4875-a511-2704f9bcd6e1n%40googlegroups.com.

roja rahmani

unread,
Nov 1, 2021, 1:42:52 PM11/1/21
to PLUMED users
Hi,
 Thank you so much. Do you mean this?

# Append to existing files

#RESTART

# Flush open files
FLUSH STRIDE=500

# Include file with atom groups
PMMA:    GROUP NDX_FILE=index.ndx NDX_GROUP=PMMA
solute: GROUP NDX_FILE=index.ndx NDX_GROUP=ASP


# Center of mass of solute and the nearest atom on the surface
solute_COM: COM ATOMS=solute

# Minimum distance between Center of mass of solute and the nearest atom on the surface
d: DISTANCES GROUPA=solute_COM GROUPB=PMMA LOWEST
SSD: COMBINE ARG=d.lowest PERIODIC=NO



# Run metadynamics with grid and multiple walkers
METAD ...
ARG=SSD
SIGMA=0.05
HEIGHT=0.01
PACE=500
TEMP=300
GRID_MIN=-1
GRID_MAX=2
GRID_BIN=1000
GRID_WSTRIDE=100000
GRID_WFILE=GRID
FILE=HILLS
... METAD

# With an upper wall at 1.5 nm.
uwall: UPPER_WALLS ARG=SSD AT=1.5 KAPPA=400000.0 EXP=4 EPS=1.0 OFFSET=0



# Print results

##force: DUMPFORCES ARG=SSD FILE=FORCES
PRINT ARG=SSD STRIDE=250 FILE=COLVAR
DUMPFORCES STRIDE=250 ARG=SSD FILE=FORCES
----------------
And I didn't understand what do you mean by "discontinuity". I have one more question. So I have some data calculated by ALT_MIN. Is there any way to correct these distances calculated by AL distances to the dsddsfsT_MIN? and convert it to the LOWEST values. Is there any particular shift that I could use to convert and correct those wrong distances without running new calculation by LOWEST?

Best,
Roja

Gareth Tribello

unread,
Nov 1, 2021, 2:30:49 PM11/1/21
to plumed...@googlegroups.com
Hello again

That input is exactly what I mean.

Discontinuities are described here:


The issue here is at the point when the identity of the closest atom changes.  At that point one atom will  stop experiencing any force and another will start feeling the force.  In practise this is a not a real problem.  If the value of the CV changes discontinuously that is a big problem but it is only the derivatives that change discontinuously here so it doesn’t matter.

in answer to your final question the answer is no you cannot calculate recalculate the distances if you only have the value of the alt min.  What you are asking here is if you can calculate N unknowns from one equation. 

Good luck

Gareth 

roja rahmani

unread,
Nov 1, 2021, 2:46:21 PM11/1/21
to PLUMED users
So this will not change the PMF and the free energy value even though the distances are not correct? 

Roja

Gareth Tribello

unread,
Nov 1, 2021, 2:53:00 PM11/1/21
to plumed...@googlegroups.com
Well, the free energy surface will change if the CV you are using changes.  Not sure I understand the question.

Gareth

Reply all
Reply to author
Forward
0 new messages