2 minutes to read - Apr 12, 2023

Write a TCL script

A tcl script to load all PDB files in a folder, load on top of them their trajectory xtc files with the same name, show them as New Cartoon representation and wrap the trajectories around the protein selection using the pbc method

Here is a Tcl script that should do what you described:

Copy code

`# Set the path to the directory containing the PDB and XTC files set path "path/to/files" # Set the representation to be used for the PDB files representation newcartoon # Iterate over all PDB files in the directory foreach pdb_file [glob -nocomplain "$path/*.pdb"] { # Extract the base filename (without the extension) set base [file rootname $pdb_file] # Load the PDB file mol load pdb $pdb_file # Set the wrap method for the trajectories set wrap_method pbc # Iterate over all XTC files in the directory foreach xtc_file [glob -nocomplain "$path/$base*.xtc"] { # Load the XTC file animate add $xtc_file $wrap_method } }`

This script should work in the PyMOL terminal or in a PyMOL script.

I hope this helps! Let me know if you have any questions or if you need further assistance.

loading...