Re: colvars selecting frames

From: Jérôme Hénin (jerome.henin_at_ibpc.fr)
Date: Thu Feb 01 2018 - 10:42:17 CST

Thinking about it, this could be a very simple feature to implement in
CatDCD as well. If someone wants a quick little software project, it can be
a feature request for CatDCD.

Another option, certainly slower than Wordom, but working with any size of
trajectory: write each frame separately as a 1-frame numbered DCD file,
then cat everything with CatDCD. Ugly? Yes. Slow? You bet! Does the job? I
think so.

Jerome

On 1 February 2018 at 17:21, Florian Blanc <blanc.flori_at_gmail.com> wrote:

> Dear all,
>
> I am not sure if I understand Stefano's problem, but the Wordom tool
> provides a single command line to perform extraction of a user-defined
> series of frames to a single dcd. After downloading and installing wordom (
> http://wordom.sourceforge.net/), write the list of desired frame numbers
> in a text file (e.g. framelist.txt) and use the following command:
>
> wordom -F framelist.txt -imol my_system.pdb -itrj my_traj.dcd -otrj
> my_output_traj.dcd
>
> I use this function on a regular basis and it is usually significantly
> faster than VMD to process trajectory files.
>
> Hope that helps,
>
> Florian
>
> On 02/01/2018 05:03 PM, Giacomo Fiorin wrote:
>
> Hi Stefano, a line-by-line review of code from the mailing list would be
> impractical.
>
> If your trajectory fits all in the memory of VMD I would go with Jérôme's
> suggestion, which is the most convenient in any case where you want to
> extract some frames from the trajectory based on some quantity (e.g. not
> just a collective variable).
>
> If you have a GROMACS installation available, have a look at the -drop
> flag of gmx trjconv, which can filter an existing trajectory based on the
> value of a quantity read from a corresponding .xvg file. The .xvg file
> doesn't have to have Xmgrace formatting headers, it can be a plain text
> file: GROMACS only needs the .xvg extension so that it can rely on a
> standardized file extension for text files with data. You can manipulate
> the .colvars.traj file written by NAMD if it has the same frequency as the
> DCD file, or just change your script to write that file.
>
> There was a way in the past to load VMD/molfile plugins in trjconv and
> load DCD files directly, but I haven't found documentation for it in recent
> GROMACS versions. In the worst case scenario, just convert your
> trajectories to .trr with VMD before running them through GROMACS.
>
> Giacomo
>
>
> On Thu, Feb 1, 2018 at 7:32 AM, Jérôme Hénin <jerome.henin_at_ibpc.fr> wrote:
>
>> true, i's probably not trivial to write out a custom selection of frames
>> to a file. The easiest I can think of is to go through all the frames
>> backwards from the end, and delete those you don't want. Then write those
>> that are left. The point of starting from the end is that the frame numbers
>> don't change when you delete later frames.
>>
>> Jerome
>>
>> On 1 February 2018 at 13:06, Stefano Guglielmo <
>> stefano.guglielmo_at_unito.it> wrote:
>>
>>> Jerome, thanks for hint.
>>> I must say that I'm far from being expert in scripting; I tried the
>>> following one, but it just write one frame in the output dcd file. Is
>>> somebody that patient to provide some more suggestions?
>>>
>>> Thanks in advance
>>> Stefano
>>>
>>> package require bigdcd
>>> proc metadynamics_colvars { frame } {
>>> global all
>>> if {$frame == 1} {
>>> cv molid 0
>>> cv configfile colvar4.txt
>>> cv load cdk_8bS_cv4_replica1_250.restart
>>> }
>>> cv update
>>> set energy [cv bias metadynamics1 energy]
>>> set dist [cv colvar Dist value]
>>> set sel [atomselect top all]
>>> set n [molinfo top get numframes]
>>> #set ang [cv colvar angle value]
>>> if { $dist > 15 } {
>>> if { $energy > 8 } {
>>> for { set i 0 } { $i < $n } { incr i } {
>>> $sel frame $i
>>> $sel update
>>> animate write dcd cdk2_8bS_min.dcd $sel
>>> }
>>> }
>>> }
>>> }
>>> set mol [mol new cdk2_8bS_pocket_wb_ion.psf type psf waitfor all]
>>> set all [atomselect $mol all]
>>> $all global
>>> bigdcd metadynamics_colvars auto cdk_8bS_cv4_210.dcd
>>> bigdcd_wait
>>> quit
>>>
>>> 2018-01-31 10:22 GMT+01:00 Jérôme Hénin <jerome.henin_at_ibpc.fr>:
>>>
>>>> Dear Stefano,
>>>>
>>>> You can do that with a VMD script using the colvars interface.
>>>>
>>>> Best,
>>>> Jerome
>>>>
>>>> On 31 January 2018 at 02:37, Stefano Guglielmo <
>>>> stefano.guglielmo_at_unito.it> wrote:
>>>>
>>>>> Dear all,
>>>>> I was wondering if it is possible to select and ouput/save frames
>>>>> having collective variable values in a user defined range (or in
>>>>> alternative metadynamics energy value) out of a metadynamics trajectory
>>>>> obtained with the colvars module in NAMD.
>>>>> Thanks in advance
>>>>> Stefano
>>>>>
>>>>> --
>>>>> Stefano GUGLIELMO PhD
>>>>> Assistant Professor of Medicinal Chemistry
>>>>> Department of Drug Science and Technology
>>>>> Via P. Giuria 9
>>>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__maps.google.com_-3Fq-3DVia-2BP.-2BGiuria-2B9-2B10125-2BTurin-2C-2BITALY-2Bph.-2B-252B39-26entry-3Dgmail-26source-3Dg&d=DwMFaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=jUfnSyKkfkyVRBIUzlG1GSGGZAZGcznwr8YliSSCjPc&m=c-AT7vCwTf0NHLjMmJZpSRY91EWDj9NEY7NMltNYPQY&s=3E7jptP47i1qtTQkeE8C5EEXHEj7ERp7-fQviSYguB4&e=>
>>>>> 10125 Turin, ITALY
>>>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__maps.google.com_-3Fq-3DVia-2BP.-2BGiuria-2B9-2B10125-2BTurin-2C-2BITALY-2Bph.-2B-252B39-26entry-3Dgmail-26source-3Dg&d=DwMFaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=jUfnSyKkfkyVRBIUzlG1GSGGZAZGcznwr8YliSSCjPc&m=c-AT7vCwTf0NHLjMmJZpSRY91EWDj9NEY7NMltNYPQY&s=3E7jptP47i1qtTQkeE8C5EEXHEj7ERp7-fQviSYguB4&e=>
>>>>> ph. +39
>>>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__maps.google.com_-3Fq-3DVia-2BP.-2BGiuria-2B9-2B10125-2BTurin-2C-2BITALY-2Bph.-2B-252B39-26entry-3Dgmail-26source-3Dg&d=DwMFaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=jUfnSyKkfkyVRBIUzlG1GSGGZAZGcznwr8YliSSCjPc&m=c-AT7vCwTf0NHLjMmJZpSRY91EWDj9NEY7NMltNYPQY&s=3E7jptP47i1qtTQkeE8C5EEXHEj7ERp7-fQviSYguB4&e=>
>>>>> (0)11 6707178
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> Stefano GUGLIELMO PhD
>>> Assistant Professor of Medicinal Chemistry
>>> Department of Drug Science and Technology
>>> Via P. Giuria 9
>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__maps.google.com_-3Fq-3DVia-2BP.-2BGiuria-2B9-2B10125-2BTurin-2C-2BITALY-2B-253Chttps-3A__maps.google.com_-3Fq-253DVia-252BP.-252BGiuria-252B9-252B10125-252BTurin-2C-252BITALY-252Bph.-252B-25252B39-2526entry-253Dgmail-2526source-253Dg-253E-2Bph.-2B-252B39-2B-253Chttps-3A__maps.google.com_-3Fq-253DVia-252BP.-252BGiuria-252B9-252B10125-252BTurin-2C-252BITALY-252Bph.-252B-25252B39-2526entry-253Dgmail-2526source-253Dg-253E-26entry-3Dgmail-26source-3Dg&d=DwMFaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=jUfnSyKkfkyVRBIUzlG1GSGGZAZGcznwr8YliSSCjPc&m=c-AT7vCwTf0NHLjMmJZpSRY91EWDj9NEY7NMltNYPQY&s=r-5fHj6nN4lIE6CW6U-pIO8uW0Ffi9bCs1Nyl4qZOfg&e=>
>>> 10125 Turin, ITALY
>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__maps.google.com_-3Fq-3DVia-2BP.-2BGiuria-2B9-2B10125-2BTurin-2C-2BITALY-2B-253Chttps-3A__maps.google.com_-3Fq-253DVia-252BP.-252BGiuria-252B9-252B10125-252BTurin-2C-252BITALY-252Bph.-252B-25252B39-2526entry-253Dgmail-2526source-253Dg-253E-2Bph.-2B-252B39-2B-253Chttps-3A__maps.google.com_-3Fq-253DVia-252BP.-252BGiuria-252B9-252B10125-252BTurin-2C-252BITALY-252Bph.-252B-25252B39-2526entry-253Dgmail-2526source-253Dg-253E-26entry-3Dgmail-26source-3Dg&d=DwMFaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=jUfnSyKkfkyVRBIUzlG1GSGGZAZGcznwr8YliSSCjPc&m=c-AT7vCwTf0NHLjMmJZpSRY91EWDj9NEY7NMltNYPQY&s=r-5fHj6nN4lIE6CW6U-pIO8uW0Ffi9bCs1Nyl4qZOfg&e=>
>>> ph. +39
>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__maps.google.com_-3Fq-3DVia-2BP.-2BGiuria-2B9-2B10125-2BTurin-2C-2BITALY-2B-253Chttps-3A__maps.google.com_-3Fq-253DVia-252BP.-252BGiuria-252B9-252B10125-252BTurin-2C-252BITALY-252Bph.-252B-25252B39-2526entry-253Dgmail-2526source-253Dg-253E-2Bph.-2B-252B39-2B-253Chttps-3A__maps.google.com_-3Fq-253DVia-252BP.-252BGiuria-252B9-252B10125-252BTurin-2C-252BITALY-252Bph.-252B-25252B39-2526entry-253Dgmail-2526source-253Dg-253E-26entry-3Dgmail-26source-3Dg&d=DwMFaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=jUfnSyKkfkyVRBIUzlG1GSGGZAZGcznwr8YliSSCjPc&m=c-AT7vCwTf0NHLjMmJZpSRY91EWDj9NEY7NMltNYPQY&s=r-5fHj6nN4lIE6CW6U-pIO8uW0Ffi9bCs1Nyl4qZOfg&e=>
>>> (0)11 6707178
>>>
>>>
>>
>
>
> --
> Giacomo Fiorin
> Associate Professor of Research, Temple University, Philadelphia, PA
> Contractor, National Institutes of Health, Bethesda, MD
> http://goo.gl/Q3TBQU
> https://github.com/giacomofiorin
>
>
>

This archive was generated by hypermail 2.1.6 : Mon Dec 31 2018 - 23:20:49 CST