jewettaij / moltemplate

A general cross-platform tool for preparing simulations of molecules and complex molecular assemblies
http://www.moltemplate.org
MIT License
244 stars 95 forks source link

Specifying Geometry in Moltemplate #80

Closed yunessalman closed 1 year ago

yunessalman commented 1 year ago

Dear Andrew,

I'm wondering if there's an easy way to fill up the specified simulation box with particles.

I tried many ways of manipulating this matrix but I either get arrangments that are too small or outside the simulation box.

Thank you for your help.

Best regards, Yunes Salman

jewettaij commented 1 year ago

I'm wondering if there's an easy way to fill up the specified simulation box with particles.

Hello Yunes

Please forgive me. This has been a particularly bad month, and I've been forced to ignore moltemplate questions for a couple weeks. (Unfortunately moltemplate is not relevant to my current job. So I reply moltemplate questions intermittently when I have time.)

Firstly, did you obtain the coordinates of your system from a PDB file or an XYZ file? Or did you manually place the molecules where you want them to go using the "new Mol ...move()" syntax. (As an example of the later, see the "system.lt" file from the water example. This example is also discussed at the beginning of the moltemplate manual here. I assume you have read chapter 4 of the moltemplate manual? It's only a few pages long. You can skip the first 3 chapters.)

In the later case, if you are creating a 3-dimensional array of molecules, it's usually possible to guess the size of the simulation box you need by multiplying the number of molecules by the spacing between molecules in the X,Y,Z directions. In the example above, I created a 10x10x10 array of water molecules, each of which is placed 3.10342 Angstroms in the X,Y,Z. So the resulting simulation box in that example had a width of 31.0342 Angstroms. Keep in mind that by default the first molecule is placed at the origin (0,0,0), and the remaining molecules are shifted relative to that molecule. (This doesn't have to be the case. In this example, you can shift the entire block of water molecules after you create them using this command "wat[*][*][*].move(0,0,-15.5171).)

Here are some other suggestions which can help. (See the second suggestion at the end of this message.)

1) Use the "-vmd" argument when you run moltemplate.sh

You can display the system in 3-D every time you run moltemplate, to visually inspect the system right after you created it by using the "-vmd" argument.

I suggest that you install VMD and run moltemplate.sh using the "-vmd" argument. For example:

moltemplate -atomstyle full -vmd system.lt

This will automatically start the VMD molecule visualizer and display the system on your screen. Using the "-vmd" argument makes this easier. Once you have done that, you can display the periodic boundary conditions and customize the appearance of the atoms by following the instructions here:

https://github.com/jewettaij/moltemplate/blob/c76cb98a817c1c7fc5b0f8b926b72fa032709dcd/examples/all_atom/force_field_explicit_parameters/waterSPCE%2BNa%2BCl/README_visualize.txt#L52

...if you haven't already. (The default visualization style is quite ugly, but you can change it by going to the "Graphics"->"Representations" menu option. Note that when reading this README file, you can can skip to section 3, because moltemplate.sh will take care of the first step for you. This README file also explains how to display the periodic images (copies) of your system to make sure atoms are not overlapping with their periodic copies.)

I realize you are probably already using VMD, but perhaps you don't know about the "-vmd" argument. It makes starting VMD easier.

2) Use VMD to measure the distance between atoms.

Once your molecule is displayed in VMD, you can use the "Mouse"->"Label"->"Bonds" menu option and click on any pair of atoms. (They don't have to be bonded together. They could be on opposite sides of the simulation box, for example). The distance between the atoms will be printed to the screen. You can use this distance to estimate how large you need to make the simulation box.

yunessalman commented 1 year ago

Dear Andrew,

Thank you so much for this detailed response. I appreciate it.

I will try your suggestions.

Best regards, Yunes Salman