Page MenuHomec4science

domain_lammps.hh
No OneTemporary

File Metadata

Created
Fri, Oct 18, 18:32

domain_lammps.hh

/**
* @file domain_lammps.hh
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
* @author Jaehyun Cho <jaehyun.cho@epfl.ch>
* @author Srinivasa Babu Ramisetti <srinivasa.ramisetti@epfl.ch>
* @author Till Junge <till.junge@epfl.ch>
*
* @date Thu Jul 31 22:41:23 2014
*
* @brief This is the model wrapping LAMMPS
*
* @section LICENSE
*
* Copyright INRIA and CEA
*
* The LibMultiScale is a C++ parallel framework for the multiscale
* coupling methods dedicated to material simulations. This framework
* provides an API which makes it possible to program coupled simulations
* and integration of already existing codes.
*
* This Project was initiated in a collaboration between INRIA Futurs Bordeaux
* within ScAlApplix team and CEA/DPTA Ile de France.
* The project is now continued at the Ecole Polytechnique Fédérale de Lausanne
* within the LSMS/ENAC laboratory.
*
* This software is governed by the CeCILL-C license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL-C
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C license and that you accept its terms.
*
*/
#ifndef __LIBMULTISCALE_DOMAIN_LAMMPS_HH__
#define __LIBMULTISCALE_DOMAIN_LAMMPS_HH__
/* -------------------------------------------------------------------------- */
#include "container_lammps.hh"
#include "domain_md.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
/**
* Class DomainAtomic
* domaine atomique
*/
template <UInt Dim>
class DomainLammps :
public DomainAtomic<ContainerLammps<Dim>,Dim> , public LAMMPS_NS::LAMMPS
{
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public:
DomainLammps(DomainID ID,CommGroup GID);
~DomainLammps();
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
void setPeriodicFlag(bool flag){ LM_TOIMPLEMENT;};
//! get the elastic stiffness constant
Real getElasticConstant(){ LM_TOIMPLEMENT;};
//! get R0
Real getR0(){ LM_TOIMPLEMENT;};
void getNeighborList(RefAtom<Dim> & atom, UInt count,
std::vector<RefAtom<Dim> > & neigbhor_list){ LM_TOIMPLEMENT;};
int getNbDofs(){ LM_TOIMPLEMENT;};
protected:
//! clear the force before a computation
void force_clear(UInt vflag);
//! migration and boundary conditions are applied by this method
void echangeAtomes();
//! Initialize degree of freedom values (reload, initial positions,velocities, etc...)
void initDOFs();
//! read material structure set constants units etc...
void initModel();
//! function for keyword parsing
void declareParams();
//! load lammps conf file
void loadLammpsConfigFile();
//! change time step box size need to be changed
void performStep1();
//! perform change box size
void changeBox();
//! reset the ghost atoms etc...
void resetBox();
void init();
/* ------------------------------------------------------------------------ */
/* Accessors */
/* ------------------------------------------------------------------------ */
public:
//! set current step to a given value
void setCurrentStep(UInt ts);
void setTimeStep(Real ts);
UInt getCurrentStep();
Real getTimeStep();
Real getEcin();
Real getEpot();
void performMigration();
void getNeighborList(RefAtom<Dim> & atom, Real distance,
std::vector<RefAtom<Dim> > & neigbhor_list);
void getSubDomainDimensions(Real * xmin,Real * xmax);
void getDomainDimensions(Real * xmin,Real * xmax);
void setDomainDimensions(const Real * xmin,const Real * xmax);
/* ------------------------------------------------------------------------ */
/* Functions for AMELCG */
/* ------------------------------------------------------------------------ */
//! return product of force by descent direction (for AMELCG)
Real getFdotDir();
//! return max of forces (for AMELCG)
Real getFMax();
//! return max of direction vector (for AMELCG)
Real getDirMax();
//! return norm 2 of forces (for AMELCG)
Real getFNorm2();
//! return stuff for AMELCG
Real getFdotOldF();
//! update direction AMELCG
void updateDirection(Real beta);
//! return stuff for AMELCG
void saveForceVector();
//! displace in descent direction with given magnitude
void displaceTowardsDirection(Real alpha);
//! returnal external work counter
double getExternalWork();
//! set amount of work done by external forces
void setExternalWork(double work);
//! returns whether an md domain is perdiodic in direction dir
virtual bool isPeriodic(UInt dir);
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
protected:
//! external work counter
double external_work;
/* -------------------------------------------------------------------------- */
//old material members
//! lammps configuration file name
std::string lammpsfile;
//! flag to unactivate every unit conversion
bool flag_units;
//! energy tolerance for the conjugate gradient minimization
Real mincg_etol;
//! force tolerance for the conjugate gradient minimization
Real mincg_ftol;
//! maximum number of force evaluation for descent step in CG minimization
UInt mincg_maxeval;
// //! The dmax parameter is how far any atom can move in a single line search in any dimension
// Quantity<Length> mincg_dmax;
//! the requested box geometry
GeomID newGeomBox;
//! the requested time when to change the box
UInt when_change_box;
UInt change_box;
LAMMPS_NS::NeighList *neig_list;
//! lattice name to be used in lammps config file generation
std::string lattice;
//! lattice length
Quantity<Length> lattice_size;
//! lattice origin
Quantity<Length,3> lattice_origin;
//!lattice spacing
Real lattice_spacing[3];
//! orientations of lattice
int lattice_orient_x[3];
int lattice_orient_y[3];
int lattice_orient_z[3];
//! boundary selection
std::string boundaries[3];
//! replica in each direction
int replica[6];
//! change to triclinic box
int triclinic;
//! amount of tilting
Quantity<Length,2> tilt;
//! flag to ask for automatic generation of the header
bool create_header_flag;
//! flag to inform the simulation is started from restart file
bool restart_start;
//! map from type to geometries
std::map<UInt,GeomID> geom_by_type;
};
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
#endif /* __LIBMULTISCALE_DOMAIN_LAMMPS_HH__ */

Event Timeline