Re: [AMBER] Joining two molecules

From: Gustaf Olsson <>
Date: Wed, 26 May 2021 09:16:47 +0000

bond :1.CB,:1.C2

Is :1 the now joined molecule? Otherwise, should I provide the correct residue number :2.X,1.X

I run into this message:
   Error: 'bond' source mask does not select only 1 atom.

This is what I tried with some different variations regarding masks:

  set SUGFILE=sugar.pdb
  parm \$SUGFILE
  loadcrd \$SUGFILE parmindex 0 name SUG
  set SUBFILE=subst.pdb
  parm \$SUBFILE
  loadcrd \$SUBFILE parmindex 0 name SUB
  graft \
  tgt SUG \
  src SUB \
  name Final \
  srcfitmask @C5,O3,C1,N \
  tgtfitmask .C5,O5,C1,O1 \
  srcmask .1-5 \
  tgtmask !(.1-2) \
  bond :2.C1,:1.N \
  crdout Final Final.graft.mol2

I am “fitting” the structures based on the masks
I am then hopefully dropping everything but the O1 atom and attached H (!(@1-2)) from tgt leaving C1 as the “attachment point.
From src I only want to keep atoms 1-5, ending with 5 as N.
I then want to create a bond between C1 in tgt and N in src.

I tried

  bond :2.3,:1.4 \

Hoping that I am specifying exactly the two atoms I want to join though I still get stuck on the same error.

From what I can see from the example structures, this is what I am supposed to do. The only potential problem I can see is that the SUG file has a :1.C1 and :3.C1A, no duplicate atom names are present in either file.

I am probably missing some step here but I can’t find it and there seems to be no help message for bond.

Best regards
// Gustaf

> On 26 May 2021, at 09:48, Gustaf Olsson <> wrote:
> Hello Dan
> This sounds interesting and would remove some of the “manual labour” involved. I see the example uses mol2 format, I suppose this would help prepare the structure and take away some additional steps. I do however suspect, working with PDB files at leas for sure, still need to prepare the lib/prep files for the “parts” if I plan to adopt FF parameters for the “grafted” structure, correct?
> Nevertheless, I will definitively give this a go just because I am curious. It seems almost like what I attempted with Chimera. I used match and selection mask to “align” an “overlay” the intersect/overlap of the two models, deleted the “extra atoms” and saved each model as a single as well as separate PDB files.
> Thank you for the tip and the tool!
> Best regards
> // Gustaf
>> On 25 May 2021, at 15:38, Daniel Roe <> wrote:
>> Hi Gustaf,
>> There is a new (and still somewhat experimental) command in CPPTRAJ
>> called 'graft' that you may want to try. This command will align 2
>> molecules based on atoms you select, keep only atoms you specify, and
>> then create a bond between the two. The 'graft' test
>> ($AMBERHOME/AmberTools/src/cpptraj/test/Test_Graft or
>> $CPPTRAJHOME/test/Test_Graft) has an example of a prenylated tyrosine
>> sidechain being fit onto a tyrosine with a.a. backbone. I'll reproduce
>> the input here:
>> set TYRFILE = ../Test_CombineCrd/Tyr.mol2
>> # Load the target
>> parm \$TYRFILE
>> loadcrd \$TYRFILE parmindex 0 name TYR
>> # Load the source
>> set PRYFILE= ../Test_CombineCrd/PRY-gauss-fragment.mol2
>> parm \$PRYFILE
>> loadcrd \$PRYFILE parmindex 1 name PRY
>> graft \
>> tgt TYR \
>> src PRY \
>> name Final \
>> srcfitmask .O1,C5,C6,C4,H6,H5,C7,C3,H7,H4,C2 \
>> tgtfitmask .OH,CZ,CE1,CE2,HE1,HE2,CD1,CD2,HD1,HD2,CG \
>> srcmask !(.1-4) \
>> tgtmask .C,O,CA,HA,N,H,CB,HB2,HB3 \
>> bond :1.CB,:1.C2
>> crdout Final Final.graft.mol2
>> The 'srcfitmask' are the atoms in 'src' to fit on, and 'tgtfitmask'
>> are the atoms in 'tgt' to fit on. Like 'rms', these masks should
>> specify the same number of atoms in the same order, minimum 3 atoms in
>> order to properly best-fit.
>> The 'srcmask' and 'tgtmask' keywords specify which atoms to keep in
>> 'src' and 'tgt' respectively after the fitting is performed.
>> The 'bond' keyword specifies a bond (via 2 comma separated masks) that
>> should be created between 'src' and 'tgt' after fitting and stripping.
>> Each mask is with respect to the original 'src' and 'tgt' structures.
>> After the 'graft' command you should make sure you write out the
>> resulting coordinates with a 'crdout' command.
>> If you give it a try, I'd be interested in any feedback you have. Good luck!
>> -Dan
>> On Tue, May 25, 2021 at 6:19 AM Gustaf Olsson <> wrote:
>>> I’ve been looking at the tutorials and some other material for a while now and I cannot figure out how I have ever managed to proceed past the step where structures are supposed to be joined.
>>> I’m trying to use to different FFs for 2 parts of 1 larger molecule (gaff and glycam), the idea here was to align an NH2 group of a substituent with a OH group on a carbohydrate. I deleted the “overlapping” atoms leaving the two molecules reasonably oriented with a R-(C=O)-NH- -C gap. The plan is to connect/bond N-C and then use frcmod to adapt reasonable parameters for the “amide” group from glycam.
>>> However, trying to keep the connect record, or renumbering the connect records in the joined file, breaks it. Fatal error in leap and refusing to open in any other application. in order to use the file I had to remove the connect records.
>>> Now, I thought I’d be able to use leap to figure out what parameters for the N-C bond I need to add. Opening the joint PDB file with the prep/frcmod and glycam in leap, “missing atoms” are added from residue template(s). This is not really what I want to happen as I cannot “bond” the N-C atoms and I now have overlapping atoms. I also loose a ring C3-C4 bond in the carbohydrate when I remove the connect record.
>>> Either I am missing some step of which I am unaware or I am approaching this in a completely flawed way. Can I load my joint PDB file, ignoring missing atoms in residue template and then joint them to form a molecule to figure out what parameters I am missing with leap, or should I investigate a different approach?
>>> Best regards
>>> // Gustaf
>>> _______________________________________________
>>> AMBER mailing list
>> _______________________________________________
>> AMBER mailing list
> _______________________________________________
> AMBER mailing list

AMBER mailing list
Received on Wed May 26 2021 - 02:30:02 PDT
Custom Search