From 05f1a5f7d27eeeb414ca94de0a2656ce43495cf1 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 12 Jan 2010 16:43:03 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@3661 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- doc/Section_modify.html | 36 +++++++++++++----------------------- doc/Section_modify.txt | 36 +++++++++++++----------------------- 2 files changed, 26 insertions(+), 46 deletions(-) diff --git a/doc/Section_modify.html b/doc/Section_modify.html index 753c1d9a20..83b0eaf93c 100644 --- a/doc/Section_modify.html +++ b/doc/Section_modify.html @@ -40,9 +40,8 @@ class requires 2 files, a source code file (*.cpp) and a header file new option. Depending on how different your new feature is compared to existing features, you can either derive from the base class itself, or from a derived class that already exists. Enabling LAMMPS -to invoke the new class is as simple as adding two lines to the -style_user.h file, in the same syntax as other LAMMPS classes are -specified in the style.h file. +to invoke the new class is as simple as putting the two source +files in the src dir and re-building LAMMPS.

The advantage of C++ and its object-orientation is that all the code and variables needed to define the new feature are in the 2 files you @@ -57,25 +56,17 @@ command like

pair_style foo 0.1 3.5 
 
-

you put your 2 files in the LAMMPS src directory, add 2 lines to the -style_user.h file, and re-make the code. +

then these lines should appear at the top of your pair_foo.h file:

-

The first line added to style_user.h would be -

-
PairStyle(foo,PairFoo) 
+
#ifdef PAIR_CLASS
+PairStyle(foo,PairFoo)
+#else 
 
-

in the #ifdef PairClass section, where "foo" is the style keyword in -the pair_style command, and PairFoo is the class name in your C++ +

where "foo" is the style keyword in the pair_style command, and +PairFoo is the class name defined in your pair_foo.cpp and pair_foo.h files.

-

The 2nd line added to style_user.h would be -

-
#include "pair_foo.h" 
-
-

in the #ifdef PairInclude section, where pair_foo.h is the name of -your new include file. -

-

When you re-make LAMMPS, your new pairwise potential becomes part of +

When you re-build LAMMPS, your new pairwise potential becomes part of the executable and can be invoked with a pair_style command like the example above. Arguments like 0.1 and 3.5 can be defined and processed by your new class. @@ -576,15 +567,14 @@ consideration. Following these steps will save time for both you and us. See existing package files for examples.

Your user package will be a directory with a name like USER-FOO. In -addition to your new files, the directory should contain a README, -Install.csh and style_user_foo.h file. Send us a tarball of this -USER-FOO directory. +addition to your new files, the directory should contain a README, and +Install.csh file. Send us a tarball of this USER-FOO directory.

The README text file should contain your name and contact information and a brief description of what your new package does.

-

The Install.csh and style_user_foo.h files enable LAMMPS to include -and exclude your package. +

The Install.csh file enables LAMMPS to include and exclude your +package.

Your new source files need to have the LAMMPS copyright, GPL notice, and your name at the top. They need to create a class that is inside diff --git a/doc/Section_modify.txt b/doc/Section_modify.txt index af08b31842..c4eef5771d 100644 --- a/doc/Section_modify.txt +++ b/doc/Section_modify.txt @@ -37,9 +37,8 @@ class requires 2 files, a source code file (*.cpp) and a header file new option. Depending on how different your new feature is compared to existing features, you can either derive from the base class itself, or from a derived class that already exists. Enabling LAMMPS -to invoke the new class is as simple as adding two lines to the -style_user.h file, in the same syntax as other LAMMPS classes are -specified in the style.h file. +to invoke the new class is as simple as putting the two source +files in the src dir and re-building LAMMPS. The advantage of C++ and its object-orientation is that all the code and variables needed to define the new feature are in the 2 files you @@ -54,25 +53,17 @@ command like pair_style foo 0.1 3.5 :pre -you put your 2 files in the LAMMPS src directory, add 2 lines to the -style_user.h file, and re-make the code. +then these lines should appear at the top of your pair_foo.h file: -The first line added to style_user.h would be +#ifdef PAIR_CLASS +PairStyle(foo,PairFoo) +#else :pre -PairStyle(foo,PairFoo) :pre - -in the #ifdef PairClass section, where "foo" is the style keyword in -the pair_style command, and PairFoo is the class name in your C++ +where "foo" is the style keyword in the pair_style command, and +PairFoo is the class name defined in your pair_foo.cpp and pair_foo.h files. -The 2nd line added to style_user.h would be - -#include "pair_foo.h" :pre - -in the #ifdef PairInclude section, where pair_foo.h is the name of -your new include file. - -When you re-make LAMMPS, your new pairwise potential becomes part of +When you re-build LAMMPS, your new pairwise potential becomes part of the executable and can be invoked with a pair_style command like the example above. Arguments like 0.1 and 3.5 can be defined and processed by your new class. @@ -553,15 +544,14 @@ consideration. Following these steps will save time for both you and us. See existing package files for examples. Your user package will be a directory with a name like USER-FOO. In -addition to your new files, the directory should contain a README, -Install.csh and style_user_foo.h file. Send us a tarball of this -USER-FOO directory. +addition to your new files, the directory should contain a README, and +Install.csh file. Send us a tarball of this USER-FOO directory. The README text file should contain your name and contact information and a brief description of what your new package does. -The Install.csh and style_user_foo.h files enable LAMMPS to include -and exclude your package. +The Install.csh file enables LAMMPS to include and exclude your +package. Your new source files need to have the LAMMPS copyright, GPL notice, and your name at the top. They need to create a class that is inside