Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lammps
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
multiscale
lammps
Commits
24654ad2
Commit
24654ad2
authored
7 years ago
by
Axel Kohlmeyer
Browse files
Options
Downloads
Patches
Plain Diff
small formatting corrections to pair python style
parent
8d46aa60
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/src/pair_python.txt
+9
-9
9 additions, 9 deletions
doc/src/pair_python.txt
with
9 additions
and
9 deletions
doc/src/pair_python.txt
+
9
−
9
View file @
24654ad2
...
...
@@ -80,7 +80,7 @@ class LAMMPSPairPotential(object):
self.pmap=dict()
self.units='lj'
def map_coeff(self,name,ltype):
self.pmap[ltype]=name
self.pmap
\
[ltype
\
]=name
def check_units(self,units):
if (units != self.units):
raise Exception("Conflicting units: %s vs. %s" % (self.units,units))
...
...
@@ -91,7 +91,7 @@ from this class and should be initialize in a similar fashion to the
example given below. NOTE: The class constructor has to set up a data
structure containing the potential parameters supported by this class.
It should also define a variable {self.units} containing a string
matching one of the options of LAMMPS' "units
command
"_units.html, which
matching one of the options of LAMMPS' "units"_units.html
command
, which
is used to verify, that the potential definition in the python class and
in the LAMMPS input match. Example for a single type Lennard-Jones
potential class {LJCutMelt} in reducted units, which defines an atom
...
...
@@ -121,19 +121,19 @@ value of the internal potential parameter data structure. Following
the {LJCutMelt} example, here are the two functions:
def compute_force(self,rsq,itype,jtype):
coeff = self.coeff[self.pmap[itype
]]
[self.pmap[jtype
]
]
coeff = self.coeff
\
[self.pmap
\
[itype
\]\]\
[self.pmap
\
[jtype
\]\
]
r2inv = 1.0/rsq
r6inv = r2inv*r2inv*r2inv
lj1 = coeff[0]
lj2 = coeff[1]
lj1 = coeff
\
[0
\
]
lj2 = coeff
\
[1
\
]
return (r6inv * (lj1*r6inv - lj2))*r2inv :pre
def compute_energy(self,rsq,itype,jtype):
coeff = self.coeff[self.pmap[itype
]]
[self.pmap[jtype
]
]
coeff = self.coeff
\
[self.pmap
\
[itype
\]\]\
[self.pmap
\
[jtype
\]\
]
r2inv = 1.0/rsq
r6inv = r2inv*r2inv*r2inv
lj3 = coeff[2]
lj4 = coeff[3]
lj3 = coeff
\
[2
\
]
lj4 = coeff
\
[3
\
]
return (r6inv * (lj3*r6inv - lj4)) :pre
IMPORTANT NOTE: for consistency with the C++ pair styles in LAMMPS,
...
...
@@ -149,7 +149,7 @@ IMPORTANT NOTE: The evaluation of scripted python code will slow down
the computation pair-wise interactions quite significantly. However,
this can be largely worked around through using the python pair style
not for the actual simulation, but to generate tabulated potentials
on the fly using the "pair_write
command
"_pair_write.html . Please
on the fly using the "pair_write"_pair_write.html
command
. Please
see below for an example LAMMPS input of how to build a table file:
pair_style python 2.5
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment