CH4 Molecule file

Hello. I am trying to create a CH4 molecule file. I read through LAMMPS documentation and previous posts in the forum on molecule files. My current approach to this is to create a CH4 molecule file using a information in my CH4 data file manually. Currently, I have to put it in LAMMPS however, there seems to be an “invalid line” error under my Coords section.

Im not sure why this happens when I extracted the information from the data file correctly. The same goes to when I try to include the “Bonds” section for my molecule file. I previously created the data file through Material Studios. Would appreciate if there can be any feedback on this. This is my data file and my molecule file. Thanks

Data file
LAMMPS data file. msi2lmp v3.9.9 / 05 Nov 2018 / CGCMM for ch4_run1

  5 atoms
  4 bonds
  6 angles

2 atom types
1 bond types
1 angle types

-1.039900005     1.509899974 xlo xhi
-0.504100000     1.963099957 ylo yhi
-1.375100017     1.404799998 zlo zhi

Masses

1 1.008 # H_
2 12.001 # C_1

Pair Coeffs # lj/cut/coul/long

1 0.03 2.5 # H_
2 0.066 3.5 # C_1

Bond Coeffs # harmonic

1 580 1.09 # H_-C_1

Angle Coeffs # harmonic

1 66.00 107.8 # H_-C_1-H_

Atoms # full

  1      1   1  0.000000     0.002100000    -0.004100000     0.002000000   0   0   0 # H_
  2      1   2  0.000000    -0.012700000     1.085800052     0.008000000   0   0   0 # C_1
  3      1   1  0.000000     1.009899974     1.463099957     0.000300000   0   0   0 # H_
  4      1   1  0.000000    -0.539900005     1.446900010    -0.875100017   0   0   0 # H_
  5      1   1  0.000000    -0.522899985     1.437299967     0.904799998   0   0   0 # H_

Bonds

 1   1      1      2
 2   1      3      2
 3   1      4      2
 4   1      5      2

Angles

 1   1      1      2      3
 2   1      1      2      4
 3   1      1      2      5
 4   1      3      2      4
 5   1      3      2      5
 6   1      4      2      5

Molecule file
#CH4 molecule file

5 atoms
4 bonds
6 angles

Coords
1 0.002100000 -0.004100000 0.002000000 #H
2 -0.012700000 1.085800052 0.008000000 #C
3 1.009899974 1.463099957 0.000300000 #H
4 -0.539900005 1.446900010 -0.875100017 #H
5 -0.522899985 1.437299967 0.904799998 #H

Types
1 1 #H
2 2 #C
3 1 #H
4 1 #H
5 1 #H

Charges
1 0.06 #H
2 -0.24 #C
3 0.06 #H
4 0.06 #H
5 0.06 #H

Bonds
1 1 1 2
2 1 3 2
3 1 4 2
4 1 5 2

Angles
1 1 1 2 3
2 1 1 2 4
3 1 1 2 5
4 1 3 2 4
5 1 3 2 5
6 1 4 2 5

Hi.

You need one empty line after Coords, same for the other sections:

#CH4 molecule file

5 atoms
4 bonds
6 angles

Coords

1 0.002100000 -0.004100000 0.002000000 #H
2 -0.012700000 1.085800052 0.008000000 #C
3 1.009899974 1.463099957 0.000300000 #H
4 -0.539900005 1.446900010 -0.875100017 #H
5 -0.522899985 1.437299967 0.904799998 #H

Types

1 1 #H
2 2 #C
3 1 #H
4 1 #H
5 1 #H

Charges

1 0.06 #H
2 -0.24 #C
3 0.06 #H
4 0.06 #H
5 0.06 #H

Bonds

1 1 1 2
2 1 3 2
3 1 4 2
4 1 5 2

Angles

1 1 1 2 3
2 1 1 2 4
3 1 1 2 5
4 1 3 2 4
5 1 3 2 5
6 1 4 2 5

Simon

2 Likes

Hello,
It works now. I adjusted the spacing for the Coords section as well and now LAMMPS reads it. Thank you

Just wondering…
Is the data of the first line of “Bonds” 1 1 1 2 correct and accurate?
I tried to run this in LAMMPS and it comes with error message for the first line of ‘Bonds’

The line is correct.
What is the error message?

I am trying to model CH4 top and H2O bottom layer.
The message is:

ERROR: Invalid bond type in Bonds section of molecule file: 1 1 1 2 (src/molecule.cpp:1044)
Last command: molecule m ch4.txt

This is a portion of my minimization file script, if it is useful…

#set up ----------------------------------------------------

units real
atom_style full
dimension 3

#Geometry and Atoms ----------------------------------------

boundary p s p

region whole block 0 500 0 500 0 5 units box
create_box 2 whole

molecule m ch4.txt
region topCH4 block 0 500 250 500 0 5 units box
create_atoms 1 region topCH4

molecule w h2o.txt
region bottomH2O block 0 500 0 250 0 5 units box
create_atoms 2 region bottomH2O

Assign masses

mass 1 15.9994 # O (Oxygen)
mass 2 1.008 # H (Hydrogen)
mass 3 12.01 # C (Carbon)
mass 4 1.008 # H (Hydrogen)

Define potential interactions

pair_style lj/cut/coul/long 10.0

pair_coeff 1 1 0.1521 3.1507 # O-O
pair_coeff 2 2 0.0 0.0 # H-H
pair_coeff 1 2 0.0 0.0 # O-H
pair_coeff 3 3 0.1 3.75 # C-C
pair_coeff 4 4 0.0 0.0 # H-H
pair_coeff 3 4 0.0 0.0 # C-H

Define bonds and angles for water

bond_style harmonic
bond_coeff 1 580 1.09 # H-O bond
angle_style harmonic
angle_coeff 1 66.00 107.8 # H-O-H angle

Define bonds and angles for methane

bond_style harmonic
bond_coeff 2 340 1.09 # C-H bond
angle_style harmonic
angle_coeff 2 40 109.5 # H-C-H angle

Setup neighbor lists and long-range solver

kspace_style pppm 1.0e-4
.
.
.
.

The ch4.txt file is identical to the discussion above…

Your create_box command allocates space for 2 atom types, but no bond.

Simon

Are you saying that I have to specify the bond between the two group of materials? what if I create a gap between the two materials?

No

Its completely unrelated.

Take a look at the create_box command, particularly the second example that can be used as an inspiration on how this command should be written:

create_box 2 mybox bond/types 2 extra/bond/per/atom 1