Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 52 additions & 38 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,49 +1,63 @@
---
Language: Cpp
BasedOnStyle: Microsoft
BasedOnStyle: LLVM

AlwaysBreakTemplateDeclarations: Yes
ColumnLimit: 120

AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
#AlwaysBreakTemplateDeclarations: Yes
#
#AllowAllArgumentsOnNextLine: false
#AllowAllParametersOfDeclarationOnNextLine: false
BinPackArguments: false
BinPackParameters: false

BreakBeforeBinaryOperators: All
BreakBeforeTernaryOperators: true

Cpp11BracedListStyle: true
FixNamespaceComments: true

# InsertBraces: true # only for clang-format version15.0.0 or later

# About include
IncludeBlocks: Regroup
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''

PackArguments:
BinPack: UseBreakAfter
BreakAfter: 3
PackParameters:
BinPack: UseBreakAfter
BreakAfter: 3
#
#BreakBeforeBinaryOperators: None
#BreakBeforeTernaryOperators: true
BreakBeforeBraces: Allman
BreakAfterOpenBracketFunction: true
AlignAfterOpenBracket: DontAlign
#
#Cpp11BracedListStyle: true
#FixNamespaceComments: true
#
InsertBraces: true # only for clang-format version15.0.0 or later
#
## About include
#IncludeBlocks: Regroup
#IncludeIsMainRegex: '([-_](test|unittest))?$'
#IncludeIsMainSourceRegex: ''
#
IndentWidth: 4
IndentWrappedFunctionNames: true

# About Point
DerivePointerAlignment: false
PointerAlignment: Left

ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true

# About space
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
#IndentWrappedFunctionNames: true
#
## About Point
#DerivePointerAlignment: false
#PointerAlignment: Left
PenaltyBreakBeforeMemberAccess: 1000
PenaltyBreakScopeResolution: 1000

#
#ReflowComments: true
#SortIncludes: true
#SortUsingDeclarations: true
#
## About space
#SpaceAfterCStyleCast: false
#SpaceAfterLogicalNot: false
#SpaceBeforeRangeBasedForLoopColon: false
#SpaceInEmptyParentheses: false
#SpacesInAngles: false
#SpacesInCStyleCastParentheses: false
#SpacesInContainerLiterals: false
#SpacesInParentheses: false
#SpacesInSquareBrackets: false
#
Standard: c++11
TabWidth: 4
UseTab: Never
Expand Down
19 changes: 8 additions & 11 deletions source/source_esolver/esolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ namespace ModuleESolver
class ESolver
{
public:
ESolver()
{
classname = "ESolver";
}
ESolver() { classname = "ESolver"; }

virtual ~ESolver()
{
Expand All @@ -25,34 +22,34 @@ class ESolver
}

//! initialize the energy solver by using input parameters and cell modules
virtual void before_all_runners(BaseCell& cell, const Input_para& inp) = 0;
virtual void before_all_runners(BaseCell &cell, const Input_para &inp) = 0;

//! run energy solver
virtual void runner(BaseCell& cell, const int istep) = 0;
virtual void runner(BaseCell &cell, const int istep) = 0;

//! perform post processing calculations
virtual void after_all_runners(BaseCell& cell) = 0;
virtual void after_all_runners(BaseCell &cell) = 0;

//! deal with exx and other calculation than scf/md/relax/cell-relax:
//! such as nscf, get_wf and get_pchg
virtual void others(BaseCell&, const int) {}
virtual void others(BaseCell &, const int) {}

//! calculate total energy of a given system
virtual double cal_energy() = 0;

//! calcualte forces for the atoms in the given cell
virtual void cal_force(BaseCell& cell, ModuleBase::matrix& force) = 0;
virtual void cal_force(BaseCell &cell, ModuleBase::matrix &force) = 0;

//! calcualte stress of given cell
virtual void cal_stress(BaseCell& cell, ModuleBase::matrix& stress) = 0;
virtual void cal_stress(BaseCell &cell, ModuleBase::matrix &stress) = 0;

bool conv_esolver = true; // whether esolver is converged

std::string classname;

protected:
/// Bound in before_all_runners; members use inp_->xxx instead of PARAM.inp.xxx
const Input_para* inp_ = nullptr;
const Input_para *inp_ = nullptr;
};

} // namespace ModuleESolver
Expand Down
Loading
Loading