Commit 251f2804 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

make fix rhok more similar to other LAMMPS sources

- re-indent to 2 blanks
- white space cleanup
- use force->numeric() and force->inumeric() instead of atof() and atoi()
- include system headers before local LAMMPS headers
parent f07719e9
Loading
Loading
Loading
Loading
+103 −108
Original line number Diff line number Diff line
@@ -13,24 +13,24 @@
   Contributing author: Ulf R. Pedersen, ulf@urp.dk
------------------------------------------------------------------------- */

#include "fix_rhok.h"
#include "error.h"
#include "citeme.h"
#include "update.h"
#include "respa.h"
#include "atom.h"
#include "domain.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>

#include "fix_rhok.h"
#include "atom.h"
#include "domain.h"
#include "error.h"
#include "force.h"
#include "respa.h"
#include "update.h"
#include "citeme.h"

using namespace LAMMPS_NS;
using namespace FixConst;

static const char cite_flow_gauss[] =
static const char cite_fix_rhok[] =
  "Bias on the collective density field (fix rhok):\n\n"
  "@Article{pedersen_jcp139_104102_2013,\n"
  "title = {Direct calculation of the solid-liquid Gibbs free energy difference in a single equilibrium simulation},\n"
@@ -49,7 +49,7 @@ FixRhok::FixRhok( LAMMPS* inLMP, int inArgc, char** inArgv )
  : Fix( inLMP, inArgc, inArgv )
{

  if (lmp->citeme) lmp->citeme->add(cite_flow_gauss);
  if (lmp->citeme) lmp->citeme->add(cite_fix_rhok);

  // Check arguments
  if( inArgc != 8 )
@@ -60,7 +60,6 @@ FixRhok::FixRhok( LAMMPS* inLMP, int inArgc, char** inArgv )
  vector_flag = 1;         // have compute_vector...
  size_vector = 3;         // ...with this many components
  global_freq = 1;         // whose value can be computed at every timestep
  //scalar_vector_freq = 1;  // OLD lammps: whose value can be computed at every timestep
  thermo_energy = 1;       // this fix changes system's potential energy
  extscalar = 0;           // but the deltaPE might not scale with # of atoms
  extvector = 0;           // neither do the components of the vector
@@ -68,20 +67,16 @@ FixRhok::FixRhok( LAMMPS* inLMP, int inArgc, char** inArgv )
  // Parse fix options
  int n[3];

  n[0]   = atoi( inArgv[3] );
  n[1]   = atoi( inArgv[4] );
  n[2]   = atoi( inArgv[5] );
  n[0]   = force->inumeric(FLERR,inArgv[3]);
  n[1]   = force->inumeric(FLERR,inArgv[4]);
  n[2]   = force->inumeric(FLERR,inArgv[5]);

  mK[0] = n[0]*(2*M_PI / (domain->boxhi[0] - domain->boxlo[0]));
  mK[1] = n[1]*(2*M_PI / (domain->boxhi[1] - domain->boxlo[1]));
  mK[2] = n[2]*(2*M_PI / (domain->boxhi[2] - domain->boxlo[2]));

  mKappa = atof( inArgv[6] );
  mRhoK0 = atof( inArgv[7] );
}

FixRhok::~FixRhok()
{
  mKappa = force->numeric(FLERR,inArgv[6]);
  mRhoK0 = force->numeric(FLERR,inArgv[7]);
}

// Methods that this fix implements
+15 −15
Original line number Diff line number Diff line
@@ -15,8 +15,8 @@ FixStyle(rhok,FixRhok)

#else

#ifndef __FIX_RHOK__
#define __FIX_RHOK__
#ifndef LMP_FIX_RHOK_H
#define LMP_FIX_RHOK_H

#include "fix.h"

@@ -28,7 +28,7 @@ public:
  // Constructor: all the parameters to this fix specified in
  // the LAMMPS input get passed in
  FixRhok( LAMMPS* inLMP, int inArgc, char** inArgv );
  virtual ~FixRhok();
  virtual ~FixRhok() {};

  // Methods that this fix implements
  // --------------------------------