Difference between revisions of "Create"

From PyMOLWiki
Jump to navigation Jump to search
(remove deprecated syntax)
 
Line 1: Line 1:
 
'''create''' creates a new molecule object from a selection.  It can also be used to create states in an existing object.
 
'''create''' creates a new molecule object from a selection.  It can also be used to create states in an existing object.
'''NOTE''': this command has not yet been throughly tested.
 
  
 
===USAGE===
 
===USAGE===
 
<source lang="python">
 
<source lang="python">
create name, (selection) [,source_state [,target_state ] ]
+
create name, (selection) [, source_state [, target_state ]]
create name = (selection) [,source_state [,target_state ] ]    # (DEPRECATED)
 
 
</source>
 
</source>
  
Line 11: Line 9:
 
* selection = atoms to include in the new object
 
* selection = atoms to include in the new object
 
* source_state (default: 0 - copy all states)
 
* source_state (default: 0 - copy all states)
* target_state (default: 0)
+
* target_state = int: -1 appends after last state {default: 0}
  
 
===PYMOL API===
 
===PYMOL API===
Line 20: Line 18:
 
===NOTES===
 
===NOTES===
 
If the source and target states are zero (default), all states will be copied.  Otherwise, only the indicated states will be copied.
 
If the source and target states are zero (default), all states will be copied.  Otherwise, only the indicated states will be copied.
 +
 +
Target state -1 will append new states.
  
 
=== User Comments/Examples ===
 
=== User Comments/Examples ===

Latest revision as of 08:32, 17 April 2019

create creates a new molecule object from a selection. It can also be used to create states in an existing object.

USAGE

create name, (selection) [, source_state [, target_state ]]
  • name = object to create (or modify)
  • selection = atoms to include in the new object
  • source_state (default: 0 - copy all states)
  • target_state = int: -1 appends after last state {default: 0}

PYMOL API

cmd.create(string name, string selection, int source_state, int target_state,int discrete)

NOTES

If the source and target states are zero (default), all states will be copied. Otherwise, only the indicated states will be copied.

Target state -1 will append new states.

User Comments/Examples

EXAMPLES

# merging two multi-state objects with the create command
# obj1 has 25 states and obj2 has 40 states 

load multi_state_obj1, obj1
load multi_state_obj2, obj2

# merge the two multi-state objects back to back into obj3
# 0 indicates every states from obj1 should be included
# 1 indicates that the first state of obj3 is the first state from obj1 etc.

create obj3, obj1, 0, 1

# as obj1 has 25 states, the first state of obj2 must be state 26 to create a multi-state object of obj1 and obj2 back-to-back 
# 26 indicates that the 26th state of obj3 is state nr. 1 of obj2 etc. 

create obj3, obj2, 0, 26

# Obj3 now has 65 states (25 from obj1 and 40 from obj2)
# save obj3 as a multi-state pdb file
# use state=0 to get all states into one pdb file

save obj3.pdb, obj3, state=0

SEE ALSO

Fuse, load, copy, Extract