Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
qbox-public
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
qbox
qbox-public
Commits
ce7baae5
Commit
ce7baae5
authored
Oct 19, 2007
by
Francois Gygi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed trailing blanks in *.[Ch] *.mk Makefile
git-svn-id:
http://qboxcode.org/svn/qb/trunk@515
cba15fb0-1239-40c8-b417-11db7ca47a34
parent
14e9be36
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
209 changed files
with
807 additions
and
807 deletions
+807
-807
AndersonMixer.C
src/AndersonMixer.C
+8
-8
AndersonMixer.h
src/AndersonMixer.h
+2
-2
AngleCmd.h
src/AngleCmd.h
+22
-22
AngleConstraint.C
src/AngleConstraint.C
+59
-59
AngleConstraint.h
src/AngleConstraint.h
+9
-9
Atom.h
src/Atom.h
+3
-3
AtomCmd.h
src/AtomCmd.h
+10
-10
AtomSet.C
src/AtomSet.C
+15
-15
AtomSet.h
src/AtomSet.h
+5
-5
AtomSetHandler.C
src/AtomSetHandler.C
+20
-20
AtomSetHandler.h
src/AtomSetHandler.h
+8
-8
AtomsDyn.h
src/AtomsDyn.h
+3
-3
BLYPFunctional.C
src/BLYPFunctional.C
+20
-20
BLYPFunctional.h
src/BLYPFunctional.h
+11
-11
BOSampleStepper.C
src/BOSampleStepper.C
+0
-0
BOSampleStepper.h
src/BOSampleStepper.h
+4
-4
Base64Transcoder.C
src/Base64Transcoder.C
+30
-30
Base64Transcoder.h
src/Base64Transcoder.h
+2
-2
Basis.C
src/Basis.C
+0
-0
Basis.h
src/Basis.h
+15
-15
BasisMapping.C
src/BasisMapping.C
+33
-33
BasisMapping.h
src/BasisMapping.h
+10
-10
CPSampleStepper.C
src/CPSampleStepper.C
+52
-52
CPSampleStepper.h
src/CPSampleStepper.h
+4
-4
Cell.h
src/Cell.h
+5
-5
CellDyn.h
src/CellDyn.h
+3
-3
CellLock.h
src/CellLock.h
+3
-3
CellMass.h
src/CellMass.h
+2
-2
CellStepper.h
src/CellStepper.h
+5
-5
ChargeDensity.C
src/ChargeDensity.C
+16
-16
ChargeDensity.h
src/ChargeDensity.h
+5
-5
ChargeMixCoeff.h
src/ChargeMixCoeff.h
+2
-2
ChargeMixRcut.h
src/ChargeMixRcut.h
+2
-2
ComputeMLWFCmd.C
src/ComputeMLWFCmd.C
+4
-4
ComputeMLWFCmd.h
src/ComputeMLWFCmd.h
+3
-3
ConfinementPotential.C
src/ConfinementPotential.C
+5
-5
ConfinementPotential.h
src/ConfinementPotential.h
+7
-7
Constraint.C
src/Constraint.C
+3
-3
Constraint.h
src/Constraint.h
+6
-6
ConstraintCmd.h
src/ConstraintCmd.h
+3
-3
ConstraintSet.C
src/ConstraintSet.C
+0
-0
ConstraintSet.h
src/ConstraintSet.h
+3
-3
Context.C
src/Context.C
+0
-0
Context.h
src/Context.h
+47
-47
Control.h
src/Control.h
+9
-9
D3vector.h
src/D3vector.h
+6
-6
Debug.h
src/Debug.h
+3
-3
DistanceCmd.h
src/DistanceCmd.h
+13
-13
DistanceConstraint.C
src/DistanceConstraint.C
+27
-27
DistanceConstraint.h
src/DistanceConstraint.h
+7
-7
Dt.h
src/Dt.h
+2
-2
Ecut.h
src/Ecut.h
+5
-5
Ecutprec.h
src/Ecutprec.h
+3
-3
Ecuts.h
src/Ecuts.h
+3
-3
Emass.h
src/Emass.h
+2
-2
EnergyFunctional.C
src/EnergyFunctional.C
+0
-0
EnergyFunctional.h
src/EnergyFunctional.h
+12
-12
ExtStress.h
src/ExtStress.h
+4
-4
FermiTemp.h
src/FermiTemp.h
+2
-2
FourierTransform.C
src/FourierTransform.C
+0
-0
FourierTransform.h
src/FourierTransform.h
+13
-13
HelpCmd.h
src/HelpCmd.h
+2
-2
IonicStepper.h
src/IonicStepper.h
+14
-14
LDAFunctional.C
src/LDAFunctional.C
+8
-8
LDAFunctional.h
src/LDAFunctional.h
+7
-7
ListAtomsCmd.h
src/ListAtomsCmd.h
+2
-2
ListConstraintsCmd.h
src/ListConstraintsCmd.h
+2
-2
ListSpeciesCmd.h
src/ListSpeciesCmd.h
+2
-2
LoadCmd.C
src/LoadCmd.C
+8
-8
LoadCmd.h
src/LoadCmd.h
+2
-2
MDIonicStepper.C
src/MDIonicStepper.C
+37
-37
MDIonicStepper.h
src/MDIonicStepper.h
+3
-3
MDWavefunctionStepper.C
src/MDWavefunctionStepper.C
+17
-17
MLWFTransform.C
src/MLWFTransform.C
+49
-49
MLWFTransform.h
src/MLWFTransform.h
+6
-6
Makefile
src/Makefile
+8
-8
Matrix.C
src/Matrix.C
+0
-0
Matrix.h
src/Matrix.h
+0
-0
MoveCmd.h
src/MoveCmd.h
+7
-7
Nempty.h
src/Nempty.h
+3
-3
NetCharge.h
src/NetCharge.h
+5
-5
NonLocalPotential.C
src/NonLocalPotential.C
+0
-0
NonLocalPotential.h
src/NonLocalPotential.h
+13
-13
Nrowmax.h
src/Nrowmax.h
+3
-3
PBEFunctional.C
src/PBEFunctional.C
+29
-29
PBEFunctional.h
src/PBEFunctional.h
+0
-0
PSDAWavefunctionStepper.C
src/PSDAWavefunctionStepper.C
+0
-0
PSDAWavefunctionStepper.h
src/PSDAWavefunctionStepper.h
+0
-0
PSDWavefunctionStepper.C
src/PSDWavefunctionStepper.C
+0
-0
PSDWavefunctionStepper.h
src/PSDWavefunctionStepper.h
+0
-0
Preconditioner.C
src/Preconditioner.C
+0
-0
Preconditioner.h
src/Preconditioner.h
+0
-0
PrintCmd.h
src/PrintCmd.h
+0
-0
QuitCmd.h
src/QuitCmd.h
+0
-0
RandomizeWfCmd.h
src/RandomizeWfCmd.h
+0
-0
RefCell.h
src/RefCell.h
+0
-0
ResetVcmCmd.h
src/ResetVcmCmd.h
+0
-0
RunCmd.C
src/RunCmd.C
+0
-0
RunCmd.h
src/RunCmd.h
+0
-0
SDAIonicStepper.C
src/SDAIonicStepper.C
+0
-0
SDAIonicStepper.h
src/SDAIonicStepper.h
+0
-0
SDCellStepper.C
src/SDCellStepper.C
+0
-0
SDCellStepper.h
src/SDCellStepper.h
+0
-0
SDIonicStepper.h
src/SDIonicStepper.h
+0
-0
SDWavefunctionStepper.C
src/SDWavefunctionStepper.C
+0
-0
Sample.h
src/Sample.h
+0
-0
SampleHandler.C
src/SampleHandler.C
+0
-0
SampleHandler.h
src/SampleHandler.h
+0
-0
SampleReader.C
src/SampleReader.C
+0
-0
SampleReader.h
src/SampleReader.h
+0
-0
SampleStepper.C
src/SampleStepper.C
+0
-0
SampleStepper.h
src/SampleStepper.h
+0
-0
SampleWriter.C
src/SampleWriter.C
+0
-0
SampleWriter.h
src/SampleWriter.h
+0
-0
SaveCmd.C
src/SaveCmd.C
+0
-0
SaveCmd.h
src/SaveCmd.h
+0
-0
SetCmd.h
src/SetCmd.h
+0
-0
SlaterDet.C
src/SlaterDet.C
+0
-0
SlaterDet.h
src/SlaterDet.h
+0
-0
Species.C
src/Species.C
+0
-0
Species.h
src/Species.h
+0
-0
SpeciesCmd.C
src/SpeciesCmd.C
+0
-0
SpeciesCmd.h
src/SpeciesCmd.h
+0
-0
SpeciesHandler.C
src/SpeciesHandler.C
+0
-0
SpeciesHandler.h
src/SpeciesHandler.h
+0
-0
SpeciesReader.C
src/SpeciesReader.C
+0
-0
SpeciesReader.h
src/SpeciesReader.h
+0
-0
StatusCmd.h
src/StatusCmd.h
+0
-0
Stress.h
src/Stress.h
+0
-0
StructureFactor.C
src/StructureFactor.C
+0
-0
StructureFactor.h
src/StructureFactor.h
+0
-0
StructureHandler.h
src/StructureHandler.h
+0
-0
StructuredDocumentHandler.C
src/StructuredDocumentHandler.C
+0
-0
StructuredDocumentHandler.h
src/StructuredDocumentHandler.h
+0
-0
ThTemp.h
src/ThTemp.h
+0
-0
ThTime.h
src/ThTime.h
+0
-0
ThWidth.h
src/ThWidth.h
+0
-0
Thermostat.h
src/Thermostat.h
+0
-0
Timer.h
src/Timer.h
+0
-0
TorsionCmd.h
src/TorsionCmd.h
+0
-0
TorsionConstraint.C
src/TorsionConstraint.C
+0
-0
TorsionConstraint.h
src/TorsionConstraint.h
+0
-0
UnitCell.C
src/UnitCell.C
+0
-0
UnitCell.h
src/UnitCell.h
+0
-0
UserInterface.C
src/UserInterface.C
+0
-0
UserInterface.h
src/UserInterface.h
+0
-0
Wavefunction.C
src/Wavefunction.C
+0
-0
Wavefunction.h
src/Wavefunction.h
+0
-0
WavefunctionHandler.C
src/WavefunctionHandler.C
+0
-0
WavefunctionHandler.h
src/WavefunctionHandler.h
+0
-0
WavefunctionStepper.h
src/WavefunctionStepper.h
+0
-0
WfDiag.h
src/WfDiag.h
+0
-0
WfDyn.h
src/WfDyn.h
+0
-0
XCFunctional.h
src/XCFunctional.h
+0
-0
XCPotential.C
src/XCPotential.C
+0
-0
XCPotential.h
src/XCPotential.h
+0
-0
XMLGFPreprocessor.C
src/XMLGFPreprocessor.C
+0
-0
XMLGFPreprocessor.h
src/XMLGFPreprocessor.h
+0
-0
Xc.h
src/Xc.h
+0
-0
aix64_mpi.mk
src/aix64_mpi.mk
+0
-0
aix_mpi.mk
src/aix_mpi.mk
+0
-0
aix_mpi_gcc.mk
src/aix_mpi_gcc.mk
+0
-0
aix_mpip.mk
src/aix_mpip.mk
+0
-0
bgl.mk
src/bgl.mk
+0
-0
blacs.h
src/blacs.h
+0
-0
blas.h
src/blas.h
+0
-0
fpmd.mk
src/fpmd.mk
+0
-0
fpmd_sse2.mk
src/fpmd_sse2.mk
+0
-0
hbar-gcc.mk
src/hbar-gcc.mk
+0
-0
hbar-icc.mk
src/hbar-icc.mk
+0
-0
hbar2-gcc.mk
src/hbar2-gcc.mk
+0
-0
jacobi.C
src/jacobi.C
+0
-0
jade.C
src/jade.C
+0
-0
jade.h
src/jade.h
+0
-0
linux-pc.mk
src/linux-pc.mk
+0
-0
linux-pc_mpi.mk
src/linux-pc_mpi.mk
+0
-0
linux-pc_mpi_icc.mk
src/linux-pc_mpi_icc.mk
+0
-0
linux-pc_mpi_kcc.mk
src/linux-pc_mpi_kcc.mk
+0
-0
mcr-gcc.mk
src/mcr-gcc.mk
+0
-0
mcr.mk
src/mcr.mk
+0
-0
mcr_sse2.mk
src/mcr_sse2.mk
+0
-0
pavane.mk
src/pavane.mk
+0
-0
qb.C
src/qb.C
+0
-0
spline.C
src/spline.C
+0
-0
spline.h
src/spline.h
+0
-0
testAndersonMixer.C
src/testAndersonMixer.C
+0
-0
testBase64Transcoder.C
src/testBase64Transcoder.C
+0
-0
testBasis.C
src/testBasis.C
+0
-0
testBasisMapping.C
src/testBasisMapping.C
+0
-0
testChargeDensity.C
src/testChargeDensity.C
+0
-0
testContext.C
src/testContext.C
+0
-0
testEnergyFunctional.C
src/testEnergyFunctional.C
+0
-0
testFourierTransform.C
src/testFourierTransform.C
+0
-0
testLDAFunctional.C
src/testLDAFunctional.C
+0
-0
testMatrix.C
src/testMatrix.C
+0
-0
testSample.C
src/testSample.C
+0
-0
testSlaterDet.C
src/testSlaterDet.C
+0
-0
testSpecies.C
src/testSpecies.C
+0
-0
testUnitCell.C
src/testUnitCell.C
+0
-0
testWavefunction.C
src/testWavefunction.C
+0
-0
testXCFunctional.C
src/testXCFunctional.C
+0
-0
testXMLGFPreprocessor.C
src/testXMLGFPreprocessor.C
+0
-0
test_fftw.C
src/test_fftw.C
+0
-0
testjacobi.C
src/testjacobi.C
+0
-0
testjade.C
src/testjade.C
+0
-0
x8664_gcc.mk
src/x8664_gcc.mk
+0
-0
xml2xy.C
src/xml2xy.C
+0
-0
xmlSpecies.C
src/xmlSpecies.C
+0
-0
xmlget.C
src/xmlget.C
+0
-0
No files found.
src/AndersonMixer.C
View file @
ce7baae5
...
...
@@ -3,7 +3,7 @@
// AndersonMixer.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: AndersonMixer.C,v 1.
4 2007-03-17 01:14:00
fgygi Exp $
// $Id: AndersonMixer.C,v 1.
5 2007-10-19 16:24:03
fgygi Exp $
#include "AndersonMixer.h"
#include "blas.h"
...
...
@@ -28,13 +28,13 @@ void AndersonMixer::update(const double* f, double* theta, double* fbar)
// tmp0 = delta_F = f - flast
for
(
int
i
=
0
;
i
<
n_
;
i
++
)
tmp0
[
i
]
=
f
[
i
]
-
flast_
[
i
];
// a = delta_F * F
double
a
=
ddot
(
&
n_
,
&
tmp0
[
0
],
&
ione
,
f
,
&
ione
);
// b = delta_F * delta_F
double
b
=
ddot
(
&
n_
,
&
tmp0
[
0
],
&
ione
,
&
tmp0
[
0
],
&
ione
);
if
(
pctxt_
!=
0
)
{
double
work
[
2
]
=
{
a
,
b
};
...
...
@@ -47,16 +47,16 @@ void AndersonMixer::update(const double* f, double* theta, double* fbar)
*
theta
=
-
a
/
b
;
else
*
theta
=
0
.
0
;
// test if residual has increased
if
(
*
theta
<=
-
1
.
0
)
{
*
theta
=
theta_nc_
;
}
*
theta
=
min
(
theta_max_
,
*
theta
);
}
// fbar = f + theta * ( f - flast )
// flast_ = f_
for
(
int
i
=
0
;
i
<
n_
;
i
++
)
...
...
@@ -64,6 +64,6 @@ void AndersonMixer::update(const double* f, double* theta, double* fbar)
const
double
ftmp
=
f
[
i
];
fbar
[
i
]
=
ftmp
+
*
theta
*
(
ftmp
-
flast_
[
i
]
);
flast_
[
i
]
=
ftmp
;
}
}
extrapolate_
=
true
;
}
src/AndersonMixer.h
View file @
ce7baae5
...
...
@@ -3,7 +3,7 @@
// AndersonMixer.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: AndersonMixer.h,v 1.
4 2007-03-17 01:14:00
fgygi Exp $
// $Id: AndersonMixer.h,v 1.
5 2007-10-19 16:24:03
fgygi Exp $
#ifndef ANDERSONMIXER_H
#define ANDERSONMIXER_H
...
...
@@ -18,7 +18,7 @@ class AndersonMixer
const
Context
*
const
pctxt_
;
// pointer to relevant Context, null if local
double
theta_max_
;
// maximum extrapolation
double
theta_nc_
;
// negative curvature value
std
::
valarray
<
double
>
flast_
;
// last residual
bool
extrapolate_
;
// state variable
...
...
src/AngleCmd.h
View file @
ce7baae5
...
...
@@ -3,7 +3,7 @@
// AngleCmd.h:
//
////////////////////////////////////////////////////////////////////////////////
// $Id: AngleCmd.h,v 1.
1 2005-06-27 22:35:26
fgygi Exp $
// $Id: AngleCmd.h,v 1.
2 2007-10-19 16:24:03
fgygi Exp $
#ifndef ANGLECMD_H
#define ANGLECMD_H
...
...
@@ -24,7 +24,7 @@ class AngleCmd : public Cmd
char
*
name
(
void
)
const
{
return
"angle"
;
}
char
*
help_msg
(
void
)
const
{
return
return
"
\n
angle
\n\n
"
" syntax: angle name1 name2 name3
\n\n
"
" The angle command prints the angle defined by three atoms.
\n\n
"
;
...
...
@@ -40,15 +40,15 @@ class AngleCmd : public Cmd
}
return
1
;
}
string
name1
(
argv
[
1
]);
string
name2
(
argv
[
2
]);
string
name3
(
argv
[
3
]);
Atom
*
a1
=
s
->
atoms
.
findAtom
(
name1
);
Atom
*
a2
=
s
->
atoms
.
findAtom
(
name2
);
Atom
*
a3
=
s
->
atoms
.
findAtom
(
name3
);
if
(
a1
==
0
||
a2
==
0
||
a3
==
0
)
{
string
name1
(
argv
[
1
]);
string
name2
(
argv
[
2
]);
string
name3
(
argv
[
3
]);
Atom
*
a1
=
s
->
atoms
.
findAtom
(
name1
);
Atom
*
a2
=
s
->
atoms
.
findAtom
(
name2
);
Atom
*
a3
=
s
->
atoms
.
findAtom
(
name3
);
if
(
a1
==
0
||
a2
==
0
||
a3
==
0
)
{
if
(
ui
->
onpe0
()
)
{
if
(
a1
==
0
)
...
...
@@ -63,28 +63,28 @@ class AngleCmd : public Cmd
}
return
1
;
}
if
(
a1
==
a2
||
a2
==
a3
||
a3
==
a1
)
{
if
(
a1
==
a2
||
a2
==
a3
||
a3
==
a1
)
{
if
(
ui
->
onpe0
()
)
{
cout
<<
" <!-- AngleCmd: replicated atoms in "
<<
name1
<<
" "
<<
name2
<<
" "
<<
name3
<<
" -->"
<<
endl
;
cout
<<
" <!-- AngleCmd: replicated atoms in "
<<
name1
<<
" "
<<
name2
<<
" "
<<
name3
<<
" -->"
<<
endl
;
}
return
1
;
}
D3vector
r12
(
a1
->
position
()
-
a2
->
position
());
D3vector
r32
(
a3
->
position
()
-
a2
->
position
());
if
(
norm
(
r12
)
==
0
.
0
||
norm
(
r32
)
==
0
.
0
)
{
{
if
(
ui
->
onpe0
()
)
{
cout
<<
" <!-- AngleCmd: atoms are too close -->"
<<
endl
;
}
return
1
;
}
const
double
sp
=
normalized
(
r12
)
*
normalized
(
r32
);
const
double
c
=
max
(
-
1
.
0
,
min
(
1
.
0
,
sp
));
const
double
a
=
(
180
.
0
/
M_PI
)
*
acos
(
c
);
...
...
@@ -92,9 +92,9 @@ class AngleCmd : public Cmd
{
cout
.
setf
(
ios
::
fixed
,
ios
::
floatfield
);
cout
<<
" <!-- angle "
<<
name1
<<
"-"
<<
name2
<<
"-"
<<
name3
<<
": "
<<
setprecision
(
3
)
<<
a
<<
" (deg) -->"
<<
endl
;
<<
": "
<<
setprecision
(
3
)
<<
a
<<
" (deg) -->"
<<
endl
;
}
return
0
;
}
...
...
src/AngleConstraint.C
View file @
ce7baae5
...
...
@@ -3,7 +3,7 @@
// AngleConstraint.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: AngleConstraint.C,v 1.
2 2005-09-16 23:08:11
fgygi Exp $
// $Id: AngleConstraint.C,v 1.
3 2007-10-19 16:24:03
fgygi Exp $
#include "AngleConstraint.h"
#include "AtomSet.h"
...
...
@@ -26,7 +26,7 @@ void AngleConstraint::setup(const AtomSet& atoms)
m1_
=
atoms
.
species_list
[
is1_
]
->
mass
()
*
1822
.
89
;
assert
(
m1_
>
0
.
0
);
m1_inv_
=
1
.
0
/
m1_
;
is2_
=
atoms
.
is
(
name2_
);
ia2_
=
atoms
.
ia
(
name2_
);
assert
(
is2_
>=
0
);
...
...
@@ -34,7 +34,7 @@ void AngleConstraint::setup(const AtomSet& atoms)
m2_
=
atoms
.
species_list
[
is2_
]
->
mass
()
*
1822
.
89
;
assert
(
m2_
>
0
.
0
);
m2_inv_
=
1
.
0
/
m2_
;
is3_
=
atoms
.
is
(
name3_
);
ia3_
=
atoms
.
ia
(
name3_
);
assert
(
is3_
>=
0
);
...
...
@@ -63,7 +63,7 @@ vector<vector<double> > &rp) const
double
*
pr1p
=
&
rp
[
is1_
][
3
*
ia1_
];
double
*
pr2p
=
&
rp
[
is2_
][
3
*
ia2_
];
double
*
pr3p
=
&
rp
[
is3_
][
3
*
ia3_
];
D3vector
r1
(
pr1
);
D3vector
r2
(
pr2
);
D3vector
r3
(
pr3
);
...
...
@@ -72,7 +72,7 @@ vector<vector<double> > &rp) const
const
double
a
=
bond_angle
(
r1
,
r2
,
r3
);
double
ng
=
g1
*
g1
+
g2
*
g2
+
g3
*
g3
;
assert
(
ng
>=
0
.
0
);
D3vector
r1p
(
pr1p
);
D3vector
r2p
(
pr2p
);
D3vector
r3p
(
pr3p
);
...
...
@@ -81,7 +81,7 @@ vector<vector<double> > &rp) const
const
double
ap
=
bond_angle
(
r1p
,
r2p
,
r3p
);
const
double
ngp
=
g1p
*
g1p
+
g2p
*
g2p
+
g3p
*
g3p
;
assert
(
ngp
>=
0
.
0
);
const
double
err
=
fabs
(
ap
-
angle_
);
if
(
ng
==
0
.
0
)
...
...
@@ -119,25 +119,25 @@ vector<vector<double> > &rp) const
// no action necessary
}
}
// test alignment of the gradient at r and at rp
// compute scalar product of normalized gradients
const
double
sp
=
(
g1
*
g1p
+
g2
*
g2p
+
g3
*
g3p
)
/
sqrt
(
ng
*
ngp
);
if
(
fabs
(
sp
)
<
0
.
5
*
sqrt
(
3
.
0
)
)
{
g1
=
g1p
;
g2
=
g2p
;
g3
=
g3p
;
g1
=
g1p
;
g2
=
g2p
;
g3
=
g3p
;
}
const
double
den
=
m1_inv_
*
g1
*
g1p
+
const
double
den
=
m1_inv_
*
g1
*
g1p
+
m2_inv_
*
g2
*
g2p
+
m3_inv_
*
g3
*
g3p
;
#if DEBUG_CONSTRAINTS
cout
<<
" <!-- "
;
cout
<<
" AngleConstraint::enforce_r: "
cout
<<
" AngleConstraint::enforce_r: "
<<
name1_
<<
" "
<<
name2_
<<
" "
<<
name3_
<<
" angle = "
<<
ap
<<
endl
;
cout
<<
" AngleConstraint::enforce_r: r1 = "
<<
r1
<<
endl
;
...
...
@@ -159,25 +159,25 @@ vector<vector<double> > &rp) const
cout
<<
" -->"
<<
endl
;
#endif
if
(
err
<
tol_
)
return
true
;
// make one shake iteration
assert
(
fabs
(
den
)
>
0
.
0
);
const
double
lambda
=
-
sigma
(
r1p
,
r2p
,
r3p
)
/
den
;
pr1p
[
0
]
+=
m1_inv_
*
lambda
*
g1
.
x
;
pr1p
[
1
]
+=
m1_inv_
*
lambda
*
g1
.
y
;
pr1p
[
2
]
+=
m1_inv_
*
lambda
*
g1
.
z
;
pr2p
[
0
]
+=
m2_inv_
*
lambda
*
g2
.
x
;
pr2p
[
1
]
+=
m2_inv_
*
lambda
*
g2
.
y
;
pr2p
[
2
]
+=
m2_inv_
*
lambda
*
g2
.
z
;
pr3p
[
0
]
+=
m3_inv_
*
lambda
*
g3
.
x
;
pr3p
[
1
]
+=
m3_inv_
*
lambda
*
g3
.
y
;
pr3p
[
2
]
+=
m3_inv_
*
lambda
*
g3
.
z
;
return
false
;
}
...
...
@@ -191,30 +191,30 @@ vector<vector<double> > &v0) const
double
*
pv1
=
&
v0
[
is1_
][
3
*
ia1_
];
double
*
pv2
=
&
v0
[
is2_
][
3
*
ia2_
];
double
*
pv3
=
&
v0
[
is3_
][
3
*
ia3_
];
D3vector
r1
(
pr1
);
D3vector
r2
(
pr2
);
D3vector
r3
(
pr3
);
D3vector
g1
,
g2
,
g3
;
grad_sigma
(
r1
,
r2
,
r3
,
g1
,
g2
,
g3
);
D3vector
v1
(
pv1
);
D3vector
v2
(
pv2
);
D3vector
v3
(
pv3
);
const
double
proj
=
v1
*
g1
+
v2
*
g2
+
v3
*
g3
;
const
double
norm2
=
g1
*
g1
+
g2
*
g2
+
g3
*
g3
;
// if the gradient is too small, do not attempt correction
if
(
norm2
<
1.e-6
)
return
true
;
const
double
err
=
fabs
(
proj
)
/
sqrt
(
norm2
);
#if DEBUG_CONSTRAINTS
cout
<<
" <!-- "
;
cout
<<
" AngleConstraint::enforce_v: "
cout
<<
" AngleConstraint::enforce_v: "
<<
name1_
<<
" "
<<
name2_
<<
" "
<<
name3_
<<
endl
;
cout
<<
" AngleConstraint::enforce_v: tol = "
<<
tol_
<<
endl
;
cout
<<
" AngleConstraint::enforce_v: err = "
<<
err
<<
endl
;
...
...
@@ -224,27 +224,27 @@ vector<vector<double> > &v0) const
cout
<<
" -->"
<<
endl
;
#endif
if
(
err
<
tol_
)
return
true
;
// make one shake iteration
const
double
den
=
m1_inv_
*
g1
*
g1
+
const
double
den
=
m1_inv_
*
g1
*
g1
+
m2_inv_
*
g2
*
g2
+
m3_inv_
*
g3
*
g3
;
assert
(
den
>
0
.
0
);
const
double
eta
=
-
proj
/
den
;
pv1
[
0
]
+=
m1_inv_
*
eta
*
g1
.
x
;
pv1
[
1
]
+=
m1_inv_
*
eta
*
g1
.
y
;
pv1
[
2
]
+=
m1_inv_
*
eta
*
g1
.
z
;
pv2
[
0
]
+=
m2_inv_
*
eta
*
g2
.
x
;
pv2
[
1
]
+=
m2_inv_
*
eta
*
g2
.
y
;
pv2
[
2
]
+=
m2_inv_
*
eta
*
g2
.
z
;
pv3
[
0
]
+=
m3_inv_
*
eta
*
g3
.
x
;
pv3
[
1
]
+=
m3_inv_
*
eta
*
g3
.
y
;
pv3
[
2
]
+=
m3_inv_
*
eta
*
g3
.
z
;
return
false
;
}
...
...
@@ -258,30 +258,30 @@ void AngleConstraint::compute_force(const vector<vector<double> > &r0,
const
double
*
pf1
=
&
f
[
is1_
][
3
*
ia1_
];
const
double
*
pf2
=
&
f
[
is2_
][
3
*
ia2_
];
const
double
*
pf3
=
&
f
[
is3_
][
3
*
ia3_
];
D3vector
r1
(
pr1
);
D3vector
r2
(
pr2
);
D3vector
r3
(
pr3
);
D3vector
g1
,
g2
,
g3
;
grad_sigma
(
r1
,
r2
,
r3
,
g1
,
g2
,
g3
);
D3vector
f1
(
pf1
);
D3vector
f2
(
pf2
);
D3vector
f3
(
pf3
);
const
double
norm2
=
g1
*
g1
+
g2
*
g2
+
g3
*
g3
;
if
(
norm2
==
0
.
0
)
{
force_
=
0
.
0
;
return
;
}
const
double
proj
=
f1
*
g1
+
f2
*
g2
+
f3
*
g3
;
force_
=
-
proj
/
norm2
;
// compute weight
const
double
z
=
m1_inv_
*
g1
*
g1
+
const
double
z
=
m1_inv_
*
g1
*
g1
+
m2_inv_
*
g2
*
g2
+
m3_inv_
*
g3
*
g3
;
assert
(
z
>
0
.
0
);
...
...
@@ -292,10 +292,10 @@ void AngleConstraint::compute_force(const vector<vector<double> > &r0,
const
double
r32s
=
norm
(
r3
-
r2
);
const
double
fac
=
180
.
0
/
M_PI
;
const
double
cos_theta
=
normalized
(
r1
-
r2
)
*
normalized
(
r3
-
r2
);
const
double
zcheck
=
fac
*
fac
*
const
double
zcheck
=
fac
*
fac
*
(
m1_inv_
/
r12s
+
m2_inv_
*
(
(
r12s
+
r32s
-
2
*
sqrt
(
r12s
*
r32s
)
*
cos_theta
)
/
(
r12s
*
r32s
)
)
+
m3_inv_
/
r32s
m3_inv_
/
r32s
);
cout
<<
" <!-- AngleConstraint: z="
<<
z
<<
" zcheck="
<<
zcheck
<<
" -->"
<<
endl
;
...
...
@@ -310,7 +310,7 @@ double AngleConstraint::sigma(D3vector a, D3vector b, D3vector c) const
}
////////////////////////////////////////////////////////////////////////////////
void
AngleConstraint
::
grad_sigma
(
const
D3vector
&
r1
,
const
D3vector
&
r2
,
void
AngleConstraint
::
grad_sigma
(
const
D3vector
&
r1
,
const
D3vector
&
r2
,
const
D3vector
&
r3
,
D3vector
&
g1
,
D3vector
&
g2
,
D3vector
&
g3
)
const
{
...
...
@@ -321,7 +321,7 @@ void AngleConstraint::grad_sigma(const D3vector &r1, const D3vector &r2,
D3vector
e12
(
normalized
(
r12
));
D3vector
e32
(
normalized
(
r32
));
const
double
ss
=
length
(
e12
^
e32
);
// use simplified expression if the angle is smaller than 0.2 degrees
if
(
ss
<
sin
(
0
.
2
*
(
M_PI
/
180
.
0
)
)
)
{
...
...
@@ -351,43 +351,43 @@ void AngleConstraint::grad_sigma(const D3vector &r1, const D3vector &r2,
{
// angle is large enough. Use finite differences
//cout << " ========= grad_sigma using finite differences" << endl;
const
double
r12_inv
=
1
.
0
/
length
(
r12
);
const
double
r32_inv
=
1
.
0
/
length
(
r32
);
const
double
a
=
bond_angle
(
r1
,
r2
,
r3
);
const
double
l12
=
length
(
r1
-
r2
);
const
double
l32
=
length
(
r3
-
r2
);
// displacement h causes changes in angle of less than 0.05 degrees
const
double
h
=
0
.
05
*
(
M_PI
/
180
.
0
)
*
min
(
l12
,
l32
);
const
double
fac
=
0
.
5
/
h
;
D3vector
dx
(
h
,
0
,
0
),
dy
(
0
,
h
,
0
),
dz
(
0
,
0
,
h
);
// compute gradient at r
g1
.
x
=
fac
*
(
sigma
(
r1
+
dx
,
r2
,
r3
)
-
sigma
(
r1
-
dx
,
r2
,
r3
)
);
g1
.
y
=
fac
*
(
sigma
(
r1
+
dy
,
r2
,
r3
)
-
sigma
(
r1
-
dy
,
r2
,
r3
)
);
g1
.
z
=
fac
*
(
sigma
(
r1
+
dz
,
r2
,
r3
)
-
sigma
(
r1
-
dz
,
r2
,
r3
)
);
g2
.
x
=
fac
*
(
sigma
(
r1
,
r2
+
dx
,
r3
)
-
sigma
(
r1
,
r2
-
dx
,
r3
)
);
g2
.
y
=
fac
*
(
sigma
(
r1
,
r2
+
dy
,
r3
)
-
sigma
(
r1
,
r2
-
dy
,
r3
)
);
g2
.
z
=
fac
*
(
sigma
(
r1
,
r2
+
dz
,
r3
)
-
sigma
(
r1
,
r2
-
dz
,
r3
)
);
g3
.
x
=
fac
*
(
sigma
(
r1
,
r2
,
r3
+
dx
)
-
sigma
(
r1
,
r2
,
r3
-
dx
)
);
g3
.
y
=
fac
*
(
sigma
(
r1
,
r2
,
r3
+
dy
)
-
sigma
(
r1
,
r2
,
r3
-
dy
)
);
g3
.
z
=
fac
*
(
sigma
(
r1
,
r2
,
r3
+
dz
)
-
sigma
(
r1
,
r2
,
r3
-
dz
)
);
}
}
}
////////////////////////////////////////////////////////////////////////////////
double
AngleConstraint
::
bond_angle
(
D3vector
a
,
D3vector
b
,
D3vector
c
)
const
{
// compute the bond angle defined by vectors a,b,c
D3vector
e12
(
normalized
(
a
-
b
));
D3vector
e32
(
normalized
(
c
-
b
));
const
double
ss
=
length
(
e12
^
e32
);
const
double
cc
=
e12
*
e32
;
double
an
=
(
180
.
0
/
M_PI
)
*
atan2
(
ss
,
cc
);
const
double
ss
=
length
(
e12
^
e32
);
const
double
cc
=
e12
*
e32
;
double
an
=
(
180
.
0
/
M_PI
)
*
atan2
(
ss
,
cc
);
return
an
;
}
...
...
src/AngleConstraint.h
View file @
ce7baae5
...
...
@@ -3,7 +3,7 @@
// AngleConstraint.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: AngleConstraint.h,v 1.
3 2007-03-17 01:14:00
fgygi Exp $
// $Id: AngleConstraint.h,v 1.
4 2007-10-19 16:24:03
fgygi Exp $
#ifndef ANGLECONSTRAINT_H
#define ANGLECONSTRAINT_H
...
...
@@ -24,16 +24,16 @@ class AngleConstraint : public Constraint
void
grad_sigma
(
const
D3vector
&
r1
,
const
D3vector
&
r2
,
const
D3vector
&
r3
,
D3vector
&
g1
,
D3vector
&
g2
,
D3vector
&
g3
)
const
;
double
bond_angle
(
D3vector
a
,
D3vector
b
,
D3vector
c
)
const
;
public
:
AngleConstraint
(
std
::
string
name
,
std
::
string
name1
,
AngleConstraint
(
std
::
string
name
,
std
::
string
name1
,
std
::
string
name2
,
std
::
string
name3
,
double
angle
,
double
velocity
,
double
tolerance
)
:
name1_
(
name1
),
name2_
(
name2
),
name3_
(
name3
),
name1_
(
name1
),
name2_
(
name2
),
name3_
(
name3
),
velocity_
(
velocity
),
tol_
(
tolerance
),
m1_
(
0
.
0
),
m2_
(
0
.
0
),
m3_
(
0
.
0
)
{
{
set_value
(
angle
);
name_
=
name
;
names_
.
resize
(
3
);
...
...
@@ -43,7 +43,7 @@ class AngleConstraint : public Constraint
force_
=
0
.
0
;
weight_
=
1
.
0
;
}
std
::
string
type
(
void
)
const
{
return
"angle"
;
}
double
value
(
void
)
const
{
return
angle_
;
}
double
velocity
(
void
)
const
{
return
velocity_
;
}
...
...
@@ -60,7 +60,7 @@ class AngleConstraint : public Constraint
{
velocity_
=
velocity
;
}
void
setup
(
const
AtomSet
&
atoms
);
void
update
(
double
dt
);
bool
enforce_r
(
const
std
::
vector
<
std
::
vector
<
double
>
>
&
r0
,
...
...
@@ -70,6 +70,6 @@ class AngleConstraint : public Constraint
void
compute_force
(
const
std
::
vector
<
std
::
vector
<
double
>
>
&
r0
,
const
std
::
vector
<
std
::
vector
<
double
>
>
&
f
);
std
::
ostream
&
print
(
std
::
ostream
&
os
);
};
#endif
src/Atom.h
View file @
ce7baae5
...
...
@@ -3,7 +3,7 @@
// Atom.h:
//
////////////////////////////////////////////////////////////////////////////////
// $Id: Atom.h,v 1.
3 2007-03-17 01:14:00
fgygi Exp $
// $Id: Atom.h,v 1.
4 2007-10-19 16:24:03
fgygi Exp $
#ifndef ATOM_H
#define ATOM_H
...
...
@@ -14,7 +14,7 @@
class
Atom
{
private
:
std
::
string
name_
;
std
::
string
species_
;
D3vector
position_
;
...
...
@@ -22,7 +22,7 @@ class Atom
public
:
Atom
(
std
::
string
name
,
std
::
string
species
,
Atom
(
std
::
string
name
,
std
::
string
species
,
D3vector
position
,
D3vector
velocity
);
std
::
string
name
(
void
)
{
return
name_
;
};
std
::
string
species
(
void
)
{
return
species_
;
};
...
...
src/AtomCmd.h
View file @
ce7baae5
...
...
@@ -3,7 +3,7 @@
// AtomCmd.h:
//
////////////////////////////////////////////////////////////////////////////////
// $Id: AtomCmd.h,v 1.
7 2007-03-17 01:14:00
fgygi Exp $
// $Id: AtomCmd.h,v 1.
8 2007-10-19 16:24:03
fgygi Exp $
#ifndef ATOMCMD_H
#define ATOMCMD_H
...
...
@@ -25,7 +25,7 @@ class AtomCmd : public Cmd
char
*
name
(
void
)
const
{
return
"atom"
;
}
char
*
help_msg
(
void
)
const
{
return
return
"
\n
atom
\n\n
"
" syntax: atom name species x y z [vx vy vz]
\n\n
"
" The atom command defines a new atom and adds it to the atom list.
\n
"
...
...
@@ -41,7 +41,7 @@ class AtomCmd : public Cmd
string
species
;
D3vector
position
;
D3vector
velocity
;
// atom must be defined with either 3 or 6 arguments
if
(
argc
!=
6
&&
argc
!=
9
)
{
...
...
@@ -49,7 +49,7 @@ class AtomCmd : public Cmd
cout
<<
" use: atom name species x y z [vx vy vz]"
<<
endl
;
return
1
;
}
name
=
argv
[
1
];
species
=
argv
[
2
];
position
.
x
=
atof
(
argv
[
3
]);
...
...
@@ -61,10 +61,10 @@ class AtomCmd : public Cmd
velocity
.
y
=
atof
(
argv
[
7
]);
velocity
.
z
=
atof
(
argv
[
8
]);
}
Atom
*
a
=
new
Atom
(
name
,
species
,
position
,
velocity
);
const
int
atoms_nel_before
=
s
->
atoms
.
nel
();
const
int
atoms_nel_before
=
s
->
atoms
.
nel
();
if
(
!
(
s
->
atoms
.
addAtom
(
a
)
)
)
{
if
(
ui
->
onpe0
()
)
...
...
@@ -73,9 +73,9 @@ class AtomCmd : public Cmd
return
1
;
}
const
int
atoms_nel_after
=
s
->
atoms
.
nel
();
const
int
delta_nel
=
atoms_nel_after
-
atoms_nel_before
;
const
int
delta_nel
=
atoms_nel_after
-
atoms_nel_before
;
const
int
wf_nel
=
s
->
wf
.
nel
();
s
->
wf
.
set_nel
(
wf_nel
+
delta_nel
);
s
->
wf
.
update_occ
(
0
.
0
);
if
(
s
->
wfv
!=
0
)
...
...
@@ -83,7 +83,7 @@ class AtomCmd : public Cmd
s
->
wfv
->
set_nel
(
wf_nel
+
delta_nel
);
s
->
wfv
->
clear
();
}
return
0
;
}
};
...
...
src/AtomSet.C
View file @
ce7baae5
...
...
@@ -3,7 +3,7 @@
// AtomSet.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: AtomSet.C,v 1.1
6 2007-10-16 18:23:20
fgygi Exp $
// $Id: AtomSet.C,v 1.1
7 2007-10-19 16:24:03
fgygi Exp $
#include "AtomSet.h"
#include "Species.h"
...
...
@@ -23,10 +23,10 @@ bool AtomSet::addSpecies(Species* sp, string name)
<<
" is already defined"
<<
endl
;
return
false
;
}
const
double
rcps
=
1
.
0
;
sp
->
initialize
(
rcps
);
// create new entry in species list
species_list
.
push_back
(
sp
);
spname
.
push_back
(
name
);
...
...
@@ -34,7 +34,7 @@ bool AtomSet::addSpecies(Species* sp, string name)
na_
.
insert
(
map
<
string
,
int
>::
value_type
(
name
,
0
));
atom_list
.
resize
(
atom_list
.
size
()
+
1
);