Author: bugman
Date: Thu Jan 22 14:36:04 2009
New Revision: 8585
URL: http://svn.gna.org/viewcvs/relax?rev=8585&view=rev
Log:
Modified load_spins() to handle spin systems with the molecule unnamed.
If loading spins from a PDB file is used but the sequence already loaded
(without the molecule ID
string), the molecule ID is now set instead of a new molecule container created.
Modified:
branches/multi_structure/generic_fns/structure/main.py
Modified: branches/multi_structure/generic_fns/structure/main.py
URL:
http://svn.gna.org/viewcvs/relax/branches/multi_structure/generic_fns/structure/main.py?rev=8585&r1=8584&r2=8585&view=diff
==============================================================================
--- branches/multi_structure/generic_fns/structure/main.py (original)
+++ branches/multi_structure/generic_fns/structure/main.py Thu Jan 22 14:36:04
2009
@@ -97,6 +97,7 @@
id = ''
# Get the molecule container corresponding to the molecule name.
+ mol_cont = None
if mol_name:
# Update the ID string.
id = id + '#' + mol_name
@@ -104,17 +105,28 @@
# The container.
mol_cont = return_molecule(id)
- # Get the unnamed molecule, assuming there is only one.
- else:
- mol_cont = return_molecule()
-
# Add the molecule if it doesn't exist.
if mol_cont == None:
- # Add the molecule.
- cdp.mol.add_item(mol_name=mol_name)
-
- # Get the container.
- mol_cont = cdp.mol[-1]
+ # Get the unnamed molecule, assuming there is only one.
+ mol_cont = return_molecule()
+
+ # Got something!
+ if mol_cont != None:
+ # Rename the molecule container if the mol name is given and
the sole container is unnamed.
+ if mol_cont.name == None and mol_name:
+ # Print out.
+ print "Renaming the unnamed sole molecule to '%s'." %
mol_name
+
+ # Set the name.
+ mol_cont.name = mol_name
+
+ # Nothing exists yet.
+ else:
+ # Add the molecule.
+ cdp.mol.add_item(mol_name=mol_name)
+
+ # Get the container.
+ mol_cont = cdp.mol[-1]
# Add the residue number to the ID string (residue name is ignored
because only the number is unique).
id = id + ':' + `res_num`
_______________________________________________
relax (http://nmr-relax.com)
This is the relax-commits mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits