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.