RE: Using harmonic walls on water molecules

From: Vermaas, Joshua (Joshua.Vermaas_at_nrel.gov)
Date: Mon Feb 04 2019 - 19:50:52 CST

Hi Moises,

The pre-colvars way of doing this should still work. TclBC is the one that springs to mind first. Below implements something close to what you intended.

tclBC on
tclBCScript {
        proc calcforces {step unique K} {
                if { $step % 20 == 0 } {
                        cleardrops
                }
                while { [nextatom] } {
                        #Drop things outside of a serial list
                        if { [getid] < 179210 || [getid] > 224830 } {
                                dropatom
                                continue
                        }
                        set pos [getcoord]
                        set z [lindex $pos 2]
                        if { $z < 46 && $z > -36 } {
                                dropatom
                                continue
                        }
                        if { $z > 47 } {
                                addenergy [expr {$K * ($z-47) * ($z-47)}]
                                addforce [vecscale [list 0 0 -1] [expr 2.*$K*($z-47)]]
                        } elseif { $z < -38 } {
                                addenergy [expr {$K * ($z+38) * ($z+38)}]
                                addforce [vecscale [list 0 0 -1] [expr 2.*$K*($z+38)]]
                        }
                }
        }
}
tclBCArgs {5}
The downside here is that the forces applied are not relative to the rest of your system, but rather in the laboratory/simulation coordinates reference frame, so you'd need to do something to fix the protein orientation within the simulation cell.

-Josh

On 2019-02-04 18:20:16-07:00 owner-namd-l_at_ks.uiuc.edu wrote:

Hi All,
I am trying to confine a large amount of water molecules within an annulus of a protein which is in a vacuum.
The water molecules escape along the z-directions.
I have tried to accomplish this by defining harmonic walls using the collective variables modules.
My first attempt involved defining all waters as a single collective variable:
colvarsTrajFrequency 100
colvar {
        name water
        lowerboundary -39.0
        upperboundary 48.0
        lowerWallConstant 5.0
        lowerWall -38.0
        upperWall 47.0
        upperWallConstant 5.0
distanceZ {
                main { atomNumbersRange 179209-224829 }
                ref { atomNumbersRange 224830-316341 }
                axis { (0.0 , 0.0 , 1.0) }
}
}
The waters still escaped.
My second attempt involved selecting each of the ~15,000 waters as an individual collective variable; however, this will take a long time to initialize the simulation.
What is smarter way to go about this? Thanks!

--
Moises Romero
PhD Student
Andricioaei Group
UC Irvine

This archive was generated by hypermail 2.1.6 : Thu Dec 31 2020 - 23:17:10 CST