Added label writing capability to editconf when used with an index file
authorErik Lindahl <lindahl@cbr.su.se>
Tue, 31 Aug 2010 08:29:56 +0000 (10:29 +0200)
committerErik Lindahl <lindahl@cbr.su.se>
Tue, 31 Aug 2010 08:29:56 +0000 (10:29 +0200)
src/tools/gmx_editconf.c

index 1091957047e8d4a2cb37382c0c8d639f6805a026..d0088ed036d4a17c2d0ded1cda53c1f898272798 100644 (file)
@@ -1038,17 +1038,25 @@ int gmx_editconf(int argc, char *argv[])
         fprintf(stderr,"\nSelect a group for output:\n");
         get_index(&atoms,opt2fn_null("-n",NFILE,fnm),
                   1,&isize,&index,&grpname);
-        if (opt2bSet("-bf",NFILE,fnm))
-            gmx_fatal(FARGS,"combination not implemented: -bf -n  or -bf -ndef");
-        else {
-            if (outftp == efPDB) {
-                out=ffopen(outfile,"w");
-                write_pdbfile_indexed(out,title,&atoms,x,ePBC,box,' ',1,isize,index,conect,TRUE);
-                ffclose(out);
-            }
-            else
-                write_sto_conf_indexed(outfile,title,&atoms,x,bHaveV?v:NULL,ePBC,box,
-                    isize,index); 
+        if (opt2parg_bSet("-label",NPA,pa)) {
+            for(i=0; (i<atoms.nr); i++) 
+                atoms.resinfo[atoms.atom[i].resind].chainid=label[0];
+        }
+                
+        if (opt2bSet("-bf",NFILE,fnm) || bLegend)
+        {
+            gmx_fatal(FARGS,"Sorry, cannot do bfactors with an index group.");
+        }
+
+        if (outftp == efPDB) 
+        {
+            out=ffopen(outfile,"w");
+            write_pdbfile_indexed(out,title,&atoms,x,ePBC,box,' ',1,isize,index,conect,TRUE);
+            ffclose(out);
+        }
+        else
+        {
+            write_sto_conf_indexed(outfile,title,&atoms,x,bHaveV?v:NULL,ePBC,box,isize,index); 
         }
     }
     else {