QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: payam on July 19, 2016, 18:57

Title: Defining new Tersoff potential
Post by: payam on July 19, 2016, 18:57
Dear All,
I need to define a new Tersoff potential and then combine it with Lenard-Jones potential foe interlayer interaction. Does anyone know how to do that?
In tutorial , the LJ potential can be combined only with available potential. How can I combine LJ interaction with newly created Tersoff potential?

Best regards,
Payam
Title: Re: Defining new Tersoff potential
Post by: payam on July 19, 2016, 21:40
Dear ATK users,
I have a quick question. Here is part of script to calculate phonon properties of graphite.
Are sigma and epsilon the same as LJ interaction parameters?
potentialSet = TremoloXPotentialSet(name = 'Tersoff_CH_2010')
potentialSet.addParticleType(ParticleType(symbol='H', mass=1.00794 * atomic_mass_unit, charge=0.0, sigma=1.0*Angstrom, sigma14=1.0*Angstrom, epsilon=0.0*eV, epsilon14=0.0*eV, atomicNumber=None))
potentialSet.addParticleType(ParticleType(symbol='C', mass=12.0107 * atomic_mass_unit, charge=0.0, sigma=1.0*Angstrom, sigma14=1.0*Angstrom, epsilon=0.0*eV, epsilon14=0.0*eV, atomicNumber=None))

best regards,
Payam

Title: Re: Defining new Tersoff potential
Post by: Anders Blom on July 19, 2016, 22:31
Yes, see http://www.quantumwise.com/documents/manuals/latest/ReferenceManual/index.html/ref.lennardjonespotential.html
Title: Re: Defining new Tersoff potential
Post by: payam on July 21, 2016, 22:24
Thank you for your response Anders.
Do we have REBO potential for graphite? I did not see it in the list.

Best regards,
Payam
Title: Re: Defining new Tersoff potential
Post by: payam on July 21, 2016, 23:28
Dear ATK users
I have one more question:
How can I add my own potential to the available potential database?
For example, there is no potential available for MoSe2 and I want to add my own potential to the database. What is the procedure?

Thanks in advance.

Best regards,
Payam
Title: Re: Defining new Tersoff potential
Post by: Anders Blom on July 22, 2016, 00:04
No Brenner/REBO, coming a bit later.
You can in principle add a Python script to lib/python2.7/site-packages which you then can import in any script. However, it will not appear in VNL, there is currently no mechanism for that.
But you can also just keep the definition of the new potential in a separate Python file that you import in each script that uses it.
Title: Re: Defining new Tersoff potential
Post by: payam on July 22, 2016, 05:55
Thank you very much Anders.

Best regards,
Payam
Title: Re: Defining new Tersoff potential
Post by: payam on July 22, 2016, 19:01
Dear All,
I tried to define my own potential for hBN which includes interlayer LJ potential and intra-layer Tersoff potential according to Lindsay's parameters (PRB 2011). Here is the section related to potential definition:

# Add tags
bulk_configuration.addTags('layer1', [0, 3])
bulk_configuration.addTags('layer2', [1, 2])
# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------
#-------------------- Definition ------------------------------
potentialSet = TremoloXPotentialSet(name = 'hBN_Tersoff_Lindsay_2011')

#-------------------- Add Particle ------------------------------
potentialSet.addParticleType(ParticleType(symbol='B', mass=10.811 * atomic_mass_unit, charge=None, sigma=None, sigma14=None, epsilon=None, epsilon14=None, atomicNumber=5))
potentialSet.addParticleType(ParticleType(symbol='N', mass=14.0067 * atomic_mass_unit, charge=None, sigma=None, sigma14=None, epsilon=None, epsilon14=None, atomicNumber=7))

#-------------------- Single Potential ------------------------------
potential = TersoffSingleTypePotential(particleType = 'B', A = 1433.0*eV, B = 417.3*eV, R = 1.95*Angstrom, S = 2.1*Angstrom, l = 3.4661*1/Angstrom, mu = 2.2288*1/Angstrom, alpha = 0.0*1/Angstrom, beta = 1.0239e-07, omega = 1.0, chi = 1.0, chiR = 1.0, m = 0, n = 0.72674, c = 30692.4, d = 4.7295, h = -0.98578)
potentialSet.addPotential(potential)
potential = TersoffSingleTypePotential(particleType = 'N', A = 1433.0*eV, B = 417.3*eV, R = 1.95*Angstrom, S = 2.1*Angstrom, l = 3.4661*1/Angstrom, mu = 2.2288*1/Angstrom, alpha = 0.0*1/Angstrom, beta = 1.0239e-07, omega = 1.0, chi = 1.0, chiR = 1.0, m = 0, n = 0.72674, c = 30692.4, d = 4.7295, h = -0.98578)
potentialSet.addPotential(potential)

#-------------------- Mix Potential ------------------------------
potential = TersoffMixitPotential(particleType1 = 'B', particleType2 = 'N', alpha = 0.0*1/Angstrom, omega = 1.0, chi = 1.0, chiR = 1.0, m = 0)
potentialSet.addPotential(potential)

#-------------------- Intra-layer potential ------------------------------
#tf_layer1 = hBN_Tersoff_Lindsay_2011(tags='layer1')
#tf_layer2 = hBN_Tersoff_Lindsay_2011(tags='layer2')

#-------------------- Finalizing ------------------------------
# Define a new potential for the interlayer interaction.
lj_interlayer_potential = TremoloXPotentialSet(name="InterLayerPotential")
lj_interlayer_potential.setTags(['layer1', 'layer2'])
# Add particle type definitions for both types.
lj_interlayer_potential.addParticleType(ParticleType.fromElement(Boron,))
lj_interlayer_potential.addParticleType(ParticleType.fromElement(Nitrogen, sigma=3.212*Angstrom, epsilon=0.004*eV))

# Add Lennard-Jones potentials between the sulfur atoms of different layers.
lj_interlayer_potential.addPotential(LennardJonesPotential('layer1', 'layer2', r_cut=10.0 * Angstrom))

# Combine all 3 potential sets in a single calculator.
calculator = TremoloXCalculator(parameters=potentialSet)
calculator.setInternalOrdering("default")


However, ATK does not include the interlayer potential in calculations. Does anyone have any solution?

Best regards,
Payam
Title: Re: Defining new Tersoff potential
Post by: Anders Blom on July 22, 2016, 19:41
You never add the interlayer potential to the potentialSet
Title: Re: Defining new Tersoff potential
Post by: payam on July 22, 2016, 21:38
Dear Anders,
I added LJ to potentialset and it looks like this but still it does not include the LJ interaction:

# Add tags
bulk_configuration.addTags('layer1', [0, 3])
bulk_configuration.addTags('layer2', [1, 2])
# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------
#-------------------- Definition ------------------------------
potentialSet = TremoloXPotentialSet(name = 'hBN_Tersoff_Lindsay_2011')

#-------------------- Add Particle ------------------------------
potentialSet.addParticleType(ParticleType(symbol='B', mass=10.811 * atomic_mass_unit, charge=None, sigma=3.212*Angstrom, sigma14=None, epsilon=0.004*eV, epsilon14=None, atomicNumber=5))
potentialSet.addParticleType(ParticleType(symbol='N', mass=14.0067 * atomic_mass_unit, charge=None, sigma=3.212*Angstrom, sigma14=None, epsilon=0.004*eV, epsilon14=None, atomicNumber=7))

#-------------------- Single Potential ------------------------------
potential = TersoffSingleTypePotential(particleType = 'B', A = 1433.0*eV, B = 417.3*eV, R = 1.95*Angstrom, S = 2.1*Angstrom, l = 3.4661*1/Angstrom, mu = 2.2288*1/Angstrom, alpha = 0.0*1/Angstrom, beta = 1.0239e-07, omega = 1.0, chi = 1.0, chiR = 1.0, m = 0, n = 0.72674, c = 30692.4, d = 4.7295, h = -0.98578)
potentialSet.addPotential(potential)
potential = TersoffSingleTypePotential(particleType = 'N', A = 1433.0*eV, B = 417.3*eV, R = 1.95*Angstrom, S = 2.1*Angstrom, l = 3.4661*1/Angstrom, mu = 2.2288*1/Angstrom, alpha = 0.0*1/Angstrom, beta = 1.0239e-07, omega = 1.0, chi = 1.0, chiR = 1.0, m = 0, n = 0.72674, c = 30692.4, d = 4.7295, h = -0.98578)
potentialSet.addPotential(potential)

#-------------------- Mix Potential ------------------------------
potential = TersoffMixitPotential(particleType1 = 'B', particleType2 = 'N', alpha = 0.0*1/Angstrom, omega = 1.0, chi = 1.0, chiR = 1.0, m = 0)
potentialSet.addPotential(potential)

#-------------------- Finalizing ------------------------------
# Define a new potential for the interlayer interaction.
lj_interlayer_potential = TremoloXPotentialSet(name="InterLayerPotential")
lj_interlayer_potential.setTags(['layer1', 'layer2'])

# Add particle type definitions for both types.
lj_interlayer_potential.addParticleType(ParticleType.fromElement(Boron,))
lj_interlayer_potential.addParticleType(ParticleType.fromElement(Nitrogen, sigma=3.212*Angstrom, epsilon=0.004*eV))

# Add Lennard-Jones potentials between the sulfur atoms of different layers.
potentialSet.addPotential(LennardJonesPotential('layer1', 'layer2', r_cut=10.0 * Angstrom))

# Combine all 3 potential sets in a single calculator.
calculator = TremoloXCalculator(parameters=potentialSet)
calculator.setInternalOrdering("default")


Could you please let me know what I am missing?

Best regards,
Payam
Title: Re: Defining new Tersoff potential
Post by: Anders Blom on July 22, 2016, 21:49
How can you tell it's not using it?
Shouldn't there be sigma and epsilon for Boron?
I'm going on vacation, you can email support@ for more help
Title: Re: Defining new Tersoff potential
Post by: payam on July 22, 2016, 22:14
Because, adding or removing LJ interaction has no effect on phonon dispersion in z direction (A-Gamma k-path).
Title: Re: Defining new Tersoff potential
Post by: Anders Blom on July 22, 2016, 22:37
No = 0, or perhaps just very small? The LJ interaction is quite weak...
Title: Re: Defining new Tersoff potential
Post by: payam on July 22, 2016, 22:44
Yes. The LJ interaction is weak. However, Lindsay in PHYSICAL REVIEW B 84, 155421 (2011) Figure 1
shows that the LJ effect is not negligible and adding LJ causes dispersion in the z-axis.
Title: Re: Defining new Tersoff potential
Post by: Julian Schneider on July 23, 2016, 22:34
What you need to do is

Code
# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------
#-------------------- Definition ------------------------------
potentialSet = TremoloXPotentialSet(name = 'hBN_Tersoff_Lindsay_2011')

#-------------------- Add Particle ------------------------------
potentialSet.addParticleType(ParticleType(symbol='B', mass=10.811 * atomic_mass_unit, charge=None, sigma=3.212*Angstrom, sigma14=None, epsilon=0.004*eV, epsilon14=None, atomicNumber=5))
potentialSet.addParticleType(ParticleType(symbol='N', mass=14.0067 * atomic_mass_unit, charge=None, sigma=3.212*Angstrom, sigma14=None, epsilon=0.004*eV, epsilon14=None, atomicNumber=7))

#-------------------- Single Potential ------------------------------
potential = TersoffSingleTypePotential(particleType = 'B', A = 1433.0*eV, B = 417.3*eV, R = 1.95*Angstrom, S = 2.1*Angstrom, l = 3.4661*1/Angstrom, mu = 2.2288*1/Angstrom, alpha = 0.0*1/Angstrom, beta = 1.0239e-07, omega = 1.0, chi = 1.0, chiR = 1.0, m = 0, n = 0.72674, c = 30692.4, d = 4.7295, h = -0.98578)
potentialSet.addPotential(potential)
potential = TersoffSingleTypePotential(particleType = 'N', A = 1433.0*eV, B = 417.3*eV, R = 1.95*Angstrom, S = 2.1*Angstrom, l = 3.4661*1/Angstrom, mu = 2.2288*1/Angstrom, alpha = 0.0*1/Angstrom, beta = 1.0239e-07, omega = 1.0, chi = 1.0, chiR = 1.0, m = 0, n = 0.72674, c = 30692.4, d = 4.7295, h = -0.98578)
potentialSet.addPotential(potential)

#-------------------- Mix Potential ------------------------------
potential = TersoffMixitPotential(particleType1 = 'B', particleType2 = 'N', alpha = 0.0*1/Angstrom, omega = 1.0, chi = 1.0, chiR = 1.0, m = 0)
potentialSet.addPotential(potential)

# Define a new potential for the interlayer interaction.
lj_interlayer_potential = TremoloXPotentialSet(name="InterLayerPotential")

# Add particle type definitions for both types.
lj_interlayer_potential.addParticleType(ParticleType.fromElement(Boron,))
lj_interlayer_potential.addParticleType(ParticleType.fromElement(Nitrogen, sigma=3.212*Angstrom, epsilon=0.004*eV))

# Add Lennard-Jones potentials between the nitrogen atoms of different layers.
lj_interlayer_potential.addPotential(LennardJonesPotential(' N', 'N', r_cut=10.0 * Angstrom))
lj_interlayer_potential.setTags(['layer1', 'layer2'])

# Combine all potential sets in a single calculator.
calculator = TremoloXCalculator(parameters=[potential, lj_interlayer_potential])

This adds LJ-interaction between nitrogen atoms in layer1 and layer2. IF you want to add LJ-interactions for Boron-Boron or Nitrogen-Boron as well, you need to specify the epsilon and sigma parameters for Boron in the line

Code
lj_interlayer_potential.addParticleType(ParticleType.fromElement(Boron,))

and then add LennardJones-potentials for the desired element interactions, e.g.
Code
lj_interlayer_potential.addPotential(LennardJonesPotential(' B', 'B', r_cut=10.0 * Angstrom))
Title: Re: Defining new Tersoff potential
Post by: payam on July 25, 2016, 19:07
Dear Julian,
Thank you  very much for your response.
I followed your instructions and modified the script. However, still I get error. Could you please look at the below and let me know how to resolve it?
Thank you in advance.

Best regards,
Payam
+------------------------------------------------------------------------------+
|                                                                              |
| Atomistix ToolKit 2015.1 [Build 5b36b25]                                     |
|                                                                              |
+------------------------------------------------------------------------------+

Timing:                          Total     Per Step        %

--------------------------------------------------------------------------------

Loading Modules + MPI   :       1.32 s       1.32 s      98.29% |=============|
--------------------------------------------------------------------------------
Total                   :       1.34 s
Traceback (most recent call last):
  File "Lindsay_LJ_Julian.py", line 62, in <module>
    calculator = TremoloXCalculator(parameters=[potential, lj_interlayer_potential])
  File "./build/lib/python2.7/site-packages/tremolox/TremoloBaseCalculator.py", line 84, in __init__
  File "./build/lib/python2.7/site-packages/tremolox/TremoloXPotentialSet.py", line 11714, in mergePotentials
AttributeError: 'TersoffMixitPotential' object has no attribute 'merge'
Title: Re: Defining new Tersoff potential
Post by: Julian Schneider on July 27, 2016, 11:13
Sorry, my mistake.
The TremoloXCalculator needs to get the list of potential-sets and not potentials.

Also you need to define two Tersoff-potentials, each acting on one tagged group, otherwise the Tersoff-potential only acts on the atoms without a tag, (which are probably None).
The correct way is the following:

Code
# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------
#-------------------- Definition ------------------------------
potential_set_1 = TremoloXPotentialSet(name = 'hBN_Tersoff_Lindsay_2011')

#-------------------- Add Particle ------------------------------
potential_set_1.addParticleType(ParticleType(symbol='B', mass=10.811 * atomic_mass_unit, charge=None, sigma=3.212*Angstrom, sigma14=None, epsilon=0.004*eV, epsilon14=None, atomicNumber=5))
potential_set_1.addParticleType(ParticleType(symbol='N', mass=14.0067 * atomic_mass_unit, charge=None, sigma=3.212*Angstrom, sigma14=None, epsilon=0.004*eV, epsilon14=None, atomicNumber=7))

#-------------------- Single Potential ------------------------------
potential = TersoffSingleTypePotential(particleType = 'B', A = 1433.0*eV, B = 417.3*eV, R = 1.95*Angstrom, S = 2.1*Angstrom, l = 3.4661*1/Angstrom, mu = 2.2288*1/Angstrom, alpha = 0.0*1/Angstrom, beta = 1.0239e-07, omega = 1.0, chi = 1.0, chiR = 1.0, m = 0, n = 0.72674, c = 30692.4, d = 4.7295, h = -0.98578)
potential_set_1.addPotential(potential)
potential = TersoffSingleTypePotential(particleType = 'N', A = 1433.0*eV, B = 417.3*eV, R = 1.95*Angstrom, S = 2.1*Angstrom, l = 3.4661*1/Angstrom, mu = 2.2288*1/Angstrom, alpha = 0.0*1/Angstrom, beta = 1.0239e-07, omega = 1.0, chi = 1.0, chiR = 1.0, m = 0, n = 0.72674, c = 30692.4, d = 4.7295, h = -0.98578)
potential_set_1.addPotential(potential)

#-------------------- Mix Potential ------------------------------
potential = TersoffMixitPotential(particleType1 = 'B', particleType2 = 'N', alpha = 0.0*1/Angstrom, omega = 1.0, chi = 1.0, chiR = 1.0, m = 0)
potential_set_1.addPotential(potential)

# Tell this potential-set to act only among atoms of the tagged group.
potential_set_1.setTags('layer1')

#-------------------- Definition ------------------------------
potential_set_2 = TremoloXPotentialSet(name = 'hBN_Tersoff_Lindsay_2011')

#-------------------- Add Particle ------------------------------
potential_set_2.addParticleType(ParticleType(symbol='B', mass=10.811 * atomic_mass_unit, charge=None, sigma=3.212*Angstrom, sigma14=None, epsilon=0.004*eV, epsilon14=None, atomicNumber=5))
potential_set_2.addParticleType(ParticleType(symbol='N', mass=14.0067 * atomic_mass_unit, charge=None, sigma=3.212*Angstrom, sigma14=None, epsilon=0.004*eV, epsilon14=None, atomicNumber=7))

#-------------------- Single Potential ------------------------------
potential = TersoffSingleTypePotential(particleType = 'B', A = 1433.0*eV, B = 417.3*eV, R = 1.95*Angstrom, S = 2.1*Angstrom, l = 3.4661*1/Angstrom, mu = 2.2288*1/Angstrom, alpha = 0.0*1/Angstrom, beta = 1.0239e-07, omega = 1.0, chi = 1.0, chiR = 1.0, m = 0, n = 0.72674, c = 30692.4, d = 4.7295, h = -0.98578)
potential_set_2.addPotential(potential)
potential = TersoffSingleTypePotential(particleType = 'N', A = 1433.0*eV, B = 417.3*eV, R = 1.95*Angstrom, S = 2.1*Angstrom, l = 3.4661*1/Angstrom, mu = 2.2288*1/Angstrom, alpha = 0.0*1/Angstrom, beta = 1.0239e-07, omega = 1.0, chi = 1.0, chiR = 1.0, m = 0, n = 0.72674, c = 30692.4, d = 4.7295, h = -0.98578)
potential_set_2.addPotential(potential)

#-------------------- Mix Potential ------------------------------
potential = TersoffMixitPotential(particleType1 = 'B', particleType2 = 'N', alpha = 0.0*1/Angstrom, omega = 1.0, chi = 1.0, chiR = 1.0, m = 0)
potential_set_2.addPotential(potential)

# Tell this potential-set to act only among atoms of the tagged group.
potential_set_2.setTags('layer2')

# Define a new potential for the interlayer interaction.
lj_interlayer_potential = TremoloXPotentialSet(name="InterLayerPotential")

# Add particle type definitions for both types.
lj_interlayer_potential.addParticleType(ParticleType.fromElement(Boron,))
lj_interlayer_potential.addParticleType(ParticleType.fromElement(Nitrogen, sigma=3.212*Angstrom, epsilon=0.004*eV))

# Add Lennard-Jones potentials between the nitrogen atoms of different layers.
lj_interlayer_potential.addPotential(LennardJonesPotential('N', 'N', r_cut=10.0*Angstrom))
lj_interlayer_potential.setTags(['layer1', 'layer2'])

# Combine all potential sets in a single calculator.
calculator = TremoloXCalculator(parameters=[potential_set_1, potential_set_2, lj_interlayer_potential])
bulk_configuration.setCalculator(calculator)

# This print statement will give you the full description of the potential.
# print calculator._potential_parameters._script()

Note, that the Tersoff potential acts only within each single layer, not between the different layers.
Title: Re: Defining new Tersoff potential
Post by: payam on July 27, 2016, 18:09
Dear Julian,
That's a perfect answer.
I used it and got the result. Thank you very much.

Best regards,
Payam