jewettaij / moltemplate

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

Error: There are no atoms in the system (with write("Data Atoms") command) #68

Closed Zoe-Chang1 closed 2 years ago

Zoe-Chang1 commented 2 years ago

Dear Moltemplate users,

I have an issue about " There are no atoms in the system".

I build a force-field of PDMS. The force field include atoms I need inside. (The partial code is shown below:)
_PForceField {
write_once("In Init") { units real atom_style full bond_style class2 angle_style quartic dihedral_style opls pair_style buck }

There are 4 atom types: "C" "H" "Si" "O"

writeonce("Data Masses") { @atom:Si 28.085 @atom:C 12.01 @atom:H 1.007 @atom:O 15.999

And I import the force field to my monomer.lt script. (as shown below:)

_import "PForcefield.lt" # contains force-field parameters

monomer inherits PForceField {

write("Data Atoms") {

atomId molId atomType charge x y z

$atom:Si $mol:... @atom:Si   0.0   -0.637886  0.553288  -0.183695
$atom:O  $mol:... @atom:O    0.0    0.248119 -0.271508  -1.283296

$atom:C1 $mol:... @atom:C 0.0 -0.600714 2.369272 -0.648393 $atom:H1 $mol:... @atom:H 0.0 0.439526 2.758433 -0.590174 $atom:H2 $mol:... @atom:H 0.0 -0.977302 2.505258 -1.68573 $atom:H3 $mol:... @atom:H 0.0 -1.241965 2.958313 0.0432318461 $atom:C2 $mol:... @atom:C 0.0 -2.392134 -0.107249 -0.223331 $atom:H4 $mol:... @atom:H 0.0 -2.823555 0.014571 -1.241173 $atom:H5 $mol:... @atom:H 0.0 -2.40159 -1.186807 0.0434449812 $atom:H6 $mol:... @atom:H 0.0 -3.0274 0.446758 0.502263 } write("Data Bonds") {

bond-id bond-type atom-id1 atom-id2

   $bond:CH31    @bond:Sidechain1  $atom:C1  $atom:H1
$bond:CH32    @bond:Sidechain1  $atom:C1  $atom:H2
$bond:CH33    @bond:Sidechain1  $atom:C1  $atom:H3
$bond:CH34    @bond:Sidechain1  $atom:C2  $atom:H4
$bond:CH35    @bond:Sidechain1  $atom:C2  $atom:H5
$bond:CH36    @bond:Sidechain1  $atom:C2  $atom:H6
$bond:SiC1    @bond:Sidechain2  $atom:Si  $atom:C1
$bond:SiC2    @bond:Sidechain2  $atom:Si  $atom:C2
$bond:SiO     @bond:Backbone    $atom:Si  $atom:O

} }_

However, the Error shows: _Error: There are no atoms in your system. Suggestions:

   Your files must contain at least one
       write("Data Atoms")
   command.  These commands are typically located somewhere in
   one of the molecule object(s) you have defined._

I also try using "new" in my monomer.lt script:

_import "PForcefield.lt" # contains force-field parameters

mon1 = new Si mon2 = new C mon3 = new O mon4 = new H monomer inherits PForceField {_

It shows: Error(ttree.PtknsToNode()): Class or variable "Si" not found in this context: ".../Si"

Did I do something wrong with creating atoms?

Thank you so much for help and any suggestions in advance

monomer.txt PForcefield.txt .

Zoe-Chang1 commented 2 years ago

I try to build an entire big system instead of build the single monomer. I don't know why, but it works now.

jewettaij commented 2 years ago

Hi Zoe If you send me all of the moltemplate (.LT) files you are using I will have a look. Please also tell me what command you were using to invoke moltemplate.sh. For example:

moltemplate.sh monomer.txt

If this is how you were invoking moltemplate.sh, then it will not work because the "monomer.txt" file does not contain any "new" commands. When you invoke moltemplate.sh, it should probably look like this instead:

moltemplate.sh system.lt

The "system.lt" file contains "new" commands to make copies of one or more PDMS polymers. There is typically a file named "polymer.lt" (or "PDMS.lt", or something similar) which defines what a PDMS polymer is. It will contain "new" commands which make copies of the monomer you defined in "monomer.txt". For examples of this approach, please see: 1) https://moltemplate.org/examples.html#butane 2) https://github.com/jewettaij/moltemplate/tree/master/examples/all_atom/force_field_COMPASS/butane#butane-example 3) https://moltemplate.org/doc/moltemplate_manual.pdf#section.6 (Chapter 6 is only 2 pages long.)

Anyway, if you send me files you are confused about, I will have a look.

Zoe-Chang1 commented 2 years ago

Hi Dr. Jewett,

Thank you for the hint! I thought the command write ("Data Atoms") is the one creates the items, so I can create monomer alone by run the monomer.lt files. But I now realize I should run the script that contain the "new" command, i.e., polymer.lt in my case.

Thank you for really kind suggestions!

jewettaij commented 2 years ago

I'm glad this helped! If it's okay, I will close this issue now.