Re: [AMBER] Scripting Bash to tleap

From: Wesley Michael Botello-Smith <wmsmith.uci.edu>
Date: Mon, 20 Aug 2018 05:48:50 -0700

I just notice, you use:
---
 source leaprc.gaff
 source leaprc.ff14SB
 source leaprc.tip3p
 gaff=loadamberparams gaff.dat
 LIG=loadmol2 $NAME.mol2
 loadamberparams $NAME.frcmod
 saveoff LIG $NAMEL.lib
 complex=loadpdb $NAME.pdb
 solvatebox complex TIP3PBOX 8.0
 loadamberparams frcmod.ionsjc_tip3p
 addIons2 complex Na+ 0
 addIons2 complex Cl- 0
 saveamberparm complex $NAME.prmtop $NAME.crd
quit
---
The '$NAME' will be incorrect, you need to wrap it in braces.
E.g. if you write $NAME.pdb bash will think that '.pdb' is part of the
variable names, you need to use
${NAME}.pdb instead so bash knows to look for the 'NAME' variable instead
of 'NAME.pdb'
The same goes for other uses. E.g.
tleap <<- EOF
source leaprc.gaff
 source leaprc.ff14SB
 source leaprc.tip3p
 gaff=loadamberparams gaff.dat
 LIG=loadmol2 ${NAME}.mol2
 loadamberparams ${NAME}.frcmod
 saveoff LIG ${NAME}.lib
 complex=loadpdb ${NAME}.pdb
 solvatebox complex TIP3PBOX 8.0
 loadamberparams frcmod.ionsjc_tip3p
 addIons2 complex Na+ 0
 addIons2 complex Cl- 0
 saveamberparm complex ${NAME}.prmtop ${NAME}.crd
 quit
EOF
On Mon, Aug 20, 2018 at 5:45 AM, Wesley Michael Botello-Smith <
wmsmith.uci.edu> wrote:
> so you could use:
> ---
> Script 1
> antechamber/parmchk commands (just not typing out in full to save space)
> NAME=$1
> export NAME
> tleap <<- EOF
>  source leaprc.gaff
>  source leaprc.ff14SB
>  source leaprc.tip3p
>  gaff=loadamberparams gaff.dat
>  LIG=loadmol2 $NAME.mol2
>  loadamberparams $NAME.frcmod
>  saveoff LIG $NAMEL.lib
>  complex=loadpdb $NAME.pdb
>  solvatebox complex TIP3PBOX 8.0
>  loadamberparams frcmod.ionsjc_tip3p
>  addIons2 complex Na+ 0
>  addIons2 complex Cl- 0
>  saveamberparm complex $NAME.prmtop $NAME.crd
> quit
> EOF
> export NAME
> export GPU
> ./Script 3
> ---
>
> This way the '$NAME' will get expanded whereas if you feed in a file with
> the '-f' flag, it will not.
> ---
> alternatively, you could use:
> cat <<- EOF > script2
>  source leaprc.gaff
>  source leaprc.ff14SB
>  source leaprc.tip3p
>  gaff=loadamberparams gaff.dat
>  LIG=loadmol2 $NAME.mol2
>  loadamberparams $NAME.frcmod
>  saveoff LIG $NAMEL.lib
>  complex=loadpdb $NAME.pdb
>  solvatebox complex TIP3PBOX 8.0
>  loadamberparams frcmod.ionsjc_tip3p
>  addIons2 complex Na+ 0
>  addIons2 complex Cl- 0
>  saveamberparm complex $NAME.prmtop $NAME.crd
>  quit
> EOF
> tleap -f script2
> ---
>
> This second form will write script 2 on the fly then feed it to tleap.
>
> Hope that helps.
>
>
> On Mon, Aug 20, 2018 at 2:39 AM, Keiran Corbett <keirancorbett.gmail.com>
> wrote:
>
>> *Summary*
>> *(The script runs fine if I manually input the names but obviously would
>> rather not do that each time. *
>> *1. I cannot get my variables to transfer across from the bash line into
>> tleap*
>> *2. I cant get script 3 to run after doing the tleap caculation *
>>
>> So I want to run some files through tleap
>> I generate the input using antechamber then parmchk
>> Then I open up a new script in tleap (But want the variables $1 etc. to
>> come with it)
>> I then try to open a 3rd script but it doesnt let me
>> To run I type ./Script1 $1  (Where $1 is a name like 2XHX)
>> Script 1
>> antechamber/parmchk commands (just not typing out in full to save space)
>> NAME=$1
>> export NAME
>> tleap -f Script 2
>> Script 2
>> #!/bin/bash
>> source leaprc.gaff
>> source leaprc.ff14SB
>> source leaprc.tip3p
>> gaff=loadamberparams gaff.dat
>> LIG=loadmol2 $NAMEL.mol2
>> loadamberparams $NAMEL.frcmod
>> saveoff LIG $NAMEL.lib
>> complex=loadpdb $NAME.pdb
>> solvatebox complex TIP3PBOX 8.0
>> loadamberparams frcmod.ionsjc_tip3p
>> addIons2 complex Na+ 0
>> addIons2 complex Cl- 0
>> saveamberparm complex $NAME.prmtop $NAME.crd
>> quit
>> export NAME
>> export GPU
>> ./Script 3
>> Script 3 is a set of bashline commands to run CUDA
>>
>> *So to summaries*
>> *(The script runs fine if I manually input the names but obviously would
>> rather not do that each time)*
>>
>> *1. I cannot get my variables to transfer across from the bash line into
>> tleap*
>> *2. I cant get script 3 to run after doing the tleap caculations.*
>>
>> Just a side note I am aware that I am running some older versions of
>> things
>> and I am trying to get that updated but it is going to take some time.
>> _______________________________________________
>> AMBER mailing list
>> AMBER.ambermd.org
>> http://lists.ambermd.org/mailman/listinfo/amber
>>
>
>
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Mon Aug 20 2018 - 06:00:08 PDT
Custom Search