[gmx-users] Bash scripting and Gromacs
Kutzner, Carsten
ckutzne at gwdg.de
Tue Apr 26 16:35:52 CEST 2016
> On 26 Apr 2016, at 15:33, James Starlight <jmsstarlight at gmail.com> wrote:
>
> No, in my case it recognize ? like a ?
>
> in script I have
>
> for sim in ${HOME}/${tit}* ; do
> if [[ -d $sim ]]; then
> simulation=$(basename "$sim")
> cd ${sim}
> rm dd_dump_err*.pdb
> trjconv -s md_${tit}?.tpr -f md_${tit}?.trr -o
> ${HOME}/output/${simulation}.xtc -n -pbc mol -ur compact -fit trans <
> ${HOME}/enter.txt
>
> and gromacs sent
>
> trjconv -s md_resp_complex?.tpr -f md_resp_complex?.trr -o
> /nfs_homes/clouddyn/MD_bench/Resp_cyt_cluster/output/resp_complex_conf7.xtc
> -n -pbc mol -ur compact -fit trans
>
>
> Is it possible specify more flexible e.g 1 of any character or 2 of
> any characters within the file name etc like REGEX syntax
http://www.tldp.org/LDP/Bash-Beginners-Guide/html/sect_04_01.html
Good luck :)
Carsten
>
> Thanks!
>
> J.
>
> 2016-04-26 12:45 GMT+02:00 Kutzner, Carsten <ckutzne at gwdg.de>:
>>
>>> On 26 Apr 2016, at 11:22, James Starlight <jmsstarlight at gmail.com> wrote:
>>>
>>> Exactly the problem was there!
>>>
>>> BTW how to define selection more carefully (avoiding using *) tpr and
>>> trr to be sure that always only 1 file is selected assuming that all
>>> relevant trajectories and topologies are differs only on the digit e.g
>>>
>>> resp_complex_conf7/md_resp_complex_conf7.tpr
>>> resp_complex_conf7/md_resp_complex_conf6.tpr
>>> ..
>>> resp_complex_conf7/md_resp_complex_conf1.tpr
>> For a single-character wildcard you can use a '?',
>> e.g.
>>
>>> resp_complex_conf7/md_resp_complex_conf?.tpr
>>
>>
>> Carsten
>>
>>
>>>
>>> the same for trr
>>>
>>> J.
>>>
>>> 2016-04-26 11:11 GMT+02:00 Kutzner, Carsten <ckutzne at gwdg.de>:
>>>>
>>>>> On 26 Apr 2016, at 11:00, James Starlight <jmsstarlight at gmail.com> wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> I faced with the folliwing problem:
>>>>>
>>>>> I try to make small script which will loop several folders
>>>>> corresponded to the invididual simulations and procecc each trajectory
>>>>> searching them by the keyword
>>>>> trr_file="md_resp_complex_conf"
>>>>>
>>>>>
>>>>> #!/bin/bash
>>>>>
>>>>> HOME="/nfs_homes/clouddyn/MD_bench/Resp_cyt_cluster"
>>>>> trr_file="md_resp_complex_conf"
>>>>> tit="resp_complex"
>>>>>
>>>>> rm -r ${HOME}/output
>>>>> mkdir ${HOME}/output
>>>>> source /prog/gm502/bin/GMXRC
>>>>>
>>>>> for sim in ${HOME}/${tit}* ; do
>>>>> if [[ -d $sim ]]; then
>>>>> simulation=$(basename "$sim")
>>>>> pushd ${sim}
>>>>> rm dd_dump_err*.pdb
>>>>> trjconv -s ${HOME}/ref.gro -f ${trr_file}*.trr -o
>>>> if there are several files that match your ${trr_file}* pattern, then
>>>> bash will give you all of those. Try leaving away the *
>>>> or delete the other .trr files in that dir to make get only
>>>> one file there.
>>>>
>>>> Carsten
>>>>
>>>>> ${HOME}/output/${simulation}.xtc -n
>>>>> popd
>>>>> fi
>>>>> done
>>>>>
>>>>>
>>>>>
>>>>> finally I ontained
>>>>>
>>>>> trjconv -s /nfs_homes/clouddyn/MD_bench/Resp_cyt_cluster/ref.gro -f
>>>>> md_resp_complex_conf7_go.trr md_resp_complex_conf7.trr -o
>>>>> /nfs_homes/clouddyn/MD_bench/Resp_cyt_cluster/output/resp_complex_conf7.xtc
>>>>> -n -pbc nojump -ur compact -fit trans
>>>>>
>>>>>
>>>>> here you see that the problem that the trajectory is repeated twisely
>>>>> after -f which is the source of the error:
>>>>>
>>>>> -f md_resp_complex_conf7_go.trr md_resp_complex_conf7.trr
>>>>>
>>>>> Why this issue occures? As you see in my scriopt I defined all proprly
>>>>>
>>>>> trjconv -s ${HOME}/ref.gro -f ${trr_file}*.trr -o
>>>>> ${HOME}/output/${simulation}.xtc -n
>>>>>
>>>>>
>>>>> Thanks!
>>>>>
>>>>> J,
>>>>> --
>>>>> Gromacs Users mailing list
>>>>>
>>>>> * Please search the archive at http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before posting!
>>>>>
>>>>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>>>>>
>>>>> * For (un)subscribe requests visit
>>>>> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or send a mail to gmx-users-request at gromacs.org.
>>>>
>>>> --
>>>> Gromacs Users mailing list
>>>>
>>>> * Please search the archive at http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before posting!
>>>>
>>>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>>>>
>>>> * For (un)subscribe requests visit
>>>> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or send a mail to gmx-users-request at gromacs.org.
>>> --
>>> Gromacs Users mailing list
>>>
>>> * Please search the archive at http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before posting!
>>>
>>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>>>
>>> * For (un)subscribe requests visit
>>> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or send a mail to gmx-users-request at gromacs.org.
>>
>> --
>> Gromacs Users mailing list
>>
>> * Please search the archive at http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before posting!
>>
>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>>
>> * For (un)subscribe requests visit
>> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or send a mail to gmx-users-request at gromacs.org.
> --
> Gromacs Users mailing list
>
> * Please search the archive at http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or send a mail to gmx-users-request at gromacs.org.
More information about the gromacs.org_gmx-users
mailing list