Standard Electrode Potentials and Temperature Coefficients ...
Comparison of model potentials for molecular dynamics ...
-
Upload
khangminh22 -
Category
Documents
-
view
1 -
download
0
Transcript of Comparison of model potentials for molecular dynamics ...
Comparison of model potentials for moleculardynamics simulation of crystalline silica
Dissertation
zur Erlangung des Grades,,Doktor der Naturwissenschaften“
am Fachbereich Physikder Johannes Gutenberg–Universitat
Mainz
vorgelegt von
Daniel Herzbach
geboren in Frankfurt (Main)
Mainz, im Juni 2004
Abstract
Simulating SiO2 with the two-body potential developed by van Beest, Kramers, and van Santen(BKS) produces many satisfactory results but also characteristic flaws. We investigate thesefailures of the BKS potential and compare the performance of the BKS potential with that oftwo recently suggested potential energy surfaces that effectively incorporate many-body inter-actions. One approach, which is called the fluctuating-charge model, allows the ionic chargesto adjust depending on the chemical environment. The other approach assumes fixed, effectivecharges but allows for inducible dipole moments on the oxygen atoms.The emphasis in this work is placed on situations where BKS fails. We show that an anomalyin the ratio of quartz’s two independent lattice constantsa andc, which is observed experimen-tally at the transition betweenα andβ-quartz, is missing with BKS. Cristobalite and tridymiteappear mechanically unstable with BKS when periodic boundary conditions are employedthat are compatible with competing high-density silica polymorphs. Lastly, the BKS densityof states (DOS) shows characteristic discrepancies from the true DOS.The fluctuating-charge model slightly improves the phononic density of states and correctlyproduces stable cristobalite, but it does fail to show the experimentally observedc/a anomalyat theα-β transition. Moreover, many properties are reproduced much less satisfactorily thanwith BKS.The fluctuating dipole model remedies all mentioned artifacts. We confirm the view that theproper behaviour in thec/a ratio is due to the distortion of SiO4 tetrahedra. These distortionscan in turn be shown to be due to the many-body effects incorporated in the fluctuating dipolepotential.In addition, the pressure-induced phase transition inα quartz is studied. All three models showa transition at similar pressures to the same crystalline phase, which is probably the same asthat found experimentally for the high-pressure polymorph called quartz II. On decompres-sion, the BKS potential predicts the formation of an unknown phase at ambient pressures,while in the two other approaches the quartz II phase reverts toα-quartz with an intermediatephase similar to quartz II.Furthermore we show that the fluctuating-charge potential is the only known model potentialto predict the right pressure for a phase transition between two sixfold coordinated stishovitepolymorphs.We suggest two different methods to calculate piezoelectric coefficients in classical moleculardynamics simulation in the constant stress ensemble. We find that BKS reproduces experi-mental data reasonably well. However, the results for the fluctuating dipole potential turn outto underestimate the experimental data by more than 50%, unless the coupling of the electricalfield to the dipoles is switched off. We also show that there is a strong correlation between themagnitude of the dipoles and the bond-bending angles on the oxygen atoms and speculate thatquantum chemical effects that are non-electrostatic in nature were (successfully) parametrizedas inducible dipoles. With this interpretation, the fluctuating dipole potential always appearsto be closest to available experimental data out of the three approaches.
i
Contents
Introduction 1
1. Simulation Techniques and Model Potentials 61.1. Molecular Dynamics Techniques. . . . . . . . . . . . . . . . . . . . 6
1.1.1. Parrinello-Rahman Barostat. . . . . . . . . . . . . . . . . . 71.1.2. Gear Predictor Corrector Integrator. . . . . . . . . . . . . . 81.1.3. Langevin Thermostat. . . . . . . . . . . . . . . . . . . . . . 91.1.4. Interactions. . . . . . . . . . . . . . . . . . . . . . . . . . . 101.1.5. Ewald Summation. . . . . . . . . . . . . . . . . . . . . . . 10
1.2. BKS Potential. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.3. Fluctuating Charge Potential. . . . . . . . . . . . . . . . . . . . . . 12
1.3.1. Charge Equilibration Algorithm. . . . . . . . . . . . . . . . 121.3.2. Direct solution . . . . . . . . . . . . . . . . . . . . . . . . . 141.3.3. Extended Lagrangian. . . . . . . . . . . . . . . . . . . . . . 151.3.4. Morse-Stretch QEq Potential. . . . . . . . . . . . . . . . . . 161.3.5. Alternative Morse-Stretch fluc-Q Potential. . . . . . . . . . 181.3.6. Kinetic Parameters for Extended Lagrangian. . . . . . . . . 19
1.4. Fluctuating Dipole Model. . . . . . . . . . . . . . . . . . . . . . . . 201.5. Comparison of Performance. . . . . . . . . . . . . . . . . . . . . . 22
2. The α-β Quartz Transition 242.1. Transition Temperature. . . . . . . . . . . . . . . . . . . . . . . . . 262.2. Hysteresis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292.3. Thermal Expansion and c/a Ratio. . . . . . . . . . . . . . . . . . . . 30
2.3.1. Influence of Specific Properties of the Potentials. . . . . . . 322.4. Distortion of Tetrahedra. . . . . . . . . . . . . . . . . . . . . . . . . 34
2.4.1. Influence of Atomic Bond Character. . . . . . . . . . . . . . 372.5. Elastic Constants. . . . . . . . . . . . . . . . . . . . . . . . . . . . 392.6. Phonon Density of States. . . . . . . . . . . . . . . . . . . . . . . . 43
3. Pressure-Driven Transitions in α-Quartz 473.1. Quartz II Transition in Simulations. . . . . . . . . . . . . . . . . . . 48
3.1.1. Transition Path Ways. . . . . . . . . . . . . . . . . . . . . . 493.2. Quartz II b. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513.3. X-Ray Diffraction Spectra. . . . . . . . . . . . . . . . . . . . . . . 52
iii
Contents
3.4. Other High-Pressure Phases. . . . . . . . . . . . . . . . . . . . . . 54
4. Silica Polymorphs Other Than Quartz 564.1. Cristobalite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564.2. Tridymite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574.3. Stishovite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.3.1. High-Pressure Behaviour. . . . . . . . . . . . . . . . . . . . 61
5. Electromechanical and Dielectric Properties 635.1. Theory and Methods. . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.1.1. Linear Response. . . . . . . . . . . . . . . . . . . . . . . . 645.1.2. Ambiguity of the dipole and its fluctuation. . . . . . . . . . 675.1.3. Fluctuation estimators for dipoles. . . . . . . . . . . . . . . 685.1.4. Direct estimators with noise reduction. . . . . . . . . . . . . 69
5.2. Temperature Dependence of d11 in Quartz . . . . . . . . . . . . . . . 715.3. Pressure Dependence of d11 in α-Quartz. . . . . . . . . . . . . . . . 745.4. Bond-Angle Dependence of the Dipole Moment. . . . . . . . . . . . 75
6. Conclusion and Outlook 77
A. Calculations 81A.1. Calculations for Fluc-Q Potential. . . . . . . . . . . . . . . . . . . . 81
A.1.1. Direct Solution of Charge Equilibration Equations. . . . . . 81A.1.2. Two Body Slater Integral. . . . . . . . . . . . . . . . . . . . 82
B. Programs 85B.1. Molecular Dynamics Code. . . . . . . . . . . . . . . . . . . . . . . 85
B.1.1. Inputfiles . . . . . . . . . . . . . . . . . . . . . . . . . . . .147B.2. Analysis Programs. . . . . . . . . . . . . . . . . . . . . . . . . . .148
List of Figures 158
Bibliography 164
iv
Introduction
Almost a century ago, the discovery of quantum mechanics allowed one to describe thefundamental interactions of ions and electrons in matter. Even some decades earlier,the equations of statistical mechanics were formulated, which relate the microscopicinteractions of ions and electrons to the resulting macroscopic properties of a givenmaterial. However it is generally not possible to solve these equations analytically forcomplex materials in order to predict their properties. Dirac expressed the problemin 1929 as follows: “The fundamental laws necessary for the mathematical treatmentof large parts of physics and the whole of chemistry are thus fully known, and thedifficulty lies only in the fact that application of these laws leads to equations that aretoo complex to be solved.” This statement still holds despite the increasing power ofcomputers. Simplified models for the interactions need to be formulated for analyticaltheories. More approximations are required if one wants to predict the behaviour ofmaterials beyond the harmonic approximation. If theory and experiment disagree, it isoften difficult to say at what point theory failed.The use of computers made it possible to reduce this uncertainty, as computer simu-lations made it possible to solve the equations for microscopic empirical model po-tentials with (theoretically) arbitrary accuracy, thus allowing us to see how the macro-scopic system behaves as a whole without the need to rely on further assumptions.The numerical computation of macroscopic observables can be realized by samplingrandomly over phase space in a Monte-Carlo (MC) simulation [58] or by followingthe trajectory of Newton’s equations of motion, and thus sampling over phase space aswell, in a molecular dynamics (MD) simulation [28].It is nevertheless not yet possible to solve the quantum mechanical equations exactlyexcept in an extremely limited number of cases. In fact, one can show that it is beyondany conceivable computational capacity to exactly solve the Schrodinger equation inits standard form for a system containing only ten electrons [84]. However it becamepossible to handle quantum mechanics in a computer simulation with the developmentof density functional theory (DFT), which states that it suffices to know the averagenumber of electrons located at any one point in space instead of the motion of eachindividual electron [70]. The practical application of this theory relies on good ap-proximations for the functional as the true functional is not known in a solid. Herethe local density approximation (LDA) has produced very accurate results for a wide
1
Contents
range of materials. In 1985 Car and Parrinello [11] developed a very efficient methodto use DFT in the force calculation of an MD simulation, which made this so calledCar-Parrinello molecular dynamics (CPMD) one of the most widely used techniquesfor the calculation of dynamic and electronic properties of condensed matter. Thiskind of simulations, where a real (but approximative) potential without adjustable pa-rameters is used, is called first-principle or ab-initio simulations.So these two options, the ab-initio approach and the empirical model potentials, canbe implemented in a computer simulation, which involves different possibilities andrestrictions respectively. Of course ab-initio techniques lead to much higher chemicalaccuracy, as the calculation of the interatomic stresses and forces used for propagationof the particles is close to reality. On the other hand it is limited due to its computa-tional cost and thus restricted to small length and time scales. This is a major problemas it severely limits the range of properties that one can calculate and the number ofphenomena that can be simulated.In contrast an empirical model is parametrized to certain experimental properties un-der certain thermodynamic conditions, and its reliability has to be questioned when itis used away from the conditions under which it was parametrized or if properties haveto be calculated that did not enter the parametrization of the adjustable model param-eters. But they provide much faster calculation, which is beneficial for the calculationof thermal properties if the relaxation times in the system are large so that thermalaverages require sampling over long periods of time. Moreover, in a wide range ofapplications model potentials have been employed very successfully.The crucial questions with an empirical potential are to incorporate the relevant physi-cal effects into the formulation of the functional form and to have a proper adjustmentof the free parameters. In this work different approaches of model potentials will betested in the simulation of silica (SiO2) polymorphs. (Polymorphic materials are ma-terials that possess different crystalline structures for a fixed stoichiometry.) The forcefields studied in this work are the BKS two body pair potential [101], a model thatallows for fluctuation of charge between the atoms [20] and a third that employs fixedcharges but allows for inducible dipole moments on the oxygen atoms [90]. For theproblem of the parametrization the authors of the last potential used a new approach,which does not fit the potential to macroscopic experimental values but aims to matchthe microscopic forces, stresses and energies with values obtained from DFT calcula-tions [25, 57].
Silica or silicon dioxide is one of the most widely and intensively studied of all ma-terials. There are many reasons for this. First of all, it is one of the most commonmaterials in nature. Silicates, which is a compound consisting of silicon and oxygen,one or more metals and possibly hydrogen, make up more than 90% of the mineralsin the earth’s mantle and crust. Additionally it is used extensively in industrial appli-
2
Contents
cation.An obvious example is that it makes up approximately 75% of the compositionof the glass that is used for everything from window panes to optical fibres. It is alsoused as an insulator or substrate in the semiconductor electronics industry.On the other hand it is interesting to study as crystalline silica has an extremely richphase diagram with a large number of polymorphs, shown in Fig.0.1 and the fluidphase, which remains metastable in the form of silica glass for a long time when cooleddown to ambient temperatures. The best known polymorphs are quartz, cristobalite,
Figure 0.1.: Phase diagram for silica polymorphs. From [54]
tridymite, coesite, and stishovite. The crystalline phases make up a good test casefor empirical potentials, as due to the reduced symmetries there are more independentsusceptibilities, while in disordered systems effects can be averaged out. Isotropic ma-terials have for instance only two independent elastic constants, while in quartz thereare six independent coefficients.
All the low pressure crystal structures are composed of corner-sharing SiO4 tetrahe-dra [39] and even in the glass and the liquid, almost all Si atoms are tetrahedrallycoordinated. In the higher pressure phases six-fold coordination becomes more andmore favorable for the Si atoms, which lead to octahedral coordination in stishoviteand other high-pressure phases. The high-pressure phases are of particular interest tounderstand the earth’s interior, where silica is exposed to extreme conditions of temper-ature and pressure. The high-pressure behaviour of quartz is complicated to investigatein experiment as well as in theory, due to the large number of six-coordinated struc-tures that can possibly form out of four-coordinated structures [52], the slow kinetics,metastabilities and certainly experimental difficulties [52, 105]. As shown in Fig.0.1,
3
Contents
the stable phases with increasing pressure on quartz would be coesite and stishovite,however these transitions are kinetically inhibited at room temperature. Consequently,quartz can be kept metastable up to 21 GPa. At this pressure, a phase transition oc-curs. For the new forming phase different crystal structures [38, 95, 96], amorphousstructures [40] or partly crystalline structures [52] were proposed experimentally andtheoretically. In computer simulations, this phase transition is a good candidate for areliable model potential, as the system size and the time scales needed to simulate thetransition are out of reach for an ab-initio approach. Still the high pressure is not whatthe model potentials were made for, so the comparison between different approachesincreases the credibility in this case.But also in the quartz phase, which is prevalent at ambient conditions, there are un-resolved issues. When heatingα-quartz (or low quartz), the crystal turns toβ-quartz(or high quartz) at around 573◦C [39]. The average structure of both quartz phaseshas been known for several decades, and the displacive transition between them canbe easily understood in terms of tilting of certain groups of SiO4 tetrahedra. How-ever the real picture of the transition is far more difficult, as is the real structure ofβ-quartz. It is clear that the oxygen atoms do no fluctuate harmonically around theiraverage positions, but the dynamical disorder that leads to the average structure is stillan unanswered problem. There are currently two competing interpretations. One pic-ture of theβ-quartz phase sees the oxygens oscillate between two potential minima atthe positions of the left-handed and the right-handedα-quartz [107, 87, 100], while theother picture supports an ordered structure that has the atoms vibrate in a librationalmotion around the mean positions [3, 92, 13, 24, 81, 49]. These two interpretations fa-vor different pictures of the transition, either a disorder-order type transition or a weakfirst-order transition with a soft mode initiating the transition.The described dynamical disorder makes theβ-quartz phase and obviously the transi-tion difficult to simulate with an ab-initio method. It is definitely not sufficient to findthe average structure and extract the relevant properties ofβ-quartz by harmonic ap-proximations. It was shown that for example the bulk modulus inβ-quartz turned outto be twice as large as in experiment with local density approximation and subsequentharmonic approximation [21, 65]. In contrast it is necessary to find the thermodynamicobservables by averaging over a long simulation run in order to sample the dynamicdisorder (which leads to a bulk modulus comparable to experiment). This makes itnecessary to use an empirical model potential. However the standard two-body poten-tial generally employed for the simulation of silica turned out to be flawed in differentaspects of the transition. Thus a new potential modelling different microscopic effectscould improve the two-body potential in the simulation of theα-β transition.
At the beginning of the thesis in chapter1 the three potentials used will be introducedand explained, as well as different MD algorithms and techniques used in the simula-
4
Contents
tions.The following chapter2 will be concerned with theα-β transition and the performanceof the different potentials at this transition. After the determination of the transitiontemperature, the emphasis is on the course of the lattice constants with temperature.Due to the failure of the BKS potential in this respect, the distortion of the tetrahedrawill be investigated in more detail. The phonon density of states and the elastic con-stants are compared with experiment.The simulation of the high-pressure post quartz phases in chapter3 concentrates ofthe determination and comparison of the transition path ways produced by the differ-ent potentials. As available the phases will be compared with experiment in terms ofdiffraction spectra.Chapter4 focuses on an instability of cristobalite in the BKS potential and the com-parison to the other models.As the new potential approaches incorporate electrostatic properties, namely fluctuat-ing charges and fluctuating dipole moments, the investigation of dielectric propertiesin chapter5 should highlight the question if these are real electrostatic variables andthus improve the prediction for the dielectric properties of the system. A method isdeveloped to measure dielectric and piezoelectric properties efficiently.The conclusions at the end will give a final assessment of the suitability of the newapproaches for silica simulations.
5
1. Simulation Techniques and ModelPotentials
1.1. Molecular Dynamics Techniques
The simulation scheme being used, a classical molecular dynamics (MD) computersimulation, is a numerical method to calculate the trajectory of a many-atom system.The starting point of an MD simulation is Newton’s equations of motion for the systemunder consideration:
miRi = −∇iV ({Rj}) = F i (1.1)
whereRi are the coordinates of the atoms,mi their masses,V is the total potentialenergy andF i the force acting on atomi.These equations form a system ofN coupled partial differential equations. Their so-lution is the phase space trajectory of the many-particle system. The aim of an MDsimulation is to numerically solve the equations of motion and to extract macroscopicobservables from the resulting trajectory.To obtain meaningful time thermal averages for macroscopic quantities, it is impor-tant to start with an equilibrated configuration. This ensures that time averages donot change in the course of the simulation. In order to simulate a crystal in thermalequilibrium, one has to start with a configuration being close to the expected crystalstructure and to run the simulation until the macroscopic quantities are reasonably sta-ble. Two aspects are particularly important for the simulation of a system. One is themodel potentialV from which the forces follow, the other aspect is which algorithm isused to integrate the equation of motion and how external imposed conditions such astemperature, stress, or an electric field can be taken into consideration.A variety of standard methods is available for for numerical details such as the inte-gration scheme. In this work the so-called Gear predictor-corrector algorithm up tofifth order was used for the integration of the equations of motion. [33]. While Gearpredictor-corrector algorithm of order higher than two do not conserve energy, theydo produce more accurate trajectories than the second order Gear predictor-correctoralgorithm, which is also called velocity Verlet. The 2nd-order predictor-corrector isknown to be energy and phase space conserving. However in the context of this workthis attribute is relevant for testing purposes only, when the correct implementation of
6
1.1. Molecular Dynamics Techniques
the routines was checked by means of energy conservation within an unthermostatted,i.e. microcanonical ensemble. For succeeding production runs a Langevin thermo-stat was used, which enables simulations in the canonical ensemble. The thermostatconstantly adds and removes energy to the system in order to maintain a constanttemperature. This renders the energy conservation of the integrator an unnecessaryquality. Also higher-order integration schemes give more accurate averages at a giventime step, once the thermostat is introduced, which is why they were used for the pro-duction runs.To allow for simulations in the isothermal-isobaric (NpT) ensemble, the ParrinelloRahman method was used. This method as well as the integrator and thermostat algo-rithms will be described in detail in the following.For acceleration of the time consuming force calculation standard binning and Verletneighborhood list techniques were used [1, 28].
1.1.1. Parrinello-Rahman Barostat
The Parrinello-Rahman method of pressure and stress control allow one to simulatemolecular systems under externally applied stress. This is useful for studying thestress-strain relationship of materials and phase transitions with non-isotropic shapevariations. Both the shape and the volume of the cell can change, so that the inter-nal stress of the system can match the externally applied stress. In this work only thepresence of uniform pressure is needed, so it is not necessary to allow for an arbitrarystress tensor. It is yet important to allow for an arbitrary strain.The method was presented in detail by Parrinello and Rahman [71] and is only sum-marized here. The fluctuating shape of the cell is given by the cell matrixh containingthe cell vectors so that the real space coordinatesRj of a particlej are related to thereduced coordinatesrj by Rj = hrj. While the coordinatesRj represent the real posi-tions of the atoms, the reduced coordinatesrj only live in a unit cube.The Langrangian of the system is modified such that a term representing the kineticenergy of the cell depends on a user-defined massMbox. An elastic energy termp det his related to the pressurep and the volumedet h of the system. These two terms leadto an extended Lagrangian:
L =1
2
N∑i=1
mir′ih′ hri − Vinteraction+
1
2MboxTrh′ h− p det h (1.2)
The equations of motion for the reduced coordinates and the cell vectors can be derivedfrom this Lagrangian by using the regular Lagrange formalism. The motion of the cellvectors, which determine the cell shape and size, is driven by the difference betweenthe target and the internal stress.
7
1. Simulation Techniques and Model Potentials
The choice of the fictitious massMbox is governed by the following considerations.A large Mbox means a heavy, slow cell. In the limiting case, infiniteMbox revertsto constant-volume dynamics. A smallMbox means fast motion of the cell vectors.Although the target stress can be reached faster, a too small mass can result in artificalperiodic movements of the cell and requires a smaller time step. As theh matrix iskept symmetric, it can be written in Voigt notation [102], which is a standard to writesymmetric crystallographic3 × 3 tensors as a6 dimensional vector with entriesh =(hxx, hyy, hzz, hxz, hyz, hxy). Once all equations of motion are derived, a thermostatcan be added to them. This can be done for the cell vectors in a similar way as for thereduced atomic coordinates.
1.1.2. Gear Predictor Corrector Integrator
Let ri(t) be the position of particlei at timet. First, in the predictor step the positionsand derivatives of the particle positions are predicted,
(∆t)n
n!
∂n
∂tnri(t+∆t) =
(∆t)n
n!
∂n
∂tnri(t)+
Norder∑m=n+1
Cpn,m
(∆t)m
m!
∂m
∂tmri(t) , n = 0, . . . , Norder ,
(1.3)whereCp
n,m is them-th predictor coefficient ofn-th order. The predictor coefficientsare just the Taylor expansion coefficients
Cpn,m =
m!
n!(m− n)!. (1.4)
For efficiency, the powers of the time-step and faculties are saved on the arrays holdingthe derivatives of the positions. When configurations are written out, they are howeverdivided out, to obtain the time-derivatives of the positions independently of the time-step. They can be used to propagate saved configurations with another time-step∆t.The force calculation in the following MD step is now based on these predicted po-sitions. After this, the propagation step is completed by the correction step. In thisstep, positions and derivatives are corrected proportionally to the difference betweencomputed and predicted force (or equivalently acceleration),
(∆t)n
n!
∂n
∂tnri(t+∆t) :=
(∆t)n
n!
∂n
∂tnri(t+∆t)+Cc
n
(∆t)2
2
(fd
i(t +∆t)
m− ∂2
∂t2ri(t +∆t)
).
(1.5)Here, Cc
n is the n-th corrector coefficient. Gear devised the correction coefficientsto minimize errors such that the local truncation error is ofO(∆tNorder+1) for lineardifferential equations [33]. For second-order differential equations the global erroris thenO(∆tNorder−1). The corrector coefficients are listed in table1.1.2 followingRef. [36].
8
1.1. Molecular Dynamics Techniques
Norder = 2 Norder = 3 Norder = 4 Norder = 5
Cc0 0 1/6 19/120 3/16
Cc1 1 5/6 3/4 251/360
Cc2 1 1 1 1
Cc3 – 1/3 1/2 11/18
Cc4 – – 1/12 1/6
Cc5 – – – 1/60
Table 1.1.: Corrector coefficients for the Gear predictor corrector algorithm.
1.1.3. Langevin Thermostat
The Langevin thermostatting routine couples the system via friction and noise to a heatbath. In doing so, the simulation, which was based on Newton’s equation up to now,now integrates a Langevin equation
miRi = F i −mγRi + F ri . (1.6)
Therefore this method is also referred to as “stochastic dynamics”. The friction con-stantγ controls how fast the system relaxes into equilibrium. The simulation schemenow produces states which are distributed according to the canonical ensemble, andtogether with the barostat even the isobaric-isothermal ensemble. The temperature re-sults as the ratio of noise strength to friction, via the fluctuation-dissipation theorem.The stochstic forceF r
i is a random variable with mean zero and a widthσr chosen tosatisfy the fluctuation-dissipation theorem [1]:
σr =√
3
√2TmkBγ
∆t(1.7)
The uniform distribution is prefered to the Gaussian distribution for efficiency and sta-bility reasons, as the details of the distribution function do not matter. The frictionconstantγ is set to 0.1 in almost all simulations unless noted otherwise.The thermostat was used also in production runs, even though an equilibrated con-figuration should not change in temperature, when an energy conserving integrationscheme is employed. Nevertheless the thermostat decorrelates the system and is evenmore stable than simple microcanonical MD with the Verlet algorithm, because thestochastic dynamics thermostats every degree of freedom individually. As the stochas-tic force individually heats or cools single particles, it can prevent particles with akinetic energy much higher or lower than the thermal average from causing instabili-ties. This is in contrast to the Nose-Hoover thermostat [69], in which only the overallsystem is thermostatted.
9
1. Simulation Techniques and Model Potentials
1.1.4. Interactions
Interaction forces are calculated using the positions from the predictor step, includingthe random contribution. In all models being used the leading order in the forces aregiven by pair potentials. In the case of the fluctuating-charge potential these forces alsodepend, via the charges, on the positions of all the other atoms, and are therefore manybody interactions. In the case of the fluctuating-dipole potential the two-body forcesare accomplished by additional dipole interactions. The values of the dipoles dependon all the other dipoles, and therefore the interactions between the dipoles represent amany body contribution.
1.1.5. Ewald Summation
All the potentials dealt with in this work contain a Coulomb interaction part. As withall the other parts in the potentials, the calculation of the total energy of a three-dimensional system theoretically involves the evaluation of interactions between allspecies within the unit cell and their periodic replications. Even when the interactionwas evaluated for an infinite number of replications, the electrostatic interaction wouldnot be well defined as it still depends on how the limit is carried out. One conisitentway is to sum upexp(−r/a)/r to infinity before takinga → ∞. Nevertheless in nu-merical computations some finite cutoff must be placed on the interactions. For thoseinteractions decaying quickly with distance, the summation can normally be readilyconverged directly in real space. For long-range interactions however the convergencemight be not so quick, particularly since the number of interactions increases withr2.For the electrostatic energy in particular, the number of interactions increases morerapidly with distance than the potential, which is proportional to1/r, decays. An ac-curate evaluation can be achieved through the Ewald summation [26, 93] in which theinverse distance is rewritten as its Laplace transform and then split into two rapidlyconvergent series, one in reciprocal space and one in real space. The distribution ofthe summation between real and reciprocal space is controlled by a parameterα. Theresulting expression for the energy is:
V rec =∑j>i
Rij<rewcut
QiQje2
Rij
erfc(αRij)−α√π
∑j
q2j e
2 (1.8)
+2π
V
∑q=2πh−1(nx,nz,nz)
0<q≤qcut
exp(−(
q2α
)2)q2
∣∣∣∣∣∑j
Qje exp(2πiRj · q
)∣∣∣∣∣2
(1.9)
10
1.2. BKS Potential
The cutoffsrewcut in real space andqcut in reciprocal space can be set in dependency ofα
in a way that the error is minimized:
rewcut = s/α, qcut = (2sα)2 (1.10)
A value ofs = 3 has proven to be a good compromise between accuracy and speed.For the distribution between calculations in real and reciprocal space, a good balancecan be found at aboutα = 0.3 for system sizes of around1000 particles which wereconsidered in the present work. Both of these values were used throughout the simu-lations.
1.2. BKS Potential
The BKS Potential was proposed in 1990 by van Beest, Kramer and van Santen [101]and has been succesfully applied to a range simulations involving crystalline and vit-reous silica since [16, 68, 46, 103, 48, 91]. It consists of pure pair interactions withdifferent strength for different pairs of atom types. By combining suitable attractiveand repulsive forces for the different atom types it is possible to reproduce effects thatare usually caused by many-body interactions. So the BKS potential causes the stableformation of SiO4 tetrahedra without explicitly caring for the effects of covalent bond-ing.The total potential energy is thus a sum of pure pair potentials
V ({Ri}) =∑i<j
φij(Rij). (1.11)
The pair potentialφij is composed out of a long-range Coulomb term and a short-rangeBuckingham term:
φαβ(R) =qαqβe2
R+ Aαβe−BαβR − Cαβ
R6. (1.12)
The charges are fixed on the valuesqSi = 2.4 andqO = −1.2, while the parametersA, B andC in the Buckingham interaction were optimized for the different pairs ofatom types with respect to ab intio calculations as well as to macroscopic experimentalquantities like the elastic constants ofα-quartz. The parameters given in ref. [101] arelisted in table1.2. The Si-Si interaction is assumed to be purely Coulombic in the BKSpotential, which is why the Buckingham parameters are all0 for Si-Si interaction.
11
1. Simulation Techniques and Model Potentials
Aαβ[eV] Bαβ[A−1
] Cαβ[eVA6]
O-O 1388.7730 2.76000 175.0000Si-O 18003.7572 4.87318 133.5381
Table 1.2.: BKS Parameters
1.3. Fluctuating Charge Potential
A fluctuating charge potential is conceived as a model potential that makes use of vari-able charges on the atomic sites when calculating the Coulomb interaction. As thetotal charge of the system needs to be conserved, this charge adjustment may be un-derstood as relocation of charges within the system and indeed it implies a change inthe polarisation of the simulation box. This explains the common notation “polariz-able potential”, which will not be used in the following for better distinction betweenfluctuating charge and fluctuating dipole potentials.The purpose of fluctuating point charges in the simulation is to implicitly account forelectronic degrees of freedom. The effective charge of an atom in a fixed charge sim-ulation can be chosen with respect to its type and ionization, but it cannot change inresponse to changing electrostatic fields which arise from movement of the atoms dur-ing the simulation. Thus the charges used in simulations based on fixed charge forcefields must reflect average charge values for the particular phase and are in generalnot transferable to different thermodynamic states. The fluctuating charge approach,in contrast, adjusts the charge according to the instantaneous configuration of the sur-rounding atoms. Therefore it should be more adaptable to different phases and espe-cially to varying coordination numbers than a fixed charge approach.
1.3.1. Charge Equilibration Algorithm
The basic concept used for the fluctuating charge approach is the concept of electroneg-ativity equalization[82] according to which charge is transferred between atomic sitesin such a way that electronegativities are equalized. In doing so, the electronegativ-ity is dependent on the atom type and charge as well as the electronegativities of theneighboring atoms.Following the Mulliken definition, the electronegativity of an isolated atomi is thenegative of the chemical potential (µi) of the electron gas surrounding the nucleus:
χi = −µi = − ∂U
∂Ni
= e∂U
∂Qi
(1.13)
12
1.3. Fluctuating Charge Potential
In this equation, use had been made of the fact that the ground state energyE, thenumber of electronsN in the atom and the charge on the atomQ fulfill the equationQ = −e(N − Z), whereZ is the atomic number of the atom.The energy of an isolated atom dependent on the effective charge can be expandedaround a neutral reference point as
Ei(Q) = Ei0 + Qi
(∂E
∂Q
)i0
+1
2Q2
i
(∂2E
∂Q2
)i0
+ . . . (1.14)
Neglecting higher-order terms, one can ask for the energy needed to remove or add asingle electron. In units ofe and withEi0 = 0 one obtains
Ei(+1) = Ei0 +
(∂E
∂Q
)i0
+1
2
(∂2E
∂Q2
)i0
(1.15)
Ei(−1) = Ei0 −(
∂E
∂Q
)i0
+1
2
(∂2E
∂Q2
)i0
. (1.16)
As Ei(+1) is just the ionization potentialIE andEi(−1) is the electron affinityEA,one finds for the first coefficients exactly the Mulliken definition of electronegativity(
∂E
∂Q
)i0
=1
2(IE + EA) = χ0
i . (1.17)
The second coefficent turns out to be a quantity called idempotential, representing theself repulsion between two electrons:(
∂2E
∂Q2
)i0
= (IE − EA) = J0ii (1.18)
This leads to the following expression for the charge dependence of the atomic energy,where the parametersχi andJ0
ii can be derived from atomic data:
Ei(Q) = χiQi +1
2J0
iiQ2i (1.19)
The total energy in the system is obtained by adding this energy to the interactionenergy, which is given by a two body termΦ consisting of a Coulomb interaction partand a short range non-Coulombic interaction part.
U({Qi}, {Ri}) =∑
i
Ei(Qi) +∑i<j
Φij(Rij)
=∑
i
[χiQi +
1
2J0
iiQ2i
]+∑i<j
[Jij(Rij)QiQj + V (Rij)
]=
∑i
χ0i Qi +
1
2
∑i,j
Jij(Rij)QiQj +∑i<j
V (Rij) (1.20)
13
1. Simulation Techniques and Model Potentials
Here the Coulomb interaction was assumed to obeyJii(R) → J0ii asR → 01. This
means thatJij(R) does not represent a pure1/R Coulomb potential but has to be ashielded potential with a finite value atR = 0.After all, we end up with an equation that relates the total energy to the positions andcharges of all the atoms in the system. Equations (1.13) and (1.20) can be used in twodifferent ways to find the right charges:
• treat the charges as parameters[77]: directly solve for the exact charges given bythe spatial configuration in every MD step, or
• treat the charges as generalized coordinates[78]: extend the Lagrangian for thecharges, propagate them in the same way as spatial coordinates and thermostatthem at 0 K.
A third possibility is to solve the equations selfconsistently. This solution would givethe possibilty to control the characteristics of the charge trajectory between the onewhich is always in the energy minimum, like in the first case, up to a retarded be-haviour, like in the second case. Nevertheless it turned out that this solution wasdifficult to control numerically and converged very slowly. As there are no obviousdifferences in the trajectories of the two solutions introduced above, this third possi-bility was skipped.
1.3.2. Direct solution
A set of charges forms the ground state of a given spatial configuration when the chem-ical potentials on all atom sites are equal. This implies theN − 1 conditions
χ1 = χ2 = · · · = χN . (1.21)
Adding the condition on charge neutrality
N∑i=1
Qi = 0 (1.22)
leads to a total ofN equations for theN equilibrium charges. In order to expressthe electronegativity in terms of the charges, one has to insert expression (1.20) intoeq. (1.13):
χi =∂U
∂Qi
= χ0i + J0
iiQi +∑j 6=i
JijQj (1.23)
1In Ref. [77] one can actually recalculate analytically that this condition is not fulfilled. To obtainbetter fits to dipole moments, it was dropped by the authors[76].
14
1.3. Fluctuating Charge Potential
Equations (1.21) and (1.22) can be merged into a matrix equation
C ·Q = −D, (1.24)
where
Di = χ0i − χ0
1 (1.25)
and
C1i = 1 (1.26)
Cij = Jij − J1j (1.27)
Solving these linear equations with standard procedures leads to the sought-after charges.A more elaborate version of this matrix including all terms from Ewald summation canbe found in appendixA.1.1
1.3.3. Extended Lagrangian
The idea for treating charges as generalized coordinates is based on an extended La-grangian approach. While a charge dependent potential energy is obviously available(eq. (1.20)), one has to define additionally a kinetic energy expression. This is done byassigning a fictitious mass to the charges. The choice of an appropriate value will bediscussed later on. Again the charge neutrality has to be obeyed, and the simplest wayto implement this is to treat the charges as independent and use a Lagrange multiplierto enforce the constraint. The Lagrangian is
L =∑
i
1
2miR
2i +
∑i
1
2MQQ2
i − U({Qi}, {Ri})− λ∑
i
Qi (1.28)
While the Euler Lagrange equation for the positions remains unchanged, one gets anadditional expression for the charges:
MQQi = − ∂U
∂Qi
− λ (1.29)
As the total charge is zero, the expression∑
i Qi also vanishes. Therefore∑i
MQQi = −∑
i
∂U
∂Qi
−Nλ = 0 =⇒ λ = − 1
N
∑i
∂U
∂Qi
, (1.30)
which defines the Lagrange parameter. Substitution into the equation of motion yields
MQQi = − ∂U
∂Qi
+1
N
∑j
∂U
∂Qj
= − 1
N
∑j
(∂U
∂Qi
− ∂U
∂Qj
)(1.31)
15
1. Simulation Techniques and Model Potentials
The descriptive interpretation of this equation is that the electrons are attracted byatoms with higher electronegativity, which complies with the expected behaviour.This equation of motion can now be propagated by the MD integrator, provided thatparametersMQ for the inertia of the charges andγQ for the friction in the thermostathave been defined.The choice of these parameters is detailed below for the present case. The generalconsideration is to separate the time scales of ionic motion and electronic motion inorder to suppress coupling between internal charge modes and ionic motion. This is asimilar idea as in the Car Parrinello approach, where as well a ficitious mass is assignedto the electronic orbitals, which should be small enough that the motion of the orbitalswill be very fast relative to the motion of the ions. This way it is ensured that thefrequency spectra of the electronic orbitals and the ions are well separated from oneanother.
1.3.4. Morse-Stretch QEq Potential
The potential that we used for MD simulations was parametrized for SiO2 by Demi-ralp et al.[20]. In this model the fluctuating charge was implemented through thecharge equilibration (QEq) procedure developed by Rappe and Goddard[77], whichfeatures a direct matrix diagonalization approach. In agreement with Rappe and God-dard the QEq parameters were choosen as shown in Table1.3. Following Ref. [77],
χ(eV) J(eV) RQEq(A)
O 8.741 13.364 0.669Si 4.168 6.974 1.176
Table 1.3.: QEq parameters for O and Si
the shielded Coulomb interactionJij(R) is taken to be the Coulomb overlap integralbetween Slater orbitals centered on each atomic site
Jij(R) =
∫dRi
∫dRj |φni
(Ri)|21∣∣Ri −Rj −R
∣∣ ∣∣φnj(Rj)
∣∣2 . (1.32)
The Slater orbitals are given by
φni(R) = AiR
ni−1e−ζiR (1.33)
and are determined by the principal quantum numberni and an exponentζi. Thisexponent is given byζi = 0.4913 ·(2ni+1)/(2RQEq
i ), with RQEq from the table above2.
2The differing formula forζ given in ref. [20] is not correct[19].
16
1.3. Fluctuating Charge Potential
A detailed description of how to solve the two-center overlap integral can be found inappendixA.1.2.The J(R) interaction models a shielded Coulomb potential that is asymptotically a1/R point-charge Coulomb interaction, when the particles are at a sufficient distance,but approaches a finite value forR → 0.The non-electrostatic short-range interactions are modelled by a Morse-Stretch (MS)term
UMSij (Rij) = D0
[eγ(1−Rij/R0) − 2eγ/2(1−Rij/R0)
]. (1.34)
The short range interaction is truncated at9.0A. The MS parameters were optimizedby Demiralp et al. to describe properties like density, cohesive energy, elastic moduliof α quartz and stishovite. The values can be found in table1.4. It is of course always
R0(A) D0(kcal/mol) γ
O-O 3.7835 0.5363 10.4112Si-Si 3.4103 0.2956 11.7139Si-O 1.6148 45.9970 8.8022
Table 1.4.: Morse Stretch parameters
assumed implicitly that the potential energy surface used to find the optimum charges,by setting∂V/∂Qi = 0 at fixed values ofR with the constraint
∑i Qi = 0, should be
the same as the potential energy surface used to calculate the forces∂V/partialRi atfixed values ofQ.As the description of the energy surface in Ref. [20] does not state anything different,we naturally assumed the only mentioned electrostatic potential energy in this paper,which is theJ(R) given by (1.32), as the one which is consistently used. When weimplemented the potential as stated by the authors, none of their results could be re-produced, and even the nearest-neighbor peak of the Si-O pair correlation functionin theα-quartz structure deviated significantly from the experimentally known1.6A.This flawed behaviour was exactly reproduced when we employed the MD simulationprogram GULP[30, 29, 31] for comparison, which was provied free of charge by theauthor Julian D. Gale.The reason for these discrepancies finally turned out be an inconsistent treatment ofthe potential energy, which was disguised in the publication. Even though they nevercomment on this in their paper or in private communication, Demiralp et al. did notuse the shielded Coulomb potentialJij(Rij) for the ion interaction. Instead they useda pure1/Rij Coulomb potential. The only verification for this fact was that only whenwe tried this inconsistent treatment, we could reproduce the results for the equation ofstate inα-quartz as they published it in the paper.So effectively they used the shielded Coulomb potential to calculate the charges as
17
1. Simulation Techniques and Model Potentials
overlapping Slater orbitals and subsequently used these values as point charges witha pure Coulomb potential in the MD step. Obviously this was done because in thecommercial software package they used the correct electrostatic energy functional andits derivatives have not been impelemented, thus the software was only capable to usethe point-charge interaction.A hint to this inconsistency and an attempt to correct it was made recently in a laterpublication by Sefcik et al.[85], where the Morse Stretch parameters where optimizedfor a consistent potential energy function. Unfortunatelyα-quartz turned out to beunstable with this new parameter set in our simulations at ambient temperature. Thecrystal immediately transformed toβ-quartz at temperatures well within the stabilityrange ofα-quartz. Because of this flawed behaviour of the new parameter set, whichrenders it useless for our simulations, we do not consider it in this work, but only usethe inconsistent original potential, repectively the modification of it described in thenext section.
1.3.5. Alternative Morse-Stretch fluc-Q Potential
Using different potentials for charge equilibration and force calculations makes it im-possible to use the extended Lagrange method. Moreover, it is an unphysical treat-ment to treat these two potentials inconsistently. However, as the results presented inRef. [20] seemed to be close to experimental data, it appeared to be useful to alter thepresent potential such that experimental data was reproduced and that charge equili-bration and force calculations were based consistently on the same energy surface. Todo this, an energy functional was constructed in a way that its derivatives with respectto position and charge should be as close as possible to the derivatives of the two differ-ent energy functionals used in ref. [20]. For this purpuse, both fluctuating charges andfixed charges were included in this potential.Jij(Rij) was used as Coulomb potentialand a termqiqj[Jij(Rij) − 1/Rij], with q the average charge inα quartz, was addedto the MS potential term. Using this modified potential energy within the extendedLagrangian formalism, the derivation with respect to the dynamical charges will onlytake notice of theJij(Rij) part, but for the derivation with respect to the positions andtherefore the ion motion the1/R is dominant. This modification is of course purelyheuristic, but it reproduces nicely the structure of different SiO2 polymorphs, as shownfor thegSiO(R) in α-quartz in Fig.1.1and it reproduces the original data as well. Thus,while this procedure does not necessarily yield the optimum values for the interactionparameters, it seems as though it allows one to analyze at least qualitatively if notsemi-quantitatively what benefits one can expect from a fluctuating charge model inSiO2.
18
1.3. Fluctuating Charge Potential
3 4 5 6r/Å
0
1
2
3
4
5
g SiO
(r)
BKSmodified fluc-Q potentialoriginal fluc-Q potential
Figure 1.1.: Pair correlation functiongSiO(R) of α-quartz at 300 K. The curves for the new consistentfluctuating charge potential and the original unconsistent potential basically lie on top ofeach other. The nearest neighbor peak, which is located at 1.6A, is not included in thegraph.
1.3.6. Kinetic Parameters for Extended Lagrangian
In the extended Lagrangian approach, the equilibration of the effective charges reflectsthe movement of the electrons in the system. To adiabatically decouple the electronicmovement from the ionic movement, it is therefore necessary to separate the relevanttime scales. Therefore in addition to the usual relation∆t � τion � TSim, the newelectronic timescale has to fit in:∆t � τQEq � τion � TSim, so that the chargeequilibration time is well below the equilibration time of the ionic movement. This wasachieved by choosing a fictious mass for the charges of0.01 u. The damping constantin the Langevin thermostat was set by finding the value where the charge equilibrationis critically damped, which is2.0. With these numbers the equilibration time of thecharges is about10 fs, which means a frequency of100 THz, well beyond the typicalphonon frequencies in SiO2. To cover these higher frequencies in the simulation, thetime step was shortened by a factor of10 to ∆tMD = 0.1 fs in this type of simulation.As the authors of the fluctuating charge potential mention that they used the directapproach to calculate the charges every25 to 100 timesteps, it is interesting to note thatthis corresponds to frequencies of10 to 40 THz. This is within the phononic frequencyrange and leads to the situation that the charges cannot adapt to the instantaneous ionicconfiguration.
19
1. Simulation Techniques and Model Potentials
1.4. Fluctuating Dipole Model
In the fluctuating charge procedure, charge can only fluctuate from one atom to theother. This can bring about polarizations within the crystal, but it does not accountfor polarizations within the electron hull of an atom. The fluctuating dipole proce-dure in contrast directly assigns a dipole moment on each atom site. In case of thequartz system to be considered, only the oxygen atoms are assigned a dipole moment.This is because the silicon atoms have a rather stable nearest neighbor environmentthat consists of symmetrically arranged oxygen atoms in the corners of a tetrahedron.Therefore polarization on these atoms is unlikely to play a major role. The polarizationof the oxygen atoms however is well established[60].The force field for SiO2 used in the following was parametrized by P. Tangney andS. Scandolo[90]. For the parameter fitting they used theoptimal potential routinede-veloped by Ercolessi[25] and in this form by Laio et al[57]. It is an iterative procedurethat obeys the following algorithm: Beginning with the best potential available, thesystem is equilibrated with an MD simulation. Once equilibrated, a number of atomicconfigurations are generated. On these configurations, density functional theory cal-culations of total energy, forces and stress are performed and these are used to performthe parametrization. With the new parameters, the scheme will be repeated until thecurrent parameter set fits the current and the previous ab initio data to the same degree.Finally the emerging parameter set is supposed to produce potential energy, forces andstress in agreement with the DFT method used for parametrization, but much fasteras the ab initio method. This statement obviously only holds in terms of a certainaccuracy and in the vicinity of the surrounding conditions that were employed in theparametrization procedure, like temperature and external pressure. When this temper-ature and pressure is exceeded significantly, the accuracy of the potential cannot betaken for granted but has to be questioned as it is the case with every model potential.One major advantage of this method is that it does not rely on any experimental inputand thus the parametrization can take place in principle in any possible thermodynamicconditions, even where experimental data is unavailable.In this work, we used the Fortran subroutine provided by Paul Tangney that calculatesforces, stress tensor and potential energy for a given configuration. The parametriza-tion was done by Tangney and Scandolo in the liquid phase at3000 K, in order tofind a parameter set which is not biased towards a particular crystal structure. In thefollowing the algorithm used to solve for the dipoles will be outlined.Calculation of the induced polarization is a many-body problem, where the induceddipoles all depend on each other. Ifαi is the polarizability of sitei, the induced dipole
20
1.4. Fluctuating Dipole Model
piat positionRi is given by
pi
= αiEi (1.35)
Ei = E0i +
∑j 6=i
Tijp
j(1.36)
The polarization is proportional to the electric field, which in turn depends on all thedipoles via the dipole-dipole interaction tensorT
ij. HereE0
i is the “fixed” part of theelectric field due to charges and a possibly applied external field. To solve this pair ofequations amounts to solving a set of3N × 3N linear equations. Thus the possibilityto solve them directly or in an iterative way can be ruled out directly, as it would befar too computationally expensive. Therefore these equations have to be solved eitherwith an extended Lagrangian scheme as done in [88, 106] or with a self consistentapproach as in [94].However, Wilson and Madden[106] found that this model for polarization had signifi-cant shortcomings. The ions tended to become over-polarized, and small anion-cationdistances resulted in very large induction forces which overcame the short-range Pauliexclusion repulsion. This is because the model neglects the dipoles induced by short-range overlap effects, which should oppose the Coulomb-field induced dipoles. On thebasis of electronic structure calculations[27], Wilson and Madden suggested an addi-tional term to incorporate these dipoles into the present model. The induced dipolefrom eq. (1.35) will now be:
pi= αiEi +
∑j 6=i
αigij(Rij)qjRij
R3ij
(1.37)
where
gij(Rij) = − exp(−bRij)4∑
k=0
(bRij)k
k!. (1.38)
Putting everything together, the algorithm basically works according to the followingprinciple:
1. Calculate the contribution from the charges to the energy, forces and stress
2. Calculate the short-range induced dipole moment on each ion
3. Formulate a guess for the electric field on each ion by extrapolation from the lastthree timesteps
4. Solve for the dipoles, until they are consistent with the resulting electric field upto a certain accuracy
21
1. Simulation Techniques and Model Potentials
5. Use the converged values to calculate the contribution from charge-dipole anddipole-dipole interaction to energy, forces and stress
6. Calculate the contribution of the short-range induction of dipole moments to theenergy, forces and stress
7. Add up all contributions to the energy, forces and stress
The pair interaction between the ions used in the force field by Tangney and Scandolois a point charge Coulomb interaction plus a pair potential of Morse-Stretch form tomodel the short-range interactions:
Uij =qiqj
Rij
+ Dij[eγij(1−rij/r0
ij) − 2eγij/2(1−rij/r0ij)]. (1.39)
The parameter set used is shown in Table1.5.
D γ r0
O-O 2.4748× 10−4 12.07092 7.17005
Si-O 1.9033× 10−3 11.1523 4.6371
Si-Si −2.0846× 10−3 10.45517 5.75038
qO qSi α b c-1.38257 2.76514 8.89378 2.02989 -1.50435
Table 1.5.: Fluc. Dipole Force Field parameters (atomic units)
1.5. Comparison of Performance
As far as the speed of calculations is concerned, the simplest potential, which is thetwo-body BKS potential, is obviously the fastest. The fluctuating-charge potential isslowed down in comparison to BKS by about a factor of10 due to the shorter time stepthat is needed with the extended Lagrangian approach to equilibrate the charges andto decouple charge motion from the ionic motion. Using the direct calculation of thecharges at every 25th to 100th time step as suggested by the original authors [20] leadsto a similar slowing down.The comparison of the performance of the fluctuating-dipole potential with the stan-dard two-body potential is difficult as our BKS routine is highly optimized while thefluctuating-dipole routine uses new routines for every part of the calculation. As these
22
1.5. Comparison of Performance
were not optimized at all, the comparison would be meaningless because of differentways to calculate the details as for instance the Ewald sum, especially its reciprocalpart, or the neighbor lists. The original authors [90] claim to see a slowing down bya factor of100. However in comparison to our BKS routine the slowing down is evenmore significant, which is why in many instances in the following work the systemsizes for the fluctuating-dipole simulations will be smaller than for the other potentials.In general the fluctuating dipole can be treated comparable to the fluctuating charges,and thus in an optimized routine the slowing down should have a similar value, whichmeans a factor of10.
23
2. The α-β Quartz Transition
The transition fromα- to β-quartz is a displacive phase transition, which occurs at atransition temperature ofTtr = 846 K. The atomic structure of theα andβ polymorphsof quartz is known since 1925 [9] and was refined in the following decades by numer-ous experimental studies [39]. The structure ofα-quartz is most easily envisioned as
Figure 2.1.: Sketch of the averageβ-Quartz structure along the [100] direction
a distortion of the high-temperatureβ modification. Whenβ-quartz is cooled belowthe transition temperature, the expandedβ-quartz framework collapses to the denserα-quartz configuration. For the average structure, the contraction of the tetrahedral
Figure 2.2.: The two orientations ofα-Quartz
24
network may be described geometrically as the rotation of rigid tetrahedra around the[100] axes by an angleΘ. This angle can be used as on order parameter, which is zeroin theβ polymorph, whereasΘ is 16.3 for α-quartz at room temperature. Dependingon the sign of the tilting angle, the transformation yields two distinctα1 andα2 twinorientations as shown in Fig.2.2. These are called the Dauphine twins ofα-quartz.However the real picture of the transition is far more complicated. Even though theα − β transition has been subject of many studies over the past 100 years [39], it issurprising that there is still no firm picture of what actually happens at the phase tran-sition. This uncertainty is connected with the discussion about the real structure ofβ-quartz. While figure2.1shows the average atomic positions for the oxygen atoms, itturns out that these average position are rarely occupied. It is not completely resolvedwhat the instantaneous structure looks like that leads to the symmetric average posi-tions. There are basically two competing ideas ofβ-quartz.One picture of theβ-quartz structure is based on the idea that each oxygen atom isassociated with not one but two potential minima. As a consequence the atom wouldoscillate between two positions that correspond to the Dauphine twin configurations ofα-quartz. This means that in the high symmetry phase the atoms are hopping betweenthe positions corresponding to the different domains of the low symmetry phase, givingthe structure shown in Fig.2.1on average. Upon cooling, the dynamic disorder in thehigh symmetry phase gets ordered when the atoms progressively occupy the positionscorresponding to one of the orientations in the low symmetry phase. Therefore this pic-ture ofβ-quartz would imply an order-disorder type transition. It has been supportedby results of Neutron diffraction[107], NMR studies[87] and MD simulations[100].The other picture supports an ordered structure ofβ-quartz. The idea is that theatoms in principle vibrate around mean positions given by the average structure, whichchange on cooling belowTtr through symmetry breaking displacements. This point ofview explains the observed existence of soft modes inα- andβ-quartz[3, 92, 13, 24]and the absence of symmetry forbidden phonons in theβ phase of quartz[81], whichshould be detected ifβ-quartz consisted of clusters ofα-quartz that persist over longertime scales. However it is clear that the oxygen atoms do not fluctuate harmonicallyaround their average positions. This is supported by an X-ray study[49] that showedthat the oxygen probability density functions deviate considerably from Gaussians.This outcome was not interpreted as disorder in the sense of clusters of microtwins,but rather as librational motion of the oxygen atoms around their averaged positions,which lie on the straight connection of two Si atoms.
25
2. The α-β Quartz Transition
2.1. Transition Temperature
In the following the transition temperatureTtr of theα-β transition will be determinedfor the different potentials. For the BKS potential this value was recently shown [66]to be 740 K with an uncertainty of about5 K. For the fluctuating charge and the fluctu-ating dipole potential the transition temperature is not known and will be determinedin this section.In general for the calculation of the transition temperature in a computer simulationone is confronted with the problem, that due to the finite size of the simulation boxall thermodynamic properties behave smoothly near the phase transition, and so doesthe order parameter. In order to determine the transition temperatureTtr neverthelessaccurately, it is possible to use the fourth-order cumulant [8], which is defined in thecase of a one-component order parameter as
g4(N, T ) =1
2
(3− 〈(φ)4〉N
〈(φ)2〉2N
), (2.1)
where⟨φk⟩
deontes the thermal average of thek’th moment of the order parameterfor an N -particle system. It has been shown [104], that g4(N, T ), aside from smallcorrection terms, has a size-independent crossing point at a first-order phase transi-
500 600 700 800 900 1000T [K]
0
0.2
0.4
0.6
0.8
1
g 4(T)
N=72N=324N=864
Figure 2.3.: Fourth-order cumulantg4 as a function ofT for the fluctuating dipole potential
tion. This is valid under the restriction that the geometry of the simulation cell remainssimilar when the particle number is increased. This condition can only be approxi-mately satisfied in the case of a crystal, as it can only be expanded in multiples of the
26
2.1. Transition Temperature
unit cell. The unit cell used in the simulations is even larger than the primitive cell,as we fit the trigonalα-quartz phase into a rectangular simulation box. So only an ap-proximately coinciding crossing point can be expected for the different system sizes.The system sizes chosen areN = 72, N = 324, andN = 864. As shown in Fig.2.3,there is not a perfect crossing of the cumulants for the different system sizes, but it stillallows one to locate the transition temperature atT ≈ 715K with an uncertainty ofabout5K. This value is comparable to the BKS transition temperature, but even lowerand120K too low compared to the experimental transition temperature.To gain a more accurate picture of the transition it can be described within Landau
200 400 600 800 1000 1200T [K]
0
5
10
15
<Φ>
[°]
N=72N=324N=864L. T. (N=72)L. T. (N=324)L. T. (N=864)Landau Theory
Figure 2.4.: Order parameter〈|Φ|〉 as a function of temperature. Shown are different system sizessimulated with the fluctuating dipole potential, fits obtained with Landau theory and finite-size Landau theory.
theory in the same way as it is done in Ref. [66]. It is well established that the macro-scopic evolution of quartz at the transition point can be described by the standardLandau expansion for a first-order transition [13, 35, 4, 5]. Odd order terms inΦ arenot permitted by symmetry and the expansion is written as
F (Φ, T ) =1
2a(T − Tc)Φ
2 +1
4bΦ4 +
1
6cΦ6. (2.2)
F is the free energy per particle as a function of temperatureT and order parameterΦ anda, b, c, andTc are parameters. The parameter b should be negative to have a(weak) first order transition.These parameters can be specified by fitting the absolute value of the order parameter〈|Φ|〉 as a function of temperature to the data obtained from simulation. In finite-size
27
2. The α-β Quartz Transition
Landau theory for a system withN particles the expectation value reads
〈|Φ|〉 =
∫∞−∞ dΦ|Φ| exp{−βNF (Φ, T )}∫∞−∞ dΦ exp{−βNF (Φ, T )}
. (2.3)
This function is fitted against the data from theN = 324 system and shown in Fig.2.4.For the two other system sizes also the fit parameters obtained fromN = 324 areshown. It can be seen the behaviour of〈|Φ|〉 is reasonably described by Landau the-ory. The fit parameters area = 7.41 × 10−3 J/(mol · K), b = −4.97 × 10−3 J/mol,c = 8.03× 10−5 J/mol, andTc = 704 K. From Fig.2.4 the transition temperature canbe read asTtr = 712 K. Similar to the experiment [13], b is found to be negative, whichcharacterizes a first-order transition, andTtr − Tc = 8 K. This is also in good agree-ment with different studies based on experimental data, which typically determined thevalue ofTtr − Tc in the range of4− 13 K [3, 45, 35, 4, 22, 50]. In total the features ofexperimental studies are certainly reproduced, even though the transition temperatureis about130 K smaller.The same analysis for the fluctuating-charge potential (Fig.2.5) is done for systems
200 400 600 800 1000 1200 1400T [K]
-0.2
0
0.2
0.4
0.6
0.8
1
1.2
g 4(T)
N=324N=864N=1800
Figure 2.5.: Fourth-order cumulantg4 as a function ofT for the fluctuating charge potential.
sizesN = 324, N = 864, andN = 1800. The system sizes are chosen somewhatlarger than before for the reasons mentioned in chapter1.5. The non-monotonic be-haviour of the cumulant, which was also observed in Ref. [104], does occur withinthe plotted error bars. The cumulant analysis yields a transition temperature of aboutT = 550K. The parameters of the Landau expansion (eq. (2.2)) are fitted as describedbefore to the data of theN = 864 system. The parameters obtained were used for allthree system sizes shown in Fig.2.6. The fit parameters area = 8.92×10−3 J/(mol·K),
28
2.2. Hysteresis
200 400 600 800 1000 1200T [K]
0
5
10
15
<Φ>
[°]
N=324N=864N=1800L. T. (N=324)L. T. (N=864)L. T. (N=1800)Landau Theory
Figure 2.6.: Order parameter〈|Φ|〉 as a function of temperature. Shown are different system sizes sim-ulated with the fluctuating charge potential, fits obtained with Landau theory and finite-size Landau theory.
b = −4.30 × 10−3 J/mol, c = 1.02 × 10−4 J/mol, andTc = 570 K. Again, b is nega-tive and the differenceTtr − Tc is positive and about10 K, as we can find a transitiontemperature ofTtr = 581 K in Fig. 2.6. Again the characterisation of the phase transi-tion seen in experiment is obtained quite similar, but the discrepancy in the transitiontemperature of more than250 K is tremendous.
2.2. Hysteresis
An interesting feature in theα-β transition was discovered in Ref. [66] that is linkedto hysteresis effects in the transition. It was shown that one can distinguish betweenthe two phases from the local structure, which offers the possibility to study hysteresiseffects directly. This statement holds for our simulations, as it is shown for the case ofthe fluctuating-dipole potential in Fig.2.7. The pair correlation functiong(r) does notchange significantly with temperature above and belowTtr, but makes a sudden changeat the transition. So one can observe the hysteresis effect in theg(r) function. Whilethe structure atT = 725 K that was started with anα-quartz configuration equilibrated25 K below, it remains stable in this phase. On the other hand it also remains stablein theβ-quartz phase, when the initial configuration was equilibrated25 K above. Ofcourse in a simulation close to the transition temperature the system undergoes morechanges between the two phase for a small box, only for a larger particle number the
29
2. The α-β Quartz Transition
4 4.5 5 5.5 6r/Å
0
0.5
1
1.5
2
2.5
3g S
iO(r
)T=750 KT=725 K (cooling)T=725 K (heating)T=700 K
Figure 2.7.: Radial distribution functiongSi−O(r) at various temperatures for system size N=864 withfluctuating-charge potential.
system stays in one phase.
2.3. Thermal Expansion and c/a Ratio
One check for the different models is the temperature dependence of the volume closeto the transition. As can be seen in fig.2.8 the BKS potential gives fairly good agree-ment with experiment, even though the volume is sligthly overestimated and the tran-sition temperature differs from the experimental transition temperature as described inthe previous section. The result of the fluc-Q potential is quite similar, even thoughthe volume of both quartz phases is even bigger for this model. The best quantitativeagreement with experiment can be seen for the fluc-µ potential. The rather smoothbehaviour at the transition is due to the fact that this potential allows for the existenceof both of the two phases in a quite broad temperature range around the transition.However the volume expansion is not isotropic, but the jump at the transition was ob-served in experiment [13] to be of different magnitude for different spatial directions.This can be seen in the ratio of the lattice constantsc anda, which shows a disconti-nuity at the transition. It was recently pointed out [66], that in a computer simulationusing the BKS potential the behaviour of thec/a ratio differs qualitatively from the ex-perimental result, as the simulation does not see any discontinuity or even any distinctfeature in thec/a ratio at the transition. This behaviour is shown in figure2.9. Shown
30
2.3. Thermal Expansion and c/a Ratio
0 400 800 1200 1600T/K
112
114
116
118
120
122
V/Å
3
BKSexperimentfluc Qfluc-dipole
Figure 2.8.: Temperature dependence of the volume per unit cell at theα-β transition. All of thethree different model potentials show qualitative agreement with experiment, while thequantitative agreement is best for the fluc-µ potential.
-500 0 500T-Ttr [K]
0
0.004
0.008
[c/a
](T)-
[c/a
](Ttr)
ExperimentBKSfluc-Qfluc-dipole
Figure 2.9.: Temperature dependence of thec/a ratio at theα-β transition. For easier comparison thecurves are shifted to match at their respective transition temperature.
in this figure are also the curves for the fluc-Q and the fluc-µ potential. In the caseof the fluc-Q potential one can see a change in the slope at the transition temperature.Thus there is at least an effect of the transition in thec/a ratio, but it is still far awayfrom reproducing the height of the stroke that occurs in experiment. In contrast thefluc-µ approach matches the experimental course of thec/a ratio quite well even in
31
2. The α-β Quartz Transition
quantitative terms. The smooth behaviour at the transition is again owing to the broadrange of phase coexistence as discussed above.
2.3.1. Influence of Specific Properties of the Potentials
0 200 400 600 800 1000 1200 1400T [K]
1.088
1.09
1.092
1.094
c/a
standard fluc-Q potentialfluc-Q potential with fixed Q
Figure 2.10.: Temperature dependence of thec/a ratio at theα-β transition for the fluc-Q potentialwith fluctuating and fixed charges.
A closer look at the origin of these differences can be done by investigating the in-fluence of the fluctuating charges and the fluctuating dipoles on this behaviour. If weuse the fluctuating charge potential with the charges fixed on the average charges inα-quartz, the behaviour of thec/a ratio is only marginally different, and only in thehigh temperature regime. The kink atTtr is still of the same shape as with the fluc-tuating charges. In general there is not much difference between the average chargesin α-quartz, which are about< QSi >= 1.318e for Si, and inβ-quartz, where thevalue is< QSi >= 1.293e. So it is justified to state that the fluctuations of the chargesbarely affect the simulation, at least the kink in thec/a ratio is certainly not a result offluctuatingcharges but rather an effect of the pure two body forces in the potential.The same analysis for the fluctuating dipole potential results in a completely differ-ent picture. The simulation crucically depends on the fluctuating dipoles. When thedipoles are fixed on the average values found inα-quartz, the crystal would not trans-form to theβ phase even at temperatures as high as1300K. Similarly, with fixedaverageβ quartz dipoles the crystal would stay in aβ-quartz configuration even at300K. This can be seen in the temperature dependence of the order parameter〈|Φ|〉 asshown in fig.2.11. While in the first case the volume (Fig.2.12) matches the volume ofthe run that has the dipoles fluctuating at a temperature of300K, where the averagingwas performed, the volume in the latter case is much higher than with a fluctuatingdipole run. This is due to the fact that the average dipoles are not a reasonable quantityin theβ-quartz phase, as they represent the dipoles that result from thermal averages
32
2.3. Thermal Expansion and c/a Ratio
0 500 1000T [K]
0
5
10
15
c/a
fluc-dipolefixed α dipolesfixed β dipoles
Figure 2.11.: Order parameter〈|Φ|〉 as a function of temperature for the unaltered fluc-µ potential andfor the same potential with dipoles fixed on their average values inα-quartz orβ-quartz
0 400 800 1200T [K]
112
114
116
118
120
122
V [Å
3 ]
experimentfluc-dipolefixed β dipolesfixed α dipoles
Figure 2.12.: Volume per unit cell of quartz as a function of temperature for the unaltered fluc-µ
potential and for the same potential with dipoles fixed on their average values inα-quartz orβ-quartz
over the structure. So for example, for symmetry reasons, thez component of thedipole must be zero inβ-quartz but not inα-quartz. To constrain the dipoles to thevalues that they have inβ-quartz makes the crystal tend more to the average structurewith stretched bonds on the oxygen atoms, which explains the artificially increasedvolume that is observed when the constraint is applied in the simulations. Also thec/a ratio, shown in fig.2.13, is quite independent of temperature in this setting andshows an unphysical value for the fixedβ-quartz dipoles. To summmarize, one cansay that the dipoles play an important part in the model and are responsible for a bigpart of the forces that act on the atoms. While these simulations show the effect thatthe dipoles have on the structure and the phase transformation, the mechanism how thec/a anomaly at theα-β transition comes about is not yet resolved.
33
2. The α-β Quartz Transition
0 400 800 1200T [K]
1.085
1.09
1.095
1.1
c/a
experimentfluc-dipolefixed α dipolesfixed β dipoles
Figure 2.13.: c/a ratio of quartz as a function of temperature for the unaltered fluc-µ potential and forthe same potential with dipoles fixed on their average values inα-quartz orβ-quartz
2.4. Distortion of Tetrahedra
The reason for the behaviour of thec/a ratio in quartz was investigated by Grimm andDorner [35]. They isolated three tendencies that go along with increasing temperature.
• increasing Si-O-Si angle
• decreasing mean Si-O distance
• contraction of SiO4 groups in c direction
While it is possible to describe the change in the volume of quartz by rotation of rigidtetrahedra by leaving all nearest neighbor Si-O bond lengths constant, the behaviourof the c/a ratio cannot be reproduced by such a model. It was shown [86] by purelygeometrical arguments that a value ofc/a > 1.0981 can only be achieved in a quartzcrystal if the tetrahedra are deformed. The model employing only tilting of rigid tetra-hedral SiO4 units only can not account for a lower value in this ratio, even though itcan explain all volume effects. Given this argument and the experimentally knownlattice constants a deformation of the SiO4 tetrahedra must be present for tempera-tures lower than about 400 K. The shearing of the tetrahedra in the quartz phase isalso well established experimentally [35, 49, 13]. To test if such a deformation ispresent in the simulations, one can look at the tetraeder angleϑOSiO, which is shown infig. 2.14. However the fluctuating dipole potential, which definitely shows the samec/a ratio behaviour as in experiment, does not exhibit a dramatic change in the overallaverage of the OSiO angle when going to small temperatures (see fig.2.14) and noobvious difference compared to the BKS potential. On the other hand the average ofall tetrahedron angles is not sensitive to shearing, as the different angles in a deformedtetrahedron are likely to cancel out on average. The second moment of the distribution
34
2.4. Distortion of Tetrahedra
500 1000T [K]
109.2
109.25
109.3
109.35
109.4
109.45
109.5
<ϑO
SiO
>
<δϑ><δϑ>
500 1000T [K]
3
4
5
6
7
8
<δϑ2 O
SiO
>
<δϑ2><δϑ2>
BKSfluc-dipole
Figure 2.14.: Average O-Si-O bond angle and its second moment as a function of temperature
could give more information, but the value obtained with fluc-µ is comparable to thatin BKS.A more sensitive analysis of the angle distribution can be done with the help of the
500 1000T [K]
-0.08
-0.06
-0.04
-0.02
0
g 4
fluc-dipoleBKS
Figure 2.15.: Average fourth order cumulant of the O-Si-O bond angle as a function of temperature
fourth-order cumulant shown in fig.2.15. As different mean values for the differentO-Si-O bond angles would result in a superposition of Gauss distributions with differ-ent mean, the overall average should deviate from a plain gaussian. A measurementfor the gaussian behaviour of a distribution is the fourth-order cumulant, defined as
g4 =1
2
(3− 〈(δϑ)4〉
〈(δϑ)2〉2
), (2.4)
which is zero for a gaussian distribution. One can see that the angle distribution gen-erated by the BKS potential deviates even more from gaussian behaviour than thefluc-dipole bond-angle distribution. This means that the tetrahedra in theα phase ofthe BKS potential are even more deformed than in the fluc-dipole potential. This canalso be seen quite obvious by an exemplary look at the average angles making up the
35
2. The α-β Quartz Transition
Figure 2.16.: [001] projection of theα1, α2 andβ configuration. Heights along [001] are shown inparantheses.z is 1/6 for β-quartz and slightly below or above for the two Dauphinetwins ofα-quartz. Picture taken from Kihara.
tetrahedron around one specific silicon atom. In order to enumerate the atoms in awell-defined way, the definition by Kihara [49] is used, which is shown in fig.2.16.The comparison of the angles around the Si1 position forα-quartz at298K is shownin the following table with experimental values by Kihara.
Experiment BKS fluc-dipoleO1-Si-O2 110.5 107.5 110.1O1-Si-O6 108.9 114.8 108.9O1-Si-O5 108.8 108.2 109.1O2-Si-O5 109.3 110.5 109.5
The table shows that the deviation between the ideal tetrahedral angle of 109.47 de-grees and the calculated angles has the correct sign and amplitude for the fluctuating-dipole potential as compared with experiment, in contrast to the BKS result. One cansee that the large deformation, that was also seen in the figures above, is actually wayto large compared to experiment and moreover has the wrong sign. In three out of thefour angles shown, the abberation from the tetraeder angle that is predicted by BKSgoes into the wrong direction. The explanation follows from the geometrical argumentgiven by Smith [86] when we look at the absolute value of thec/a ratio produced byBKS. It is shown in fig.2.17, that thec/a ratio does not exceed the value of1.0981 forthe case of the fluctuating dipole potential, in contrast to the BKS potential, which isbelow this value only for high temperature in theβ-quartz. So the BKS quartz has tobe strongly deformed even in theβ phase because of geometrical reasons, so it is clear
36
2.4. Distortion of Tetrahedra
112 114 116 118 120 122 124V [Å3]
1.08
1.085
1.09
1.095
1.1
1.105
1.0981
c/a
ExperimentBKSfluc-Qfluc-dipole
Figure 2.17.: c/a ratio in quartz as a function of the volume per unit cell.
that the subtle shear effect in the tetrahedra that would lead to the correct behaviourof the lattice constants is completely suppressed by a large deformation having theincorrect sign.
2.4.1. Influence of Atomic Bond Character
The origin of the distortion of the tetrahedra that leads to a contraction of thez axisin quartz, was related by Hill and Gibbs [44] to an increasingπ bond order, i.e. anincreasing fraction ofπ-bonded valence electrons. At ambient conditions, Hill andGibbs have observed that the mean Si-O bond length is inversely proportional to thesize of the Si-O-Si angle. Plots ofRSiO versus the function−1/ cos(Si-O-Si) for awide variety of silicate structures are linear with the shorter bonds associated with thewider angles. On the basis of molecular orbital calculations [59, 34] a linear relationbetweenπ-bond order and both, the mean Si-O distance and−1/ cos(Si-O-Si), wasproposed. This was based on theπ-bonding model of Cruickshank [18], which is il-lustrated in Fig.2.18. The two pictures show how the p-orbitals of the oxygen atomscan be combined with thedz2 anddx2−y2 orbitals of the Si atom to formπ-bondingmolecular orbitals (the colours correspond to the signs of the wave function). It wasshown for SiO4 type tetrahedra that the decreasing Si-O distance is accompanied byan increasingπ-bond order. [18]. Furthermore thed-orbitals single out thez′ axis andat least for thedx2−y2 orbital it is obvious that an increasingπ-bond order will tend topull the oxygen atoms towards thex′y′ plane.To demonstrate the validity of this model for quartz, Grimm and Dorner showed thecorrelation between the mean Si-O distance and the Si-O-Si angle as mentioned above.To compare their conclusions to the simulations one has to determine the Si-O bond
37
2. The α-β Quartz Transition
Figure 2.18.: Models showing the formation of bindingπ-orbitals for XO4 groups. Pictures takenfrom Cruickshank.
11.051.11.151.21.251.3-1/cos(ϑSiOSi)
1.58
1.59
1.6
1.61
RS
iO[Å
]
Exp. (Grimm and Dorner)fluc-dipoleBKS
Figure 2.19.: Correlation between the mean Si-O distanceRSiO and the Si-O-Si angleθSiOSi
length in the average configuration rather than the average of the instantaneous bondlengths. The outcome in Fig.2.19shows clearly, that the angular dependence of theSi-O bond length is very similar to the experiment. The absolute numbers are compa-rable and the dependence is linear as predicted by the Hill-Gibbs relation. The figureshows that the effects of theπ bonds on the Si-O distance and the Si-O-Si angle, whichcontrols most of the volume expansion, are obviously included in the BKS potentialfairly well as well. Only the third effect, the contraction of the tetrahedra inz directionthat leads to the anomaly in thec/a ratio, is obviously not correctly modelled by theBKS potential as shown before, in contrast to the fluctuating dipole potential.Keeping in mind the Hill and Gibbs discussion ofπ-bond order and the results pre-sented above raises the question whether the effect ofπ-bonds has been parametrizedimplicitly as (fluctuating) dipoles in the potential by Tangney and Scandolo. It is shown
38
2.5. Elastic Constants
in Fig. 2.20, that the symmetries of the average dipoles in this potential very much re-
Figure 2.20.: Average dipoles in theα- (left) and theβ-quartz phase (right). Projection along the [100]direction. Obvious is the symmetry forbiddenz component (vertical) inβ quartz as wellas the dipole orientation orthogonal to the Si-O-Si connection line inα-quartz.
semble to the symmetries in theπ bond model. Their orientation around a tetrahedronis the same as for the oxygenπ orbitals and they single out thez direction. Of coursethis only constitutes an analogy as the quantum chemical interaction of the orbitals inFig. 2.18and the classical dipole interaction are of different nature. But it underlinesthe suspicion that the dipoles introduce the right effects into the system, but maybe doso by incorporating physics which is usually not to be described by classical dipolesalone. But it is not too surprising that this actually works, as already a simple classicaltwo body potential like BKS can model the tetrahedra quite well, even though theirformation is a quantum chemical effect of thesp3 hybrid orbitals.
In a later chapter on electromechanical coefficients, it will be shown that the piezoelec-trical response of quartz using the fluctuating charge potential reproduces available ex-perimental data much better if the external electric field is coupled to the charges onlybut not to the dipoles themselves.
2.5. Elastic Constants
There are two reasons why the calculation of elastic constants is crucial to test whetherthe model describes theα-β transition well. The first is that the elastic constants are
39
2. The α-β Quartz Transition
very sensitive to small changes in the model potential energy surface and second theyshow distinct features at theα-β transition in quartz, as discussed recently by Carpen-ter et al. [13].The calculation of the elastic constants in our simulations was done in the NpT ensem-ble using the fluctuations of the strain tensoru [72]. The strain tensor can be writtenin terms of the simulation boxh as
u =1
2
(h′−1
0h′hh−1
0− 1)
=1
2
(δh h−1
0+ h′−1
0δh′)
+O(δh2)
(2.5)
Now the elastic constants can be evaluated with the help of the fluctuations of thisquantity:
Cαβγδ =V
kBT〈δuαβδuγδ〉−1 (2.6)
As theh matrix is symmetric in the Parrinello Rahman method, derived tensors likethe strain tensor and the elastic constants will also be symmetric and can be written inVoigt notation (see chapter1.1.1). This reduces the 4th rank tensor of dimension 3 toa square matrix of dimension 6. In a crystal the number of independent coefficientsreduces even more, related to the crystal symmetry class. Forα-quartz, which is atrigonal holoaxial system, the elastic constants have the following symmetry:
C =
C11 C12 C13 C14 0 0C12 C11 C13 −C14 0 0C13 C13 C33 0 0 0C14 −C14 0 C44 0 00 0 0 0 C44 C14
0 0 0 0 C1412(C11 − C12)
(2.7)
With ascending symmetry the number of independent elastic constants decreases. Thuswhen going to theβ-quartz configuration, which is a tetragonal holoaxial system, thecrystals gains symmetry and therefore loses independent entries in the matrix, in thiscaseC14 will vanish. Note thatC14 can only be non-zero for systems that lack inversionsymmetry, as in tensor notationC14 becomesC1123 in which the indices 2 and 3 onlyoccur once. This is a reflection of quartz lacking inversion symmetry, see Fig.2.20.Consequently, the sign ofC14 depends on the chirality in quartz, i.e., whether we haveleft-handed or right-handed quartz. The elastic constants tensor ofβ-quartz looks like
C =
C11 C12 C13 0 0 0C12 C11 C13 0 0 0C13 C13 C33 0 0 00 0 0 C44 0 00 0 0 0 C44 00 0 0 0 0 1
2(C11 − C12)
(2.8)
40
2.5. Elastic Constants
40
60
80
100
120
140
Cii [G
Pa]
C33
C11
C44
C66
C11
C33
C11
C33
C11
C33
C33
C11
C44
C66
C33
C11
C44
C66
Exp.C11 (BKS)C33 (BKS)C44 (BKS)C66 (BKS)
40
60
80
100
120
140
Cii [G
Pa]
Exp.C11 (fluc. charge)C33 (fluc. charge)C44 (fluc. charge)C66 (fluc. charge)
-600 -400 -200 0 200 400T-Ttr [K]
40
60
80
100
120
140
Cii [G
Pa]
Exp.C11 (fluc. dipole)C33 (fluc. dipole)C44 (fluc. dipole)C66 (fluc. dipole)
Figure 2.21.: Elastic Constants
41
2. The α-β Quartz Transition
-20
0
20
40
60
Cij [G
Pa]
C14C12
C13
C14C13C12
C14C13C12
C14
C12
C13
C14
C12
C13
C14
C12
C13
Exp.C12 (BKS)C13 (BKS)C14 (BKS)
-20
0
20
40
60
Cij [G
Pa]
Exp.C12 (fluc. charge)C13 (fluc. charge)C14 (fluc. charge)
-600 -400 -200 0 200 400T-Ttr [K]
-20
0
20
40
60
Cij [G
Pa]
Exp.C12 (fluc. dipole)C13 (fluc. dipole)C14 (fluc. dipole)
Figure 2.22.: Elastic Constants
42
2.6. Phonon Density of States
The simulation results for the elastic constants are shown in Fig.2.21for the relevantdiagonal elementsC11, C33, C44, C66 and in Fig.2.22for the relevant non-diagonal el-ementsC12, C13, C14. The curves are shifted in temperature to match the respectivetransition temperatures of the models.All models show the general behaviour that there is a marked softening inC11, C12, C13,andC33 asT → Ttr. Only theC44 andC66 do not vary so much with temperature andnot at all in the stability field ofβ-quartz, whileC14 is quite constant inα-quartz andvanishes in theβ-quartz phase due to symmetry reasons.As already shown in Ref. [66], BKS shows good qualitative agreement with experi-ment, also for the strong temperature dependence nearTtr. Also most experimentalfeatures are well reflected, e.g.C11 andC33 cross between high and low temperaturessimilar toC44 andC66 (both shown in Fig.2.21), while C12 andC13 do not cross. Thisgood agreement is not too surprising considering the way in which the BKS parame-ters where determined: ab initio data along with elastic moduli were used to constructthe potential energy surface.In comparison to BKS the agreement of the fluctuating charge potential with exper-iment is not too convincing. While the qualitative trends are reproduced quite well,almost every value is significantly lower than in experiment.The fluctuating dipole potential is in better agreement, but does not improve on theBKS behaviour. While the agreement inα-quartz is better than BKS forC44, it is lessgood forC11. However the values forβ-quartz seem to have similar deviations forthe experimental values. Close to the transition temperature the softening is generallymore pronounced in all simulations due the finite system size, but at higher tempera-tures BKS and the fluctuating dipole potential agree on higher values forC12 andC13
than the experiment.
2.6. Phonon Density of States
A quantity of interest in computer simulations of amorphous as well as crystalline sys-tems is the vibrational density of states (DOS). In general it is a measurement for thelattice dynamics, as it shows the distribution of vibrational states over frequency. Thismeansg(ν)dν give the number of eigenstates in the frequency rangeν andν + dν.While it can also be measured experimentally by neutron scattering, the simulationgives insight to where the microscopic origin of the distribution comes from. For ex-ample the partial distribution functions are often shown, which take into account onlythe contributions from a certain atom type, which is a quantity not possible to be mea-sured experimentally in general. However it was shown recently [7] for the example ofBKS in the simulation of amorphous silica, that the density of states is not well repro-duced by this model. Even though the structure of vitreous SiO2 was shown to change
43
2. The α-β Quartz Transition
only weakly by a subsequent first-principles calculation, the DOS was strongly mod-ified by using an ab initio treatment of the forces, and that this lead to a much betteragreement with experimental results. Moreover, in a large frequency range the natureof the excitations as determined from the effective potential differed significantly fromthe one determined from the ab initio force. This calls into question the explanatorypower of an analysis of the nature of the vibrational excitations determined from theBKS force field. On the other hand it gives rise to the question if other effective forcefields can do better, as ab-initio calculations suffer from their heavy computational costwhich restricts this type of calculations to the study of very small systems with ratherlow statistical accuracy.The definition of the vibrational density of states reads
g(ν) =1
3N
3N∑i=1
δ(ν − νi), (2.9)
with N being the particle number andνi, i = 1, . . . , 3N the eigenfrequencies of thedynamical matrixD. A less laborious way is the calculation in harmonical approx-imation, which only requires to calculate the Fourier transform of the velocity autocorrelation function:
g(ν) =1
NkBT
∑j
mj
∞∫−∞
dt⟨vj(t).vj(0)
⟩ei2πνt. (2.10)
This was calcluated in the simulations by averaging the velocity auto correlation func-tion over time intervals of2048 steps, which corresponds to real time intervals of2 ps,allowing for a resolution of1/2ps= 0.5 THz in the vDOS.The most obvious disagreement between the lattice dynamics of a BKS simulationand an ab initio simulation can already be seen directly in the vibrational DOS inFig. 2.23. The figure shows a comparison ofα quartz at300 K with ab initio datafrom Roma et al. [79], as no experimental measurement of the DOS in quartz couldbe found. The figure shows that the inter tetrahedral motions, the so called rigid unitmodes which account for the lower frequency range, show a significant discrepancy, asit is already known for amorphous systems. In the higher frequency range the doublepeak structure, which is available in both of the curves, comes about due to intratetra-hedral stretching vibrations [32, 73]. The four oxygen atoms in an SiO4 tetrahedronare moving at the higher frequency (“breathing mode”) in phase in relation to the cen-tral Si atom, at the lower frequency two O-Atoms oscillate in anti-phase to each other.However the frequency of these oscillations seems to be shifted from32.1 THz for thelow frequency peak, according to neutron scattering in vitreous silica [75], to around30 THz in α quartz, according to the ab initio data at hand. The lower peak of theBKS potential, which coincides with the experimental frequency quite well, is how-ever shifted rather to a higher frequency of about33 THz in α quartz.
44
2.6. Phonon Density of States
0 10 20 30 40ω [THz]
0.00
0.02
0.04
0.06
0.08
G(ω
) [TH
z-1]
ab initioBKS
Figure 2.23.: Phonon Density of States inα-quartz at300K. Comparison of BKS and ab initio data.
The fluctuating charge model shows a slightly better agreement with the ab initio data
0 10 20 30 40ω [THz]
0.00
0.02
0.04
0.06
0.08
G(ω
) [TH
z-1]
ab initiofluc. charge
Figure 2.24.: Phonon Density of States inα-quartz at300K. Comparison of the fluctuating charepotential and ab initio data.
where the lower frequencies are concerned. The two peaks at11 THz and22 THz atleast exist close by and the structure is approximately maintained. The two peaks ofthe intra tetrahedral modes collapse on just a single peak, but exist at roughly the rightfrequency.The best overall agreement for both the rigid unit modes and the double peak isclearly shown by the fluctuating dipole potential. This is not too surprising as it wasparametrized to match ab initio forces and stresses, but also the BKS potential was
45
2. The α-β Quartz Transition
0 10 20 30 40ω [THz]
0.00
0.02
0.04
0.06
0.08G
(ω) [
THz-1
]ab initiofluc. dipole
Figure 2.25.: Phonon Density of States inα-quartz at300K. Comparison of the fluctuating dipolepotential and ab initio data.
parametrized to quartz data, even though the DOS looks better for vitreous silica. Thefluctuating dipole potential is almost congruent with the ab initio result in this case,only the tetrahedral breathing mode is slightly shifted in frequency. This convincingagreement suggests a good credibility for the lattice dynamics in this force field.
46
3. Pressure-Driven Transitions inα-Quartz
The high-pressure behaviour ofα-quartz is not yet fully understood neither on the theo-retical and nor on the experimental side. The majority of polymorphs that are observedat ambient to moderate pressures, such as cristobalite and quartz as well as other poly-morphs including tridymites and coesite, are built up of SiO4 tetrahedra [39]. At higherpressures dense forms containing SiO6 octahedra are observed such as stishovite above9 GPa, which has a rutile type structure. Because of the relatively strong Si-O bondingin silica, there are high kinetic barriers associated with the transitions to stable phasescontaining octahedrally coordinated silica at high pressure.As the pressure is increased, the four-coordinated structures become increasingly un-favorable and eventually the polymorph become unstable. New phases are formed thatcan be either crystalline or amorphous. The newly formed phases can often be reachedrelatively easily by local rearrangement of the atoms, however these phases are oftenonly thermodynamically metastable [52, 53, 105, 97, 99]. The transition path wayfrom quartz to stishovite, which is the proper high-temperature polymorph at elevatedpressure, would be highly reconstructive and is thus kinetically suppressed. Becauseof slow kinetics, the large number of possibilities to form six-coordinated structuresfrom four-coordinated structures, the metastability, but also experimental difficultiessuch as low x-ray scattering factors, the phase behaviour of high pressure quartz is stillnot completely resolved.The high-pressure behaviour ofα-quartz is particularly complex [52]. The stablephases of SiO2 in the order of increasing pressure are quartz, coesite (from about 3GPa), and stishovite (from about 7 GPa), as shown in the phase diagram in Fig.0.1.However, at room temperature the transformations are kinetically inhibited. Conse-quently, quartz can be kept metastable up to 21 GPa. Initially a pressure inducedamorphization was observed inα-quartz [40], but soon it was discovered, that someof these new materials formed at high pressure were found to exhibit unusual prop-erties for amorphous solids such as elastic anisotropy [64] and memory effects [55].The experimental observations at this point are somewhat complex, but it is clear thataround 21 GPa a transformation to a quartz II phase of unknown structure occurs.The amorphous phase develops out of this new phase and grows with pressure untila fully amorphous structure is reached above 30 GPa. Kingma et al. [52] report thatsamples recovered from above 30 GPa appeared to be entirely amorphous, while those
47
3. Pressure-Driven Transitions in α-Quartz
recovered from below this pressure contained crystalline regions. This explains theunexpected anisotropic properties of the under X-ray apparently amorphous phase. Adifferent result was obtained by Haines et al. [38], who saw a quartz II structure onlyas an intermediate phase from 19 to 26 GPa, which reverted for higher pressures to amonoclinic P21/c phase.
3.1. Quartz II Transition in Simulations
For molecular dynamics simulations employing the BKS potential it was shown that aphase transition occurs, whenα-quartz is compressed to 22 GPa [95, 96]. This tran-sition turned out to be not reversible [83]. It is crucial for the transition to occur that
Figure 3.1.: Snapshot of a Quartz II configuration with 2160 atoms. The configuration is rotated toalign the crystal axis horizontally, but it can still be seen that the box is sheared ratherthan orthorombic.
48
3.1. Quartz II Transition in Simulations
a constant pressure regime with a fluctuating box geometry is used, as the new phasecan only be established from theα-quartz configuration when the box is allowed toshear, which is shown in Fig.3.1. The new phase is perfectly crystalline, which is ob-vious from the structure snapshot, but it is subtle to achieve. In order to end up in thiscrystalline phase and not in an amorphous phase, the fictious mass of the box has to besufficiently small, and the particle number has to be large. For smaller particle numberthe transition would occur at a pressure of about 28 to 30 GPa. This is because atpressures such highα quartz is far beyond its stability range anyway and so it dependson various conditions if the metastability holds or if the crystal converts to a differentphase. However the pressure of 22 GPa is the smallest that could be found and is cer-tainly very comparable to experimental findings, which makes it a likely candidate forthe unknown Quartz II structure.From the pair correlation function or actually by viewing a snapshot of the system itcan be seen that only a third of the silicon atoms is four coordinated, but two thirds
Figure 3.2.: Silicon Coordination in Quartz II. Four coordinated silicon is printed in blue while the sixcoordinated silicon atoms are shown in yellow.
of silicon atoms have six neighbours, as it is common for the crystalline high pressurephases of SiO2. This can be seen in Fig.3.2, where in a snapshot of the configurationthe silicon atoms are coloured according to their coordination number. The four coor-dinated Si atoms are in the centres of SiO4 tetrahedra, while the six coordinated atomsare surrounded by oxygen atoms in the corners of an octahedron.
3.1.1. Transition Path Ways
The density changes in a compression/decompression cycle are shown in the equa-tion of state in Fig.3.3. Starting with theα-quartz configuration at zero pressure, thepressure is increased up to 21 GPa, where the system collapses from theα-quartz con-figuration into the quartz II phase. The transition is discontinous in the volume and
49
3. Pressure-Driven Transitions in α-Quartz
15 20V [cm3mol-1]
0
10
20
30P
[GP
a]
Quartz II
α-Quartz
δ-QuartzQ
uartz II b
experimentBKSfluc. charge
Figure 3.3.: Equation of State forα-quartz under pressure for BKS and fluctuating charge potential.
irreversible: in the simulation the new phase remains stable upon further compressionand even on decompression below the transition pressure. Even at small pressures thecyrstal does not revert to theα-quartz structure, but transforms into a newδ-quartzphase. This phase transition is reversible with a hysteresis, but is also non-displacive.The δ-quartz phase is stable within the BKS potential even at ambient pressure andwould not revert toα-quartz.For the fluctuating charge potential the equation of state for different quartz phases isalso shown in Fig.3.3. The phase transition occurs at a slightly higher pressure of 25GPa, and the volume of both theα quartz and the quartz II phase agree very well withthe BKS results. Nevertheles, the quartz II phase does not remain stable on decompres-sion, but the system undergoes a reversible phase transition at 21 GPa to a structurallysimilar phase named quartz II b in the figure. This phase has a smaller density than theBKS quartz II phase at the same pressure and reverts to theα quartz phase at 4 GPa.Theδ-quartz phase of BKS is not produced. Moreover theδ-quartz phase is not evenstable for the fluctuating charge potential but quickly transforms toα quartz.These findings for the fluctuating charge potential are also valid for the fluctuatingdipole potential. As shown in Fig.3.4, the variation of the volume with pressure isidentical to the fluctuating charge potential with respect to its qualitative features. Thetransition temperature to quartz II is 27 GPa now, and it has to be noted that the tran-sition only occurs for small systems. For larger systems theα-quartz configuration isstabilized for even much higher pressures. The transition to quartz II b occurs also at21 GPa and the next transition toα-quartz will take place not until 2 GPa. Also in thispotential the BKSδ-quartz phase is not stable and thus seems to remain an artificial
50
3.2. Quartz II b
15 20V [cm3mol-1]
0
10
20
30
P
[G
Pa]
Quartz II
α-Quartz
δ-QuartzQ
uartz II b
experimentBKSfluc. dipole
Figure 3.4.: Equation of State forα-quartz under pressure for BKS and fluctuating dipole potential.
polymorph of the BKS potential.
3.2. Quartz II b
The quartz II b phase, which does not form in a BKS simulation out of quartz II,emerges from quartz II phase with decreasing pressure at around 20 GPa for both thefluctuating dipole and the fluctuating charge potential. The connectivity of the atomsremains the same as in quartz II during the transition and the structure change is notvisible in a snapshot nor in the scattering spectra, but the change in the pair correlationfunction is obvious as shown exemplary in the Si-O pair correlation for the fluc. dipolepotential in Fig.3.5. From 23 to 20 GPa the cyrstal is in the quartz II phase and thepair correlation function changes only gradually. At the transition to the quartz II bphase at 19 GPa the pair correlation function exhibits a discontinuous jump, and ischanging only slightly on further decompression down to 17 GPa within the quartz IIb phase. The phase transition is reversible when the pressure is increased again, whilethere is a hysteresis effect that implies a higher transition pressure of about 2 GPaon recompression. These findings indicate a (quasi) displacive crystalline-crystallinefirst-order transition.
51
3. Pressure-Driven Transitions in α-Quartz
2 2.5 3 3.5 4r [Å]
0.05
0.1
0.15
0.2
g SiO
(r)
Q II
Q II b
17 GPa18 GPa19 GPa20 GPa21 GPa23 GPa
1.5 20
0.2
0.4
Figure 3.5.: Si-O Pair correlation for the fluctuating dipole potential for different pressures around theQuartz II - Quartz II b transition. The pressure was decreased subsequently starting fromquartz II.
3.3. X-Ray Diffraction Spectra
The similar behaviour of the three model potentials at the quartz II transition andthe apparent similarity of the crystalline structure emerging from these simulationsgives the simulation results a certain credibility for predictions towards the experi-ment. In experiments the structure of a crystal can be characterized by its diffractionpattern, such as the energy dispersive x-ray diffraction spectra measured for quartz IIby Kingma et al. [52]. To measure these data in a simulation one has to calculate thestructure factor
S(q) =
∣∣∣∣∣∑j,k
fjfk exp{iq(Rj −Rk)}
∣∣∣∣∣2
=
∣∣∣∣∣∑j
fj exp{iqRj}
∣∣∣∣∣2
(3.1)
with the appropriate atomic form factorsfi. These are tabulated as a function ofsin(Θ)/λ in Ref. [61], pp. 202, 203. A diffraction angle of 5◦ and a Gaussian broaden-ing with a 0.5 eV FWHM were used to generate the spectra. The wave vector is relatedto sin(Θ)/λ via the Bragg conditionλ = 2d sin Θ asq = 4πsin(Θ)/λ.The reciprocal lattice vectors have to fit in the simulation box:q = 2πh−1(nx, ny, nz),
which simplifies eq. (3.1) to
S(q) =
∣∣∣∣∣∑j
fj exp{2πi(nx, ny, nz)rj}
∣∣∣∣∣2
. (3.2)
52
3.3. X-Ray Diffraction Spectra
15 20 25 30 35Energy [keV]
BKSfluc. chargefluc. dipole
4.74 3.56 2.85 2.37 2.03d [Å]
Figure 3.6.: Energy dispersive x-ray diffraction patterns of Quartz II at 27 GPa. The experimentalx-ray diffraction spectrum shown in black is taken from Kingma et al. [52]. The Q’symbols represent shifted quartzlike peaks while the * depict new nonquartz peaks. Nedenotes diffraction from neon, which is used as pressure medium.
The diffraction spectra for the different potentials are compared to the data by Kingmaet al. in Fig.3.6. The three potentials are in good agreement with each other concern-ing the structure of quartz II and can be related quite reasonably to the features of theexperimental spectrum.An overview comparison for the spectra of the three potentials is given in Fig.3.7,where one can see the course of the peaks in theα quartz phase and the change to thequartz II peaks at the different transition temperatures. The position of the peaks canbe reexpressed as a Bragg distance between diffraction planes. The Bragg distancesas a function of pressure can then be compared to the data given by Kingma et al. InFig. 3.8 the interplanar spacings are shown in comparison with the experimental data.From this figure and fig.3.6it can be summarized that the features of the experimentalspectrum agree quite well with the simulations. The apparent absence of the interpla-nar spacing around 3.6A in all simulations might be explained with the fact that thepeaks at 3.8A in the simulation consists of two very close peaks which are not resolvedin the plot. On the other hand the apparent absence of the 2.8A Bragg distance in exper-iment might arise out of a misinterpretation of the experimentally complicated energyrange around 27 keV. In this energy range one peak arises from Neon that was used aspressure medium in experiment, which might cover the additional interplanar spacing
53
3. Pressure-Driven Transitions in α-Quartz
15 20 25 30 35Energy [keV]
4.74 3.56 2.85 2.37 2.03 d [Å]
15
18
21
25
27
28
29
30
p [G
Pa]
15 20 25 30 35Energy [keV]
4.74 3.56 2.85 2.37 2.03d [Å]
15 20 25 30 35Energy [keV]
4.74 3.56 2.85 2.37 2.03d [Å]
BKS Fluc. Charge Fluc. Dipole
Figure 3.7.: Comparison of X-Ray spectra at various pressures for the BKS potential (left), the fluc.charge potential (middle), and the fluc. dipole potential (right)
which is predicted by all of the simulations. In total it seems that all the three modelpotentials support the structure seen by Kingma. Still these results are questionable asthe models were parametrized for ambient conditions and are not verified to reproducethe real behaviour under such extreme pressures, but their stunningly similar findingsadds to the credibility of the results.
3.4. Other High-Pressure Phases
Wentzcovitch et al. [105] found a high pressure phase with symmetry P32 in simu-lations at 40 GPa. These simulation were done with an ab-initio MD approach with
54
3.4. Other High-Pressure Phases
10 15 20 25 30p [GPa]
2
2.5
3
3.5
4
d [Å
]
ExperimentBKSfluc. chargefluc. dipole
Figure 3.8.: Interplanar spacing for the compression ofα-quartz in experiment and simulation. Linesrepresent the different transition pressures. Experimental data by Kingma et al. [52].
variable cell shape and a box of 27 particles. This high-pressure phase phase did notemerge in our simulations fromα-quartz, however when using the crystal structurereported by Wentzcovitch as initial configuration, it proved to be stable under highpressures between 30 and 40 GPa with the fluctuating dipole potential and from 40GPa down to 15 GPa with the BKS potential. In the fluctuating charge approach thephase is only stable at around 30 GPa.At lower pressures, and even down to zero pressure, structures are forming in all po-tentials that are not entirely crystalline and not related to any known quartz phases.The density of the crystal at 40 GPa can be calculated from the lattice constants givenin Ref. [105] to be 4.60 g/cm3, while the BKS potenial estimates a density of 4.53g/cm3 and the fluctuating dipole potential finds 4.56 g/cm3. However the polymorphproposed by Wentzcovitch et al. seems to be a valid option for a high-pressure phaseof silica in the BKS and fluctuating dipole potential as well, however it is not nearly asstable as the Quartz II phase in the three potentials under consideration.
55
4. Silica Polymorphs Other Than Quartz
4.1. Cristobalite
Quartz is not the only polymorph that is (meta) stable at ambient conditions. Cristo-balite, a cubic polymorph, and tridymite, which has hexagonal symmetry, are foundto be stable as well during accessible experimental time scales [47, 23]. A modelpotential that is used to mimic the behaviour of silica should be able to reflect theexperimentally observed stabilities. In some cases, the observation of stability in asimulation might be fortuitous as it could be the consequence of periodic boundaryconditions and/or the number of atoms used. For example, the phase into which thesystem would like to convert is not compatible with the number of atoms used in thesimulation or it cannot be accessed without a major reconstruction of the cell shape.This issue will be discussed in more detail in this section with a focus on cristobalitethat shows subtle effects depending on the choice of the periodic boundary conditions.For the simulation of a crystalline system, the crystal structure has to be placed insidethe box in a way that the periodic images fit to each other at the box ends. For theinitial configuration of a simulation the atom positions are chosen to be identical withexperimental crystallographic data such that the atoms were set onto ideal lattice posi-tions and are equilibrated. For many systems and also for the case of cristobalite thereare different ways to arrange such an initial configuration.The most natural configuration is according to the usual description of cristobalite asa diamond structure for the silicon atoms with connecting oxygen atoms between eachneighboring pair of silicon atoms. This would place the [100] crystal direction parallelto the z axis of the simulation box, and the box geometry would be cubic.On the other hand there is a nice ABCABC layering of sheets of hexagonal rings inthe cristobalite structure, which is also a very common representation as it leads totridymite when the layers are stacked in an ABAB order. This layering is seen alongthe [111] direction in the crystal, and accordingly would place this direction parallelto the z axis of the simulation box when the layers are stacked in the xy plane.However both geometries are completed by the periodic boundary conditions to forman infinite cristobalite crystal, and therefore they are equivalent regarding the staticstructure. On the other hand the connectivity of the atoms at the boundary is differentand therefore the two geometries are not equivalent regarding phonons. When a lattice
56
4.2. Tridymite
vibration leaves a periodic image it would reenter the box at a different position forboth setups.This difference becomes obvious in the simulation ofβ-cristobalite. When relaxing
0 1 2 3 4 5t [ps]
40
42
44
46
48
50
VS
iO [Å
3 ]
001001001
0 1 2 3 4 5t [ps]
40
42
44
46
48
50
VS
iO [Å
3 ]
111111111
BKSfluc. chargefluc. dipole
Figure 4.1.: Time evolution per SiO2 unit VSiO2 for the two geometries with three different potentials.
the crystal atT = 1273 K and zero external pressure, where cristobalite is consideredto be thermodynamically stable [39], the volume of the simulation quickly stabilizeson a value close to the experimental value ofVSiO2 = 45.25 A3. In contrast with thesecond configuration, which had the [111] direction parallel to the z axis, the observedvoulme is, if at all, metastable only for a short period of time, before densification ofthe system takes place. After 2 ps the system is stable in a phase which is much denserthan cristobalite. It was tested that this state remains stable for more than a nanosec-ond, which is not shown in the picture.Obviously in contrast to this both the fluctuating charge and the fluctuating dipolepotential do not exhibit such a behaviour, but remain stable in the cristobalite phaseregardless of the initial condition.Apparently the cristobalite phase is not universally stable in the BKS potential, butonly if certain phonons are prohibited by special periodic boundary conditions.
4.2. Tridymite
Another high temperature polymorph of quartz is tridymite, which was accepted to bea stable phase of silica as late as in the 1960’s. There is a broad range of structuralmodifications upon heating, while the structures increase in complexity with decreas-
57
4. Silica Polymorphs Other Than Quartz
ing temperature. The ideal high-temperature tridymite, the HP-tridymite, is stable over650 K. Its structure consists of an AB layering in c direction of the same tetrahedralsheets that also form the cristobalite phase when stacked in a tripled ABC repeat along[111].We found that the HP-tridymite structure is not stable in BKS at 1000 K, which is well
0 5 10 15 20 25t [ps]
40
42
44
46
48
50
VS
iO [Å
3 ]
Exp.BKSfluc. charge
Figure 4.2.: Time evolution per SiO2 unit VSiO2 of tridymite for the three different potentials atT=1000 K.
in the experimental stability range. Surprisingly, also the fluctuating charge potential,in which cristobalite turned out to be stable, suggested in contradiction to experimentthat the HP-tridymite configuration is unstable. Shown in Fig.4.2is the time evolutionof the volume in a simulation run. While the crystal simulated with the BKS poten-tials collapses into a denser phase about as quickly as the cristobalite collapses, with
a) BKS b) Fluc. Charge c) Fluc. DipoleFigure 4.3.: Snapshot of the different phases that emerged after 20 ps at 1000 K. In all cases the initial
structure was HP-tridymite. Only the fluctuating dipole potential remained in the initialphase, which is stable experimentally.
58
4.3. Stishovite
the fluctuating charge potential the HP-tridymite is metastable for about 10 ps in thesimulation, only then it collapses slowly afterwards. The fluctuating dipole potentialis the only one that predicts that the HP-tridymite phase is stable.In Fig. 4.3 this is shown in terms of the averaged configuration. One can see thatthe collapsed structure of BKS and the fluctuating charge potential looks quite simi-lar. The densification is mainly achieved by a contraction in thea direction (vertical).The framework collapse induces distortions of hexagonal rings to oval configurations.Additionally the tetrahedrons are tilted relative to the stacking directionc and thus ad-jacent sheets are displaced alongb. While the later is known to occur in the tridymitephases at intermediate temperatures, these phases all have a superstructure of charac-teristically alternating oval and ditrigonal configurations. The occurence of only ovalrings in the present simulations may be caused by the finite box size, which does notallow the superstructure to emerge.
4.3. Stishovite
The quartz, cristobalite and tridymite phases studied in this work were composed outof corner-sharing SiO4 tetrahedra, which is the usual configuration in the low pres-sure phases. Stishovite in contrast is a polymorph that often serves as a prototypephase having octahedrally coordinated silicon. It is often assumed [20, 90] that withthe fluctuating charge approach the ability of the charges to adapt to the configurationis especially helpful for the transferability between differently coordinated structures.
0 10 20 30 40 50 60 70 80p [GPa]
40
42
44
46
48
V [Å
3 ]
BKSfluc. chargefluc. dipole Exp. (Ross, Hemley, Andrault)Exp. (Mao)
Figure 4.4.: Stishovite Equation of State. Solid circles are the data of Ross et al. [80], Hemleyet al. [43], and Andrault et al. [2]; open squares are the data of Mao et al. [62]
59
4. Silica Polymorphs Other Than Quartz
Also it is very likely that the degree of ionicity changes with pressure. Therefore, onemight expect that the fluctuating charge potential comes closest to the available exper-imental data out of the three models.Stishovite is usually stable at high pressures, above 8 GPa at room temperature, but itwas also discovered to be metastable at ambient pressures. It was first synthesized inthe laboratory [89] and later was discovered in association with coesite [14]. Stishovitehas the rutile structure, which consists of infinite chains of edge-shared SiO6 octahedraparallel to thec-axis. Each oxygen atom is coordinated by three silicon atoms [43].The equation of state for stishovite under pressure is shown in Fig.4.4. The agreementin the low pressure range is relatively good for the BKS potential, while the fluctuatingdipole and the fluctuating charge potential both do not see a stable stishovite phase atzero pressure. When increasing the pressure, these two potentials constantly underes-timate the density of stishovite, while the volume of the BKS simulation deviates morefor higher pressures.One feature of stishovite under pressure is a different compressibility in thea andcdirection, which is shown in Fig.4.5. This plot shows again a very good agreement of
0 20 40 60 80p [GPa]
0.61
0.62
0.63
0.64
0.65
c/a
fluc. chargeBKSfluc. dipoleExp. (Ross, Hemley, Andrault)Exp. (Mao)
Figure 4.5.: c/a ratio in stishovite against pressure. Experimental data as in Fig.4.4. Please note thatthe phase transition discussed in the next section does not have much influence on thec/a
ratio and the volume.
the BKS data with the experimental results. The effect of the different compressibilityin the fluc. charge and fluc. dipole potential is rather overestimated, while the fluctuat-ing dipole potential again improves in the quantitative prediction for higher pressures.The result of the fluctuating charge potential shows no improvement over neither ofthe two other potentials.
60
4.3. Stishovite
4.3.1. High-Pressure Behaviour
Shortly after the discovery of stishovite, a major question has evolved around possibletransformations to a denser structure at high pressures. By crystal chemical argu-ments [67], first-principle calculations [42, 15], and experimentally [41, 98, 51, 12] apressure-induced phase transition at 50 GPa was confirmed. At the transition the SiO6
octahedra are only slightly tilted, whith the result that the lattice constantsa andb,which are identical in the low pressure rutile-type, tetragonal phase, are of differentsize in the CaCl2-type orthorombic stishovite phase. This tilting has the same symme-try as the stishovite B1g vibrational mode, which was identified as the pressure-inducedsoft mode that drives the transition [67]. By means of a Landau expansion Carpenter etal. [12] found a classical second-order character. The transition has almost no impacton the volume or thec/a ratio, which is shown in the paper by Carpenter.However molecular dynamics models were not able to reproduce the tranistion pres-sure but only found the transition at pressures in the megabar region [42, 97, 56].As a comparison between molecular dynamics and experiment the elastic constantscan be analysed. Carpenter et al. [12] used a Landau expansion to generate expres-sions for the elastic constants of stishovite with pressure. Fig.4.6 shows the relevant
0 20 40 60 80 100 120 140p [GPa]
0
100
200
300
400
B11
-B12
[GPa
]
ExperimentBKSfluc. chargefluc. dipole
Figure 4.6.: Birch coefficients B11-B12 as a function of pressure. Simulation data is compared to theresult of a Landau expansion by Carpenter et al. [12]
shear modulus B11-B12, which softens on approach of the transition, as the B1g modedirectly contributes to it. The Birch coefficents Bij have to be considered for a stabilityanalysis rather than the elastic constants Cij, when the system is observed under ex-ternal pressure. In the case of the two coefficents needed here, they are related to eachother asB11 = C11 − p andB12 = C12 + p.
61
4. Silica Polymorphs Other Than Quartz
One can see that the BKS potential and the fluctuating dipole potential show a soften-ing towards pressures of over 100 GPa, which is in agreement to the molecular dynam-ics simulations cited above, and far away of the 50 GPa measured experimentally. Incontrast the fluctuating dipole potential predicts the transition in almost perfect agree-ment with the analysis by Carpenter at 50 GPa.This prediction can be verified by a plot of the lattice constantsa andb, which coincidein a tetragonal lattice and differ in an orthorombic lattice. In Fig.4.7 the course of
0 20 40 60 80 100 120p [GPa]
3.7
3.8
3.9
4
4.1
4.2
4.3
a, b
[Å]
fluc-dipoleExp. (Ross, Hemley, Andrault)Exp. (Mao)
tetragonal orthorombic
Figure 4.7.: Lattice constantsa andb against pressure. Experimental data as in Fig.4.4.
the lattice constants with pressure is compared to experimental data. The transition isclearly visible at a pressure of around 50 GPa in both the fluctuating-dipole simulationand experiment. The length of the lattice constant is overestimated constantly in thesimulation, which was already obvious in the volume plotted in Fig.4.4.However the agreement with experiment in this phase transition is far better than inthe other model potentials. This is rather surprising, as it was parametrized for tetra-hedrally coordinated silicon only.
62
5. Electromechanical and DielectricProperties
Dielectric and electromechanical properties of materials play an important role inmany technological applications, as for instance piezoelectric resonators which areused as frequency generators in computers. Furthermore it is interesting to check howthe results of the fluctuating charge and dipole potential compare to the standard two-body force field, as these new approaches claim to account for electronic propertiesand therefore should offer a better basis for the investigation of dielectric properties.Due to these reasons it is desirable to have methods at hand that allow one to computedielectric, piezoelectric and related tensors in atomistic simulations. Dielectric proper-ties are more challenging to calculate than thermal and mechanical properties, becausethe definition of polarization in periodically repeated cells is less obvious than the for-mulation of thermo-mechanical variables. The reason is that an electrical dipole, andhence the polarization, lives on the surface of a sample. One of the consequences forcomputer simulations is that the value of the dipole depends upon where we chose the’central image’ of the periodically repeated cell to be. Conversely, internal energy,lattice parameters, strain, etc. are independent of the central image’s position. As out-lined further below, the ambiguity in defining the polarization becomes particularlydelicate even in classical molecular dynamics simulations when one treats a systemcontaining free charges at finite temperatures and constant stress, which implies fluc-tuating box shapes.Despite the mentioned ambiguity in the definition of polarization in periodic cells, ithas been shown that there is a bulk polarization that is intrinsic to the crystal and onlydepends on variations in charge density induced by atomic displacements. It is there-fore independent of the surfaces and thus of the choice of the central image [63].In the following chapter different methods are established for the calculation of dielec-tric and piezoelectric properties. These are in particular the dielectric tensor, definedas
εαβ =1
ε0
∂Pα
∂Eβ
, (5.1)
and the piezoelectric coefficients. The latter represent the mechanical reaction of thesystem to an applied field, and can therefore be defined either in terms of the strain or
63
5. Electromechanical and Dielectric Properties
the stress. In the following the focus will be on the piezoelectric strain coefficients:
dαβ,γ =∂uαβ
∂Eγ
. (5.2)
Another quantity that will be used in the following derivation is the piezoelectric stresscoefficients at constant strain:
γαβ,γ =∂σαβ
∂Dγ
. (5.3)
Two different approaches for the calculation of these quantities will be employed. Thefirst is the direct calculation of the slope of the polarization and the strain respectivelyagainst an electric field applied on the simulation box in different spatial directions.The second method is an evaluation of fluctuation relations within a usual simulationrun in zero external field.
5.1. Theory and Methods
In order to develop the fluctuation relations, we will introduce different generalizedvectors and matrices. In the following, a vectorv denotes a column of numbers, whilea transposed vectorvT represents a row of numbers. This means that the scalar productof two vectorsu andv will be written asuT v anduvT is a matrix of rank two. WithinVoigt notation, all matrices except for the piezoelectric tensors are square matrices.The piecoelectric coefficients are represented by a6 × 3 matrix in Voigt notation. Asbefore, spatial coordinates are written in capital letters to denote real space, whilelowercase letters represent reduced space:
Ri = h ri.
Additionally a vectorsi is introduced, which represents the reduced coordinates ofthe central periodic image of the particlei. When the particle moves over the imageboundaries, the coordinate vectorri behaves smoothly while we have to add or subtractunity to si. This means that the components ofsi always lie within0 and1, whereasri can exceed these boundaries. This will prove to be a relevant property as the polar-ization must not depend on the boundary conditions.
5.1.1. Linear Response
Starting point is the isothermal partition functionZh,D(N, β) at fixed dielectric dis-placementD and constant box geometry as defined by a symmetric matrixh. Accord-
64
5.1. Theory and Methods
ing to the regular rules of statistical mechanics,Zh,D(N, β) reads
Zh,D(N, β) =
∫dΓδ(h(Γ)− h)δ(D(Γ)−D) exp (−βΦ(Γ)) . (5.4)
Here∫
dΓ is an integral over phase space, theδ(·)’s are the delta functions singlingout proper geometry and dieelectric displacement, andΦ(Γ) is the potential energy ofthe system as a function of phase space, this means as a function ofh and{s}. Fromthe partition function, the free energyF is defined via the equation
Fh,D(N, β) = −kBT ln Zh,D(N, β). (5.5)
As outlined in more detail below, these equations allow one to connect phenomenogi-cal materials parameters with ensemble averages over phase space. With the assump-tion of ergodicity the integration over phase space is carried out by averaging alongthe trajectory of the molecular dynamics simulation.In the theory of elasticity it is helpful to express the partition function and free en-ergy as a function of strain rather thanh. Unlike the box geometry, the definitionof the strain does not need the reference geometryh
0of the system, which is typi-
cally chosen to reflect the expectation value ofh at given temperature and stress, asan additional information. As used before in the calculation of elastic constants, theLagrangian strain with respect toh
0can be written as
uαβ =1
2
{(h−1
0
)αγ
hγδ hδε
(h−1
0
)εβ− δαβ
}, (5.6)
where tensor notation was used instead of Voigt notation. In Eq. (5.6), δαβ denotesthe Kronecker symbol. Since the relation betweenh andu is well defined for a givenreferenceh
0, it is possible to calculate the free energy as a function ofu in terms of a
Taylor series expansion inu away from a phase transition point, i.e.,
Fu,D = Fh0,D +∂Fh,D
∂h
∂h
∂uu + ... (5.7)
The new free energy depends on both, strainsu and displacementD. In the following,for convenience of calculations these variables will be grouped together into a gener-alized strainu = (u1, · · · , u6, D1, · · · , D3)
t, with (u1, · · · , u6) being the strain tensorin Voigt notation. The generalized stressesσ that are the conjugate thermodynamicvariables tou can be calculated asσ = (1/V ) ∂F(N, β)/∂u. Away from a phasetransition, it is possible to expandFu into a power series around a reference strainu0
(which one can usually set to zero ifu0 at the reference geometry), thus
V0σ =∂Fh0,D(N, β)
∂u+
∂2Fh,D(N, β)
∂ut ∂uδu + ... , (5.8)
65
5. Electromechanical and Dielectric Properties
where the derivatives are evaluated atu0, the relative generalized strain isδu = u− u0,andV0 denotes the volume of the system at the reference geometry. The (expectationvalue of the) generalized stress atδu = 0 will be calledσ0 andδσ = σ − σ0 denotesan (average) stress variation. One can then interpret the second-order derivative ofFu with respect tou as generalized elastic constantsC, that connectδu andδσ via
δσ = C δu, or if we representu andσ explicitly
(δσ
δE
)=
CD
γt
γ(ε0 ε
r,u
)−1
( δu
δD
). (5.9)
Here,CD
denotes ‘real’ elastic constants at constant dielectric displacement,γu
are
the piezoelectrical stress coefficients at constant strain, andεr,u
is the (isothermal)dielectric tensor at constant strain. Eq. (5.9) is a linear equation that connectsδu withδσ. It is therefore possible to chose up to nine linearly independent thermodynamicvariables, i.e., we can ‘fix’ theδσ and ‘measure’ the responseδu. This can be done bymultiplying both sides of Eq. (5.9) with the inverse ofC, which can be written as:(
δu
δD
)=
[C−1
Edt
d ε0 εr,σ
](δσ
δE
). (5.10)
HereCE
have to be interpreted as elastic constants at constant (external) electric fieldandd are the piezoelectrical strain coefficients. Eq. (5.9) uses the more natural rep-resentation of the linear-response coefficients than Eq. (5.10), as stress and (external)electrical field are typically the experimentally controlled parameters, while strain andpolarization and thus dielectric displacement are the measured responses.
Within linear-response theory,δu andδσ are conjugate to each other. In the constant-uensemble, we can therefore attribute an excess free energy∆F due to the fluctuationsin u, which is given by
∆F =V0
2utC u. (5.11)
Thermal fluctuations ofu at fixed σ will thus be related toC, which for harmonicapproximations, results in⟨[
δuδut δuδDt
δDδut δDδDt
]⟩=
kBT
V0
[C−1
Edt
d ε0 εr,σ
]. (5.12)
In this section, we have measured the free energy density by dividing the actual valueof F by the volumeV0 of the reference strain. This convention, which is typically used
66
5.1. Theory and Methods
in the theory of elasticity. is also beneficial when evaluating Eq. (5.12): The fluctua-tion of the electric displacement can be rewritten as fluctuation of the polarizationP .Introducing the dielectric susceptibility,χ = ε
r− 1, we can rewrite Eq. (5.10) as:(
δu
δP
)=
[C−1
Edt
d ε0 χσ
](δσ
δE
). (5.13)
and conclude with the same procedure the flucuation relation⟨[δuδut δuδP t
δPδut δPδP t
]⟩=
kBT
V0
[C−1
Edt
d ε0 χσ
]. (5.14)
Relations such as Eqs. (5.8) and (5.14) can be exploited in atomistic calculations todetermine the susceptibilities of interest. However, it will first be necessary to state theproper estimators for the polarization fluctuation.
5.1.2. Ambiguity of the dipole and its fluctuation
To understand the difficulties connected with the definition of bulk polarization and itsfluctuations in an infinitely replicated system it is helpful to consider Fig.5.1. Part (a)of Fig. 5.1 shows that the definition of the dipole momentµ in the cell (which leadsto the polarizationP through division by the volume of the simulation box), dependsupon the choice of the boundary of the central cell. By displacing the boundary, noneof the interatomic distances is altered, yet the dipole changes its value. As long asthe shape (here simply the length) of the cell is maintained, this ambiguity causesno complications for the response functions, because the only relevant quantity is thedifference between polarizations. A polarization change is independent of the choicefor the boundary - provided the ‘true’ trajectory of the atoms is measured, i.e., when acharged particle moves across a boundary the scaled coordinate for the calculation ofthe dipole is not increased or decreased by unity. Thus evaluating fluctuations relatedto dipoles (from which the constant-strain dielectric and piezoelectric constants couldbe calculated), do not depend on the choice for the position of the central image.When the cell fluctuates, even a polarization difference will depend upon where wechose the central image to be. This is illustrated in part (b) of Fig.5.1, where in onecase, the reduced coordinates of a charged particle is constrained to zero (bottom) andin the other case it is set constant to one half (top). Both times, we assume the presenceof an opposite background charge of constant density ensuring charge neutrality. Inthe upper part of Fig.5.1 (b), the fluctuation of the dipole vanishes exactly if we keepthe reduced positions of the chargeQ fixed in the center of mass. Therefore, thefluctuation of the dipole will be zero in the upper half. In the bottom part, we would
67
5. Electromechanical and Dielectric Properties
−
−
−
− −
−
−
−Q
Q
−Q
−Q(a)
(b)µµ
Figure 5.1.: Illustration of the ambiguity for (a) the definition of a dipoleµ and for (b) the fluctuationof the dipole. The boxes framed by a solid line present the position of the central image,while boxes framed with a broken line are periodic images. The lower left corner of thecentral image is defined to the origin of the coordinate system. In part (b), a positive back-ground neutralizes the point chargeQ and the arrows with the two arrow heads representfluctuation of the box geometry.
attribute a dipole to the cell, which would fluctuate with changing box size. Thus thedipole fluctuations are affected by the choice of the location for the central image. Theabove mentioned difficulties do not arise if one deals with neutral molecules whoseconstituents have charges that add up to zero. In that case it is easy to remove theambiguity due to surface effects or periodic-boundary conditions. One would onlyhave to suppress any minimum image convention within the molecules, i.e., for thecalculation of the dipole, theri have been to be defined such that two covalently bondedatoms are separated by the proper distance. In principle, it would be possible to definesimilar molecules in an ideal crystalline network such as quartz, i.e., by evaluating thedipole over entities that consist of a central silicon atom and its four oxygen neighbors,where the charges of the O atoms would only count half, in order to avoid doublecounting. However, such ‘tricks’ cannot be generally applied, for instance, if any typeof disorder or even impurities are present in the system, or if a non-rigid charge modelis employed.
5.1.3. Fluctuation estimators for dipoles
The problem of defining bulk dipoles can be overcome by considering the small wavelength limit of the dipole’s spatial Fourier transformµ. If the box cell is fluctuating, it isappropriate to work with scaled reciprocal vectorsk = 2π(mx, my, mz) where themα
are integer numbers that are related to the true reciprocal vectors throughK = k h−1.Since the box is fluctuating, it is more meaningful to work with reduced coordinates in
68
5.1. Theory and Methods
both real and reciprocal space. Let us first consider the Fourier transform of the chargedistribution ˜ρ(k)
ρ(k) =∑
i
Qieik si . (5.15)
It remains unchanged if we add or subtract unity from a particularsi or if the boxgeometry is rescaled. Yet, the formal derivativeρ(k) with respect tok (which onecannot do in practice as thekα’s are discrete) does not show the same invariance. Thederivative ofρ(k) evaluated atk = 0 corresponds to the contribution of the reduceddipole due to the point charges, which is defined as
µred
=∑
i
Qiri + h−1µi, (5.16)
If, however, one defines a reference configuration, which can be an initial configura-tion at timet = 0 that does not have to be equilibrated, then thedifferencebetween areduced dipoleµred(t) evaluated at timet and the reference dipoleµred(0) is invariantagainst the transformations discussed in Fig.5.1, as long as the transformation is per-formed on the configuration of interest and the reference configuration. For the finalevaluation of the dipole, the valueµred(0) has to be multiplied with the expectationvalue of the box shape. Thus our estimator becomes
µestimator = 〈h〉 µred (5.17)
and consequently that for the polarizationP estimator = µestimator/〈V 〉. These estima-tors do not enable one to calculate absolute dipoles or polarizations but only relativequantities, i.e., those to be used in Eq. (5.14) for the calculation of fluctuation relations.If absolute values for the polarization were needed, the dipole moment of the initialconfiguration should vanish. This could be accomplished by chosing a configurationwith vanishing dipole moment due to an underlying symmetry.
5.1.4. Direct estimators with noise reduction
An alternative method to evaluate piezoelectric coefficients is to apply an external elec-tric field E to the system. The appropriate force that acts on the reduced coordinatesrelated to a point chargeQi would readh−1EQi. It is yet not meaningful to simplyadd a term−
∑i QiE
tRi to the Hamiltonian. Such a perturbation would require tohave a force act onto the shape of the simulation cell and this force would depend onwhether a particle is counted within the central image or within a periodic image. Wethus suppress the force from the external field onto theh matrix, also because it wouldbe absent in a system without charges and dipoles.
69
5. Electromechanical and Dielectric Properties
If the shape of the system is known forE = 0 and the initial configuration is equi-librated, then one may switch on the field adiabatically and monitor the box shapevariation from which the strain can be calculated. This procedure will give correctresults, in particular if one averages over an appropriate number of independent, ini-tial configurations. However, this algorithm may produce large stochastic scatter inparticular at elevated temperatures.
The noise can be reduced and the necessity of having to know the average structure canbe omitted if one performs a reference simulation in which the electric field remainsswitched off. The reference simulation should be based on the same initial conditionand an identical initialization of the thermostat. Any instantaneous configuration atfinite field can be compared directly to the instantaneous configuration at zero field.Within a few molecular dynamics steps, it is then possible to obtain quite reasonableestimates for the piezoelectrical and other dielectric coefficients, even if the systemis rather anharmonic and contains slow modes, as is the case in quartz close to theα − β transition. Fig.5.2 confirms this expectation. In Fig.5.2, we increased the
0 2 4 6 8 10E [10-16 V/m]
-2
0
2
4
6 uE11(t)
uE11(t)-u
011(t)
1.826 m/V · E
0 2 4 6 8t [ps]
-2
0
2
4
6
u 11 [1
0-3]
Figure 5.2.: Response of the strainu11 as a function of time (below) or electrical field (above) for anN = 1080 particle system (α-quartz) at temperatureT = 300 K. The long dashed line isthe result for the piezo-electrical coefficient based on evaluating the fluctuation relationin Eq. (5.14).
external field slowly with time and also chose box inertia sufficiently small to have thecell shape adapt quickly to the new field. The box geometry was thermostatted with aLangevin thermostat to decrease the (stochastic) correlation time. Excellent estimatesfor the piezoelectrical coefficients can be obtained already after one hundred MD stepsby evaluating the slope∂u11/∂Ex. In this way, four simulations have to be run to
70
5.2. Temperature Dependence of d11 in Quartz
determine all generalized elastic constants; three in which the electric field is parallelto one of the three coordinate axis and one in which the electric field remains zero.As said above it is necessary that in all four runs the same initial conditions (one largesample in thermal equilibrium or an average over some small equilibrated samples)must be used as an input into the simulation and that all runs require the same randomnumber sequence.For the various silica polymorphs investigated here, we obtain a statistical accuracy ofbetter than 5% forγ if we first equilibrate the material for about 10,000 MD steps toproduce an equilibrated start configuration. Note that even though quartz is crystalline,it does takes relatively long to equilibrate, because it has an unusually large phonondensity of states at small frequencies. The start configuration is then used for fourindependent runs, namely one without electric field plus three runs with electric fieldin one of the three spatial dimensions. Each of these runs is about 2,500 MD steps longand produces a graph similar to that shown in Fig.5.2. This length of the simulationrun is by far long enough to obtain a small error in the linear regression, while in alonger run the abberations in the four trajectories get too large. Also non linear effectswould begin to dominate, at least for the set up and the slope of electric field againsttime used above. Thus, the required numerical effort to obtain the data is relativelysmall.
Using Nose Hoover thermostats or related (less sophisticated) rescaling methods doprobably not lead to similarly reliable results. In particular for large systems and/orsmall temperatures, the motion of the simulation cell will be quite harmonic and thusthe crucial exchange of (kinetic) energy between the simulation cell and the internaldegrees of freedom will be inefficient. This inefficiency will prevent the cell fromquickly finding its new preferred shape or from fluctuating around it.
5.2. Temperature Dependence of d 11 in Quartz
The temperature dependence of piezoelectrical constants is of technological relevancebecause one is often interested in having pressure sensors and pressure transducers atvarying temperatures. One of the few disadvantages ofα-quartz is the relatively lowtransition temperature toβ-quartz. Due to the increase in symmetry from the trig-onal holoaxialα-quartz structure to the tetragonal holoaxialβ-quartz structure, thepiezoelectricity decreases such that thed11 component becomes symmetry-forbidden.This means that quartz cannot be used as an effective piezoelectrical material at hightemperature. Fig.5.3 shows the temperature dependence of the piezoelectrical straincoefficientd11. One can see that both potentials underestimate the value ofd11, thefluctuating dipole potential underestimates its value in the low-temperature phase by
71
5. Electromechanical and Dielectric Properties
more than 50%. The discrepancy between experiment and the fluctuating dipole
400 600 800 1000 1200T [K]
0
0.5
1
1.5
2
2.5
3
d 11 [1
0-12 m
/V]
ExperimentBKSfluc. dipolefluc. dipole without dipoles
Figure 5.3.: Comparison of the temperature dependence of the piezoelectrical strain coefficientd11
between experiment and simulation. Different potentials were used, the BKS and thefluctuating dipole potential. In the fluc. potential, two set of runs were performed, one inwhich the electric field was coupled to the dipoles, and one in which this coupling wassuppressed for the reasons outlined in the text. Experimental data was taken from Cookand Weissler [17]
potential is suprising having in mind the otherwise good performance of this poten-tial. As already mentioned in chapter2.4.1, it is possible that Tangney and Scan-dolo parametrized quantum-chemical effects into the dipoles, so that their dielectricproperties should possibly not be treated as such. Re-running the simulations withoutcoupling the dipoles to the electric field, so that only the bare charges coupled toE,showed that the discrepancy between the fluctuating dipole potential and the experi-ment is significantly reduced and quantitative agreement is almost achieved.Of course in this comparison one has to take into account that the transition tempera-ture is about100 K underestimated by this potential.The high temperature behaviour of quartz was recently studied by Haines et al. [37],who observed a loss of piezoelectric properties inα-quartz still below the transitiontemperature. It had been known for many decades that the piezoelectric coefficientd11 of quartz decreases gradually above room temperature [10, 17, 6] as shown inFig. 5.3. Haines et al. measured the quality factor of piezoelectric resonators andfound that it decreases significantly already at550 K and reaches values characteristicof a poor resonator above750 K, which is well below the transition temperature. Thetime-averaged structure ofα quartz does not provide an explanation for this behaviour,as the order parameter decreases only gradually in this temperature range. Therefore
72
5.2. Temperature Dependence of d11 in Quartz
Haines et al. suspected that this deterioration of the piezoelectric response arises fromlocal instantaneous disorder. This can be characterized by the tilt angleΦ. In Fig. 5.4,the distribution of the tilt angles in the crystal is shown for different temperatures.
-40 -30 -20 -10 0 10 20 30 40Tilt angle Φ [º]
Rel
ativ
e pr
obab
ility
Experimentfluc. dipoleBKS
T=293 K
T=473 K
T=673 K
T=863 K
T=973 K
Figure 5.4.: Distribution functions of the tilt angleΦ in quartz as a function of temperature. Note thatat temperatures of863 K and973 K, the crystal is in theβ-quartz form. Experimental datataken from Haines et al. [37].
The comparison of the simulation data with experiment shows that this explanationalso holds in computer simulations. While the average tilt angle hardly changes forthe three temperatures in theα-quartz stability range, the distribution of tilt anglesis significantly broadened. The shift towards smaller tilt angles in the simulation ascompared to experiment atT = 673 K arises from the lower transition temperature inboth potentials. This increasing disorder leads to the early decline of the quality factor,while quantities that can be correlated to the static average value, like the piezoelectriccoupling constant, remain constant towards higher temperatures.In the α-quartz phase, where this phenomenon occurs, both potentials are in goodagreement with experiment, which is reflected in Fig.5.3 in the quite similar decreaseof d11 with temperature. However it is interesting to note that the tilt angle distribu-tion in β-quartz is obviously more accurate with the fluctuating dipole potential, whichmeans that the disorder in theβ-quartz phase is modelled closer to reality.
73
5. Electromechanical and Dielectric Properties
5.3. Pressure Dependence of d 11 in α-Quartz
In Fig. 5.5, we show the pressure dependence of quartz with the same approaches as inFig. 5.3. While probably the most accurate data is obtained with the fluctuating dipoleapproach by suppressing the coupling betweenµ andE, the “full” fluc.-dipole poten-tial and the BKS potential are included for comparison. The fluc.-dipole potential with
0 5 10 15 20 25p [GPa]
0
5
10
15
20
d 11 [1
0-12 m
/V]
BKSfluc. dipole without dipolesfluc. dipole
Figure 5.5.: Comparison of the pressure dependence of the piezoelectrical strain coefficientd11 be-tween experiment and simulation. Different potentials were used, the BKS and the fluctu-ating dipole potential. In the fluc. potential, two set of runs were performed, one in whichthe electric field was coupled to the dipoles, and one in which this couplig was suppressedfor the reasons outlined in the text.
suppressedµ-E coupling shows a surprisingly strong similarity to the BKS potentialup to 12 GPa. Above this pressure, the results for the piezoelectrical coefficients arestarting to differ. Keeping in mind that the transition pressure for theα → II transi-tion is 21 GPa in BKS compared to 28 GPa in TS, it is obvious that the results start todiffer on approach to the transition pressure. However the absolute values comparedat the respective transition temperature are again rather comparable. The increase inthe piezoelectrical activity originates in the softening of internal modes inα-quartz, inwhich the oxygen atoms are displaced with respect to the oppositely charged siliconatoms.
74
5.4. Bond-Angle Dependence of the Dipole Moment
5.4. Bond-Angle Dependence of the DipoleMoment
In chapter5.2 above the observation was made, that the predictions of piezoelectricproperties approve, when the dipoles are not fully treated as dipoles in the calculation,but when the dipoles do not couple to the electric field and do not contribute to thepolarization of the material. It was already suspected before in the discussion of thetetraeder distortion in chapter2.4.1that the value of the dipole moments calculated inthe potential by Tangney and Scandolo modelled effects caused by the quantum chemi-cal bonds. It was shown that the distortion of the SiO4 tetraehedron, which is modelledextremely accurately by this potential, was related by Grimm and Dorner [35] to theπ-bonds between Si and O atoms. Additionally the symmetry of theπ orbitals resem-bles closely to the symmetry of the dipoles.We want to investigate this possibility by having a closer look on the relation betweenthe dipole moment and its nearest surrounding. In Fig.5.6the distribution of the dipolemoments with respect to the Si-O-Si bond angle around the respective oxygen atom is
ϑ[◦] ϑ[◦]a) α-quartz b) β-quartz
µ[eA]
120 130 140 150 160 170 180
h
1.91.71.51.31.10.90.70.50.30.1
120 130 140 150 160 170 1800
0.2
0.4
Figure 5.6.: Distribution of the absolute value of the dipole momentµ against the Si-O-Si bond angleϑ on the adjacent oxygen atom. The probability density h is plotted in units of probabilityper degree andeA.
shown. One can see that the dipoles depend almost linearly of the oxygen bond an-gle ϑ. There is some statistical spread, which increases with higher temperature. Butapparently the absolute value of the dipoles depends mainly on the bond angle. Thismeans that they depend largely on local effects of the bonding to the closest neighbors.To measure the orientation of the dipole moments, we use the labels introduced inFig. 5.7. The orientation angleϕ is the angle between the direction of the dipole mo-ment and the direction given by the bisecting line of the Si-O-Si angleϑ.
75
5. Electromechanical and Dielectric Properties
Figure 5.7.: Sketch of bond angleϑ, dipole orientation angleϕ and absolute value of dipoleµ, as usedin Fig. 5.6and5.6.
One can see in the distribution of the orientation angle in Fig.5.8 that the dipole mo-ment points most probable in the direction of the bisecting line, which is within thelayer defined by the oxygen and the two neighboring silicon atoms and represents themost symmetric orientation at this point. In theβ-quartz phase the orientation mightdeviate more than 10◦ with a certain probability. But in these cases the dipoles have asmall absolute value, as shown in Fig.5.8, and therefore they have only little influenceon the forces.
ϕ[◦] ϕ[◦]a) α-quartz b) β-quartz
µ[eA]
0 10 20 30 40
h0.7
0.6
0.5
0.4
0.3
0.2
0.1
00 10 20 30 40
0
0.2
0.4
Figure 5.8.: Distribution of the absolute value of the dipole momentµ against the deviation angleϕ. The deviation angle is measured as explained in the text and shown in Fig.5.7. Theprobability density h is plotted in units of probability per degree andeA.
As the orientation of the four dipoles sitting on the oxygen atoms around one siliconatom are pairwise opposed (see Fig.2.20), one can conclude that the contribution ofdistant dipoles on the force acting on an atom dissappear faster than the usual charge-dipole interaction.Summing up these observations it is likely that there was some contribution of thequantum chemistry to the forces, stresses and energy parametrized into the dipoles.
76
6. Conclusion and Outlook
In the present work, different model potentials were used for the simulation of silicapolymorphs, in order to study the influence of different enhancements of the standardtwo-body potential. The potentials used for comparison were the frequently used BKStwo body pair potential [101], a model that had the atomic charges dynamically cal-culated from the spatial configuration [20] and a third that employs fixed charges butallows for inducible dipole moments on the oxygen atoms [90]. In the case of thefluctuating charge potential some modifications had to be implemented as the originalparametrization was flawed.
For the testing of the different potentials we concentrated on crystalline phases, as indisordered structures effects are more likely to average out and therefore in crystalsmore independent susceptibilities can be observed. An example are the piezoelectricconstants or the elastic constantC14, which are forbidden for symmetry reasons in theglass phase, but are present in certain crystalline phases. The observables taken intoaccount are predominantly of static nature and sometimes dynamic.
We analysed several cases in which the BKS potential showed quantitatively or quali-tatively incorrect results. So theα-β quartz transition is located at a transition temper-ature that is 100 K smaller than in experiment, and the density of both theα and theβ quartz phase are underestimated by about 4%, but the global picture with respect tothe volume change, the weak first-order nature of the transition and the hysteresis ef-fects is certainly well reproduced. However one important detail, the ratio of the latticeconstantsc anda, shows a qualitative difference to the experimental behaviour at thetransition temperature. This discrepancy turned out to be originated in a distortion ofthe SiO4 tetrahedra that deviates strongly in direction and size from the true distortion.Another problematic quantity is the phonon density of states, which only reproducesbasic aspects of the lattice dynamics, namely the intra-tedrahedral modes, but even inthese modes the frequency differs from ab-initio data. The low frequency range cannotbe brought into agreement with ab-initio data at all.In all of these difficulties, the allowance for fluctuating charges could not be of signif-icant help. While the aberration in the transition temperature and the density was evenstronger in the same direction, the predictions for thec/a ratio and the phonon densityof states basically shows the same shortcomings as seen in the BKS potential.
77
6. Conclusion and Outlook
The introduction of additional inducible dipole moments on the oxygen atoms was afar more successful supplement to the two-body forces. Even though the transitiontemperature deviates slightly more from experiment than in the BKS potential, thisremained the only drawback in the results of the fluctuating dipole potential. For theestimation of the density the agreement with experiment is very satisfactory, and mostimportant the qualitative failures of the BKS potentials in the vibrational density ofstates and thec/a ratio do not occur with the fluctuating dipoles. It could be shownthat the distortion of the tetrahedra, which causes the behaviour of thec/a ratio, is inperfect agreement with experiment. The resemblance of the dipole orientation to thesymmetry of theπ-bonds, which were hold responsible for the tetrahedra deformationin a work by Grimm and Dorner [35], gives rise to the suspicion that some of thequantum chemistry in the atomic bonding was incorporated into the dipole interactionduring the parametrization of this potential.The elastic constants were in generally good agreement for the BKS potential, andwere equally good reproduced by the fluctuating dipole potential. Only the fluctuatingcharge potential showed strong deviations. The good results of BKS in this respect arenot surprising given that the BKS parameters were adjusted to the experimental elasticconstants ofα-quartz.
To test the new potentials at extreme conditions, the post-quartz phases under highpressure were studied. Even though there is a rich variety of different high pressurepolymorphs and different suggestions for possible high-pressure transition path waysfrom experiment and theory, it is remarkable that all three potentials showed a tran-sition in a pressure range of 21 to 27 GPa to the same crystalline structure, whichis supposedly the structure of the still unclear quartz II phase. However theδ-quartzphase seen by the BKS potential on decompression to ambient pressures is not repro-duced by any of the two new potentials. Therefore the formation of this phase seemsto be an artifact of the BKS potential. In contrast, the two new potentials do see thequartz II phase revert toα-quartz, while at intermediate pressures a phase emerges thatis very similar to the quartz II phase at higher pressures.
As the new potential approaches incorporate electrostatic properties, namely fluctuat-ing charges and fluctuating dipole moments, the investigation of dielectric properties inchapter5 should highlight the question if these are real electrostatic variables and thusimprove the prediction for the dielectric properties of the system. As there was no ap-propriate method for the calculation of piezoelectric properties available in literature,we developed a method to measure these by fluctuation relations within the simulationrun. In order to achieve this the definition of the polarisation in an infinitely replicatedsystem had to be clarified, as the definition is ambigious due to surface effects and tobox fluctuations, and the fluctuation relation was established by linear response theory.
78
To test this method the direct impact of an external field was measured, where the noisewas reduced by subtracting the observables measured in a zero field run with identicalstart configuration and random number generator.We found that the BKS potential gives a quite reasonable estimate for the piezoelec-tric constants ofα-quartz against temperature. The fluctuating charge potential wasagain slightly more away from experiment than BKS. For the fluctuating dipole po-tential the observation was made that the result depends on the question whether thedipoles are taken seriously, this means if the dipoles are coupled to the electric fieldand contribute to the polarization in the material, or if they are ignored with respectto electrostatic quantities. The results clearly improved in the later case, again givingrise to the suspicion, that the dipoles that are induced on the oxygen atoms are not pureelectric dipole moments. This question was further investigated by an analysis of therelation between the dipole moment and its direct surrounding. It turned out that thestrength of the dipole depends linearly on the adjacent oxygen bond angle and is mostlikely in the direction of the bisecting line of this angle.
Putting these observations together, we can compare the potentials in the followingway:
BKS Fl-Q Fl-µDOS inα-quartz - 0 +Elastic constants inα andβ quartz + 0 +c/a anomaly at theα-β quartz transition - -/0 +Equation of state inα andβ-quarty 0 - +Stability of cristobalite and tridymite - 0 +Piezoelectric coefficients 0 0 (+)Pressure induced transition + + +Stishovite c/a and elasticity 0 - 0
The results shown above make it clear that the fluctuating charge approach is not ofuse for the simulation of silica. Although it is very likely that the effective charges,which represent the degree of ionicity, change with pressure and for different poly-morphs, there is no evidence to suggest that this happens dynamically at a given pres-sure or temperature in the real system. In the simulations it was shown that keepingthe charges fixed on their average values does not influence the results of the simu-lations. The fluctuation in the charges is quite small, and one can even see that theoriginal authors update the charges on a time scale which is far beyond the time scalesof ionic motion. In an equilibrated system the charges can therefore not react on thepresent spatial configuration. The overall conclusion is that the dynamic adaption ofthe charges within an equilibrated system does not influence the ionic motion notably.However this approach could be probably more useful for systems where the ionicity
79
6. Conclusion and Outlook
changes dynamically, as for instance at a surface.
In contrast, the effects contained in the fluctuating dipoles have a significant influ-ence on the system. Their contribution is sufficiently large that theα-β transition issuppressed when the dipoles are constrained to their average values in the respectivephases. In summary, the results achieved with this potential turn out to be in very closeagreement with experiment with the exception of six-coordinated silicon at small pres-sures. It is the only potential that accurately models the tetrahedral distortion and thelattice dynamics in quartz.Possibly the quantum effects that are apparently parametrized in terms of dipoles couldbe expressed in a newly parametrized three body term and thus reduce the computa-tional expense.
All properties of four-coordinated silica could be described very precisely with thefluctuating dipole potential, even though the potential was not explicitly tested nor op-timized for these experimental results, but only parametrized to (microscopic) ab-initiodata. The parametrization was done in the predominantly tetrahedrally coordinated liq-uid phase and therefore slightly biased in favor of a tetrahedral crystal structure, whichexplains the weakness in the six coordinated stishovite phase at low pressure. How-ever it is even more surprising that it is the only model that predicts the experimentallymeasured transition pressure in stishovite. The overall success clearly approves thefunctional form of this model potential as well as the parametrization procedure, andgives rise to the hope that this procedure can find similarily good potentials for othermaterials as well.
80
A. Calculations
A.1. Calculations for Fluc-Q Potential
A.1.1. Direct Solution of Charge Equilibration Equations
Equation (1.24) and its following explanations only take into account a nonperiodicsystem. Regarding a system with periodic boundary conditions, the Coulomb interac-tion has to be calculated by making use of the Ewald summation1.1.5. With summa-tion over all periodic images, eq. (1.23) reads
χi = χ0i + J0
iiQi +∑
j
′JijQj (A.1)
The notation∑
j′ meaning the sum over all periodic pictures andi 6= j in the original
picture can be rewritten as∑j
′JijQj =
∑j
′(
1
Rij
−(
1
Rij
− Jij
))Qj (A.2)
=∑
j
′ 1
Rij
Qj −∑j 6=i
(1
Rij
− Jij
)Qj, (A.3)
becauseJij → 1/Rij for Rij → 0 and therefore the difference is short range. Theremaining pure Coulomb term can be evaluated using standard Ewald summation:∑
j
′ 1
Rij
Qj =∑j 6=i
1
Rij
erfc(√
αRij)Qj −2α√
πQi +
∑j
CijQj (A.4)
with Cij =4π
V
∑k 6=0
exp(− k2
4α)
k2exp(ikRi) exp(−ikRj) (A.5)
Inserted back to eq. (A.1) this gives
χi = χ0i + AijQi +
∑j 6=i
BijQj (A.6)
81
A. Calculations
with Ai = J0ii −
2α√π
+ Cii (A.7)
and Bij =1
Rij
erfc(√
αRij)−(
1
Rij
− Jij
)+ Cij (A.8)
Now the conditionχi = χ1 reads
−A1Q1 + AiQi +∑j 6=i
BijQj −∑j 6=1
B1jQj = −(χ0i − χ0
1) (A.9)
Together with the charge neutrality constraint this leads to the set of equations
C ·Q = −D, (A.10)
whereDi = χ0
i − χ01 (A.11)
and
C =
1 1 1 · · · 1
−A1 + B21 A2 −B12 B23 −B13 · · · B2N −B1N
−A1 + B31 B32 −B12 A3 −B13 · · · B3N −B1N...
......
......
−A1 + BN1 BN2 −B12 BN3 −B13 · · · AN −B1N
(A.12)
with Ai andBij as above.
A.1.2. Two Body Slater Integral
The integration over the overlap of two slater orbitals with two different centers canbe sketched as in FigureA.1. The value of the integral depends on the distancerbetween the centersa andb. The integral to be evaluated (see eq.1.32) looks in thisnomenclature like
J(r) =
∫∫φ2
i (ri1)1
r12
φ2j(rj2)dri1drj2 (A.13)
=
∫φ2
i (ri1)Uj(ri1)dri1 (A.14)
with
Uj(ri1) =
∫1
r12
φ2j(rj2)drj2 (A.15)
= A2j
∫1
r12
r2nj−2j2 e−2ζjrj2drj2 (A.16)
82
A.1. Calculations for Fluc-Q Potential
j i
1
2
ri1 rj2
r
r12
rj1
ri2
Figure A.1.: The i and j points are the centers of the orbitals, theri1 and rj2 are the integrationvariables.
TheAj is the normalization factor to ensure∫
φ2dV = 1 and can be calculated as
A =
√1
4π
(2ζ)2n+1
(2n)!(A.17)
Solving at first theUj(ri1) integral, one has to expand1/r12 in spherical harmonics:
1
r12
=∞∑
λ=0
4π
2λ + 1
r<
rλ> + 1
+λ∑κ=−λ
Y κλ (θ1, ϕ1)
∗ Y κλ (θ2, ϕ2) (A.18)
Herer< is the smaller andr> is the bigger ofrj1 andrj2. In the angular integrationonly λ = 0 delivers a non-vanishing contribution. So the radial integration is left over:
Uj(ri1) = A2j4π
∞∫0
1
r>
r2nj−2j2 e−2ζjrj2drj2 (A.19)
= A2j4π
1
rj1
rj1∫0
r2nj
j2 e−2ζjrj2drj2 +
∞∫rj1
r2nj−1j2 e−2ζjrj2drj2
(A.20)
= A2j4πr
2nj
j1
1∫
0
y2nj e−2xydy +
∞∫1
y2nj−1 e−2xydy
(A.21)
In the last line, the substitutiony = rj2/rj1 andx = rj1/ζj was applied. After evalua-tion of the two integrals, substitution ofAj from eq. (A.17) and further simplification,one obtains
Uj(ri1) =1
rj1
− e−2ζjrj1
2nj∑ν=1
ν(2ζj)2nj−ν
(2nj − ν)!2nj
r2nj−ν−1j1 (A.22)
83
A. Calculations
Substitution back into eq. (A.13) yields
J(r) = A2i
{∫r2n1−2i1
1
rj1
e−2ζ1ri1dri1 (A.23)
−2nj∑ν=1
ν(2ζj)2nj−ν
(2nj − ν)!2nj
∫r2n1−2i1 r
2nj−ν−1j1 e−2ζ1ri1e−2ζjrj1dri1
}.
Due to their symmetry these two integrals can be evaluated best in elliptical coordi-nates(ξ, η, ϕ). The transformation isri1 = (r/2)(ξ + η), rj1 = (r/2)(ξ − η) anddri1 = (r/2)3(ξ2 − η2)dξdηdϕ. After some simplifications, the final result for theoverlap integral now reads
J(r) =(2ζi)
2ni+1
2 (2ni)!
{(r
2
)2ni2ni−1∑ν=0
(2ni − 1
ν
)A2ni−1−ν(ζir)Bν(ζir) (A.24)
−2nj∑ν=1
ν(2ζj)2nj−ν
(2nj − ν)!2nj
(r
2
)2ni+2nj−ν2ni−1∑k=0
2nj−ν∑l=0
(2ni − 1
k
)(2nj − ν
l
)
×(−1)lA2(ni+nj)−k−ν−l−1(r(ζi + ζj))Bk+l(r(ζi − ζj))
}
with Ak(x) =
∞∫1
ξke−xξdξ, and Bk(x) =
+1∫−1
ηke−xηdη (A.25)
The auxiliary integralAk(x) can be evaluated by
Ak(x) = e−x k!
xk+1
k∑ν=0
xν
ν!, (A.26)
whereas a similar representation ofBk(x) turned out to be numerically unstable. There-foreBk(x) is evaluated by the following formula:
Bk(x) =∞∑
ν=0
1− (−1)k+ν+1
ν!(k + ν + 1)(−x)ν (A.27)
84
B. Programs
B.1. Molecular Dynamics Code
This is the main simulation code. Input parameters is handed over in a file calledpimd.inp, the start configuration in a fileconf.sta . If no start configuration ispresent, this file has to exist anyway with only the number 0 as content.The program consists of the filepimd.f , and the filepimd.com.f with declara-tions of common variables. The force routine for the fluctuating dipole potential is notprinted but can be obtained from Paul Tangney. The interface for this routine with theconversion of units is within the subroutine scandolopotential.The following routines from “Numerical Recipes in Fortran” [74] need to be includedin the code: ludcmp, lubksb, erfcc, four1. All variables needed by this force routineare in atomic units.The units used in the main program are as follows:
[l] = 1A [E] = 1kBK [t] = 1~/(kBK)
[m] = 1mp [Q] = 1e [p] = 1kBK/A3
The output files generated have the following content:
fort.60 Different observables with time, see code for columns.fort.61 Order parameter with timepimd.g r Pair correlations functionspimd.bon g(r) for Si-O at nearest neighbor distance, bond angle distributionsfort.62 Average, minimum and maximum charge with timeconf.end End configurationconf.xmo End configuration in xyz formatconfavg.xmo Averaged configuration in xyz formatconf.pol End dipole configurationconfavg.pol Averaged dipole configurationpimd.out Averaged observables and input configuration
85
B. Programspi
md.
fp
rog
ram
pim
dim
plic
itn
one
incl
ud
e"p
imd
.co
m.f"
do
ub
lep
reci
sio
na
vg_
cha
rge
(n_
typ
e),
ma
x_ch
arg
e(n
_ty
pe
),&
min
_ch
arg
e(n
_ty
pe
)in
teg
er
i_te
std
ou
ble
pre
cisi
on
qe
qre
c2(n
_p
art
,n_
pa
rt)
com
mo
n/q
eq
rect
est
/q
eq
rec2
do
ub
lep
reci
sio
np
mix
com
mo
n/p
mis
ch/
pm
ixd
ou
ble
pre
cisi
on
ers
tes_
v,zw
eite
s_v
do
ub
lep
reci
sio
nq
eq
rec2
1(n
_p
art
)
do
ub
lep
reci
sio
nv_
qa
bh
ae
ng
ig_
ete
stco
mm
on
/ext
lag
ete
st/
v_q
ab
ha
en
gig
_e
test
inte
ge
rco
unt,
c1,
c2,
cra
te,
cma
xre
al
pe
rfo
rma
nce
n_
run
=1
do
i_ru
n=
1,
n_
run
write
(*,*
)"i
_ru
n",
i_ru
nca
llp
ara
_in
itif
(i_
run
.eq.1
)ca
llco
nf_
init
call
ob
se_
init
call
che
ck_
skin
if(f
_sk
in.e
q.1
)th
en
call
bin
nin
ge
nd
if
if((
f_ch
arg
ea
dju
st.e
q.3
).o
r.(f
_ch
arg
ea
dju
st.e
q.4
))th
en
call
ma
trix
inve
rsio
ne
nd
if
r_re
al_
avg
=0
.
do
i_tim
e=
1,
n_
rela
x+
n_
ob
ser
r_tim
e=
r_tim
e+
dt
!---
pro
pa
ga
teco
ord
ina
tes
an
dits
de
riva
tive
so
ne
time
unit
call
pre
dic
tif
(f_
cha
rge
adju
st.e
q.3
)ca
lle
xtd
lag
ran
ge
_p
red
icto
r
!---
che
ckw
he
the
rn
eig
hb
or
lists
ne
ed
tob
eu
pd
ate
dif
(f_
po
ten
tial.n
e.1
)th
en
call
che
ck_
skin
if(f
_sk
in.e
q.1
)th
en
call
bin
nin
ge
nd
ife
nd
if
!---
tra
nsf
orm
pre
dic
ted
coo
rdin
ate
sin
tore
al
spa
ceca
lltr
an
s_re
al
!---
en
sure
ha
rmo
nic
bo
un
da
ryco
nd
itio
ns
if(f
_p
ote
ntia
l.ne
.1)
call
pb
_co
nd
it
!---
calc
ula
tein
tera
ctio
nif
(f_
po
ten
tial.e
q.1
)th
en
call
ha
rm_
osc
els
eif
(f_
po
ten
tial.e
q.2
)th
en
call
len
na
rd_
jon
es
els
eif
(f_
po
ten
tial.e
q.3
)th
en
call
bks
_p
ote
ntia
le
lse
if(f
_po
ten
tial.e
q.4
)th
en
call
bks
_p
ote
ntia
le
lse
if(f
_po
ten
tial.e
q.5
)th
en
call
go
dd
ard
_po
ten
tial
els
eif
(f_
po
ten
tial.e
q.6
)th
en
call
go
dd
ard
_po
ten
tial
els
eif
(f_
po
ten
tial.e
q.7
)th
en
call
go
dd
ard
_po
ten
tial
els
eif
(f_
po
ten
tial.e
q.8
)th
en
call
vash
ish
ta_
po
ten
tial
els
eif
(f_
po
ten
tial.e
q.9
)th
en
call
sca
nd
olo
_p
ote
ntia
le
nd
if
if(f
_e
_a
pp
lied
.gt.0
)ca
lla
pp
lied
_fie
ld
!---
calc
ula
ten
ew
cha
rge
sif
(f_
cha
rgea
dju
st.e
q.1
)th
en
!le
ave
cha
rge
su
nch
an
ge
de
lse
if(f
_ch
arg
ea
dju
st.e
q.3
)th
en
!d
on
oth
ing
(in
clu
de
din
go
dda
rd_
po
ten
tial)
els
eif
(f_
cha
rge
ad
just
.eq
.4)
the
nif
(i_
time
.le.n
_re
lax)
the
nif
(mo
d(i_
time
,25
).e
q.0
)ca
llm
atr
ixin
vers
ion
els
e if(m
od
(i_
time
,10
0).
eq
.0)
call
ma
trix
inve
rsio
ne
nd
ife
nd
if
if(i_
time
.gt.n
_re
lax)
the
nca
llo
bse
rva
tion
en
dif
!---
tra
nsf
orm
inte
ract
ion
sin
tore
cip
roca
lsp
ace
call
tra
ns_
reci
pif
(f_
po
ten
tial.n
e.1
)ca
llb
ox_
cha
in
!---
ad
dra
nd
om
forc
es
call
the
rmo
sta
t
!---
corr
ect
tra
ject
orie
sca
llco
rre
ctif
(f_
cha
rgea
dju
st.e
q.3
)ca
lle
xtd
lagra
ng
e_
corr
ect
or
r_re
al_
avg
=r_
rea
l_a
vg+
r_re
al
if(m
od
(i_
time
,n_
safe
).e
q.0
)ca
llco
nf_
save
en
dd
o
call
ob
ser_
ou
t
en
dd
o
en
dp
rog
ram
86
B.1. Molecular Dynamics Code
!!
!!
!!
!!
!!
!
sub
rou
tine
pa
ra_
init
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
inte
ge
rn
_o
rde
r_m
ax
pa
ram
ete
r(n
_o
rde
r_m
ax=
5)
do
ub
lep
reci
sion
pre
d_
coe
f(0
:n_
ord
er_
max-
1,0
:n_
ord
er_
ma
x),
&co
rr_
coe
f(0
:n_
ord
er_
ma
x)d
ou
ble
pre
cisi
on
sla
terc
uto
ff,
sla
terijr
do
ub
lep
reci
sion
sla
terin
t,sl
ate
rin
t_d
inte
ge
rjs
ee
dco
mm
on
/cjs
ee
d/
jse
ed
do
ub
lep
reci
sion
r_1
,r_
2,r
_6
,exp
_p
ot,v_
cou
lom
b,p
ot_
loc
do
ub
lep
reci
sion
d_
du
mm
1,
d_
du
mm
2
inte
ge
rm
sid
um
my1
,m
sid
um
my2
log
ica
le
xist
do
ub
lep
reci
sion
po
tch
eck
(n_
typ
e,n
_ty
pe)
!**
****
****
****
**f_
po
ten
tial
1if
(f_
po
ten
tial.e
q.1
)th
en
if(i_
run
.eq
.1)
the
no
pe
n(1
0,
file
="p
imd
.inp
",st
atu
s="o
ld")
rea
d(1
0,2
10
)i_
du
mm
y,ch
ar_
du
mm
y
if(i_
du
mm
y.e
q.0
)th
en
!---
-ta
kede
fau
ltp
ara
me
ters
n_
rela
x=
50
n_
ob
ser
=5
0n
_sa
fe=
10
0is
ee
d=
47
59
1+
2*i
nt(
n_
pa
rt/2
)+2
*in
t(10
*tk)
+n
_tr
ot
jse
ed
=is
ee
d
dt
=0
.03
5d
0tk
=0
.27
5m
ass
(0,1
)=
1.d
0m
ass
(0,2
)=
ma
ss(0
,1)
if(n
_o
rde
r.eq
.2)
the
n!-
---
che
cke
ne
rgy
con
serv
atio
nfr
ictio
n(1
)=
0.
fric
_b
ox
=0
.d
t=
dt/2
els
efr
ictio
n(1
)=
0.0
1/
dt
fric
_b
ox
=0
.01
/d
te
nd
iffr
ictio
n(2
)=
fric
tion
(1)
!---
de
fine
ine
rtia
for
bo
xd
efo
rma
tion
ma
ss_
bo
x=
(n_
silic
*ma
ss(0
,1)
+n
_o
xy*m
ass
(0,2
))/
12
els
e!
i_du
mm
yif
(i_
du
mm
y.ne
.f_
po
ten
tial)
&st
op
"f_
po
ten
tial
an
dp
imd
.inp
mis
ma
tch
"re
ad
(10
,21
0)
i_d
um
my,
cha
r_d
um
my
if(i_
du
mm
y.ne
.f_
cha
rge
ad
just
)&
sto
p"f
_ch
arg
ea
dju
sta
nd
pim
d.in
pm
ism
atc
h"
rea
d(1
0,2
10
)n
_re
lax
rea
d(1
0,2
10
)n
_o
bse
rre
ad
(10
,21
0)
n_sa
fere
ad
(10
,21
0)
ise
ed
rea
d(1
0,2
00
)ch
ar_
du
mm
yre
ad
(10
,20
1)
dt
rea
d(1
0,2
01
)tk
rea
d(1
0,2
00
)ch
ar_
du
mm
yre
ad
(10
,20
2)
(ma
ss(0
,i_ty
pe
),i_
typ
e=
1,n
_ty
pe
)re
ad
(10
,20
2)
(frict
ion
(i_
typ
e),
i_ty
pe
=1,n
_ty
pe
)re
ad
(10
,20
2)
mass
_b
ox,
fric
_b
ox
en
dif
!i_
du
mm
ycl
ose
(10
)e
lse
!i_
run
tk=
tk-
0.2
5e
nd
if!
i_ru
n
!**
****
****
****
*f_
po
ten
tial
2e
lse
if(f
_po
ten
tial.e
q.2
)th
en
if(i_
run
.eq.1
)th
en
op
en
(10
,fil
e=
"pim
d.in
p",
sta
tus=
"old
")re
ad
(10
,21
0)
i_d
um
my,
cha
r_d
um
my
if(i_
du
mm
y.e
q.0
)th
en
!---
-ta
ked
efa
ult
pa
ram
ete
rsn
_re
lax
=5
0n
_o
bse
r=
50
n_
safe
=1
00
ise
ed
=4
75
91
+2*i
nt(
n_
pa
rt/2
)+2
*in
t(1
0*t
k)+
n_
tro
tjs
ee
d=
ise
ed
for_
sca
_m
fa_
cor
=0
.
!---
-L
en
na
rdJo
ne
sp
ote
ntia
l;L
Ju
nits
!m
ass
(0,1
)=
10
0.d
0!
epsi
l(1
,1)
=1
.d0
!si
gm
a(1
,1)
=1
.d0
!---
-L
Jp
ote
ntia
ls;
my
un
its\h
ba
r=1
,k_
b=
1,A
=1
,e=
1!-
---
Arg
on
ma
ss(0
,1)
=4
0*m
ass
_a
mu
ep
sil(1
,1)
=1
.67
e-2
1*j
ou
lesi
gm
a(1
,1)
=3
.40
5!-
---
Heliu
m:
Azi
zp
ote
ntia
lm
ore
acc
ura
te!
mass
(0,1
)=
4*m
ass
_a
mu
!e
psi
l(1
,1)
=1
0.2
2!
sig
ma
(1,1
)=
2.5
56
!---
-N
eo
n!
mass
(0,1
)=
18
*ma
ss_
am
u!
epsi
l(1
,1)
=0
.49
4e
-21
*jo
ule
!si
gm
a(1
,1)
=2
.75
0d
0!-
---
sym
me
triz
em
ass
es
an
dL
en
nard
Jon
es
coe
ffic
ien
tsm
ass
(0,2
)=
ma
ss(0
,1)
ep
sil(2
,2)
=e
psi
l(1
,1)
ep
sil(1
,2)
=sq
rt(e
psi
l(1
,1)*
ep
sil(2
,2))
ep
sil(2
,1)
=e
psi
l(1
,2)
sig
ma
(2,2
)=
sig
ma
(1,1
)si
gm
a(1
,2)
=(s
igm
a(1
,1)+
sig
ma
(2,2
))/2
sig
ma
(2,1
)=
sig
ma
(1,2
)!-
---
cho
sea
pp
rop
ria
tecu
toff
and
skin
87
B. Programsd
oi_
typ
e=
1,n
_ty
pe
do
j_ty
pe
=1
,n_
typ
er_
cuto
ff(i_
typ
e,j_
typ
e)
=1
.7*s
igm
a(i_
typ
e,j_
typ
e)
!r_
cuto
ff(i_
typ
e,j_
typ
e)
=3
.00
*sig
ma
(i_
typ
e,j_
typ
e)
r_sk
in(i_
typ
e,j_
typ
e)
=0
.18
*r_
cuto
ff(i_
typ
e,j_
typ
e)
en
dd
oe
nd
do
!---
-ch
ose
ap
pro
pria
test
art
para
me
ters
tk=
0.4
*ep
sil(1
,1)
dt
=0
.01
25
*sq
rt(s
igm
a(1
,1)*
*2*m
ass
(0,1
)/e
psi
l(1
,1))
f_p
ress
ure
=1
pre
ss=
.00
1*e
psi
l(1
,1)/
sig
ma
(1,1
)**3
if(n
_o
rde
r.e
q.2
)th
en
!---
-ch
eck
en
erg
yco
nse
rva
tion
fric
tion
(1)
=0
.fr
ic_
bo
x=
0.
dt
=d
t/2
els
efr
ictio
n(1
)=
0.0
1/
dt
fric
_b
ox
=0.0
1/
dt
en
dif
fric
tion
(2)
=fr
ictio
n(1
)!-
--d
efin
ein
ert
iafo
rb
ox
de
form
atio
nm
ass
_b
ox
=(n
_si
lic*m
ass
(0,1
)+
n_
oxy
*ma
ss(0
,2))
/1
2
ma
ss_
bo
x=
ma
ss_
bo
x/
2
els
e!
i_d
um
my
if(i_
du
mm
y.n
e.f_
po
ten
tial)
&st
op
"f_p
ote
ntia
la
nd
pim
d.in
pm
ism
atc
h"
rea
d(1
0,2
10
)i_
du
mm
y,ch
ar_
du
mm
yif
(i_
du
mm
y.n
e.f_
cha
rge
ad
just
)&
sto
p"f
_ch
arg
ea
dju
sta
nd
pim
d.in
pm
ism
atc
h"
rea
d(1
0,2
10
)n_
rela
xre
ad
(10
,21
0)
n_
ob
ser
rea
d(1
0,2
10
)n_
safe
rea
d(1
0,2
10
)is
ee
dre
ad
(10
,20
0)
cha
r_d
um
my
rea
d(1
0,2
01
)dt
rea
d(1
0,2
01
)tk
rea
d(1
0,2
00
)ch
ar_
du
mm
yre
ad
(10
,20
2)
(ma
ss(0
,i_ty
pe
),i_
typ
e=
1,n
_ty
pe
)re
ad
(10
,20
2)
(frict
ion
(i_
typ
e),
i_ty
pe
=1,n
_ty
pe
)re
ad
(10
,20
2)
ma
ss_
bo
x,fr
ic_
bo
x
rea
d(1
0,2
00
)ch
ar_
du
mm
yre
ad
(10
,20
1)
pre
ssre
ad
(10
,21
0)
f_p
ress
ure
rea
d(1
0,2
00
)ch
ar_
du
mm
y
do
i_ty
pe
=1
,n_
typ
ere
ad
(10
,20
2)
(ep
sil(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
ore
ad
(10
,20
0)
cha
r_d
um
my
do
i_ty
pe
=1
,n_
typ
ere
ad
(10
,20
2)
(sig
ma
(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
o
rea
d(1
0,2
00
)ch
ar_
du
mm
y
do
i_ty
pe
=1
,n_
typ
ere
ad
(10
,20
2)
(r_
cuto
ff(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
o
rea
d(1
0,2
00
)ch
ar_
du
mm
yd
oi_
typ
e=
1,n
_ty
pe
rea
d(1
0,2
02
)(r
_sk
in(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
o
en
dif
clo
se(1
0)
els
etk
=tk
-0
.25
en
dif
if(i_
run
.eq
.1)
the
n!-
--a
bso
rbfa
cto
r4
into
ep
silo
nan
din
itia
lize
sig
ma
_2
do
i_ty
pe
=1
,n_
typ
ed
oj_
typ
e=
1,n
_ty
pe
sig
ma
_2
(i_
typ
e,j_
typ
e)
=si
gm
a(i_
typ
e,j_
typ
e)*
*2e
psi
l(i_
typ
e,j_
typ
e)
=4
*ep
sil(i_
typ
e,j_
typ
e)
en
dd
oe
nd
do
en
dif
do
i_ty
pe
=1
,n_
typ
ed
oj_
typ
e=
1,n
_ty
pe
r_cu
toff_
2(i_
typ
e,j_
typ
e)
=r_
cuto
ff(i_ty
pe
,j_ty
pe
)**2
r_ra
ng
e(i_
typ
e,j_
typ
e)
=r_
cuto
ff(i_
type
,j_ty
pe
)+
&r_
skin
(i_
typ
e,j_
typ
e)
r_ra
ng
e_
2(i_
typ
e,j_
typ
e)
=r_
ran
ge
(i_
typ
e,j_
typ
e)*
*2e
nd
do
en
dd
o
!---
de
fine
shift
sin
en
erg
y
do
i_ty
pe
=1
,n_
typ
ed
oj_
typ
e=
1,n
_ty
pe
r_d
um
my
=(s
igm
a_
2(j_
typ
e,i_
typ
e)/
r_cu
toff_
2(j_
typ
e,i_
typ
e))
**3
e_
shift
(j_
typ
e,i_
typ
e)
=r_
du
mm
y*(r
_du
mm
y-1
.)e
nd
do
en
dd
o
!**
****
****
****
f_p
ote
ntia
l3
els
eif
(f_
po
ten
tial.e
q.3
)th
en
if(f
_ch
arg
ea
dju
st.n
e.1
)th
en
sto
p"B
KS
pote
ntia
ld
oe
sn
ot
wo
rkw
ithva
ria
ble
cha
rge
"e
nd
if
if(i_
run
.eq
.1)
the
no
pe
n(1
0,
file
="p
imd
.inp
",st
atu
s="o
ld")
rea
d(1
0,2
10
)i_
du
mm
y,ch
ar_
du
mm
y
if(i_
du
mm
y.e
q.0
)th
en
!---
-ta
kede
fau
ltp
ara
me
ters
n_
rela
x=
50
n_
ob
ser
=5
0n
_sa
fe=
100
ise
ed
=4
75
91
+2
*in
t(n
_p
art
/2)+
2*i
nt(
10
*tk)
+n
_tr
ot
88
B.1. Molecular Dynamics Code
jse
ed
=is
ee
d
if(f
_ch
arg
ea
dju
st.n
e.1
)th
en
qe
qe
lect
rone
g(1
)=
4.1
68
*11
60
4.5
04
9!
eV
->kB
Kq
eq
ele
ctro
ne
g(2
)=
8.7
41
*11
60
4.5
04
9q
eq
ha
rdn
ess
(1)
=6
.97
4*1
16
04
.50
49
qe
qh
ard
ne
ss(2
)=
13
.36
4*1
16
04
.50
49
en
dif
n_
rela
x=
30
n_
ob
ser
=3
0n
_sa
fe=
30
!---
-si
liciu
mm
ass
(0,1
)=
28
.1*m
ass
_a
mu
!---
-o
xyge
nm
ass
(0,2
)=
16
.0*m
ass
_a
mu
ep
sil(1
,1)
=0
.*e
ve
psi
l(2
,2)
=1
38
8.7
73
*ev
ep
sil(1
,2)
=1
80
03
.75
72
*ev
ep
sil(2
,1)
=e
psi
l(1
,2)
sig
ma
(1,1
)=
0.
sig
ma
(2,2
)=
2.7
6si
gm
a(1
,2)
=4
.87
31
8si
gm
a(2
,1)
=si
gm
a(1
,2)
c_va
nd
wa
als
(1,1
)=
0.
c_va
nd
wa
als
(2,2
)=
17
5.0
*ev
c_va
nd
wa
als
(1,2
)=
13
3.5
38
1*e
vc_
van
dw
aa
ls(2
,1)
=c_
van
dw
aa
ls(1
,2)
alp
ha
=0
.3*
(10
02
./n
_p
art
)**(
1./6
)a
lph
a=
0.3
v_cu
t=
0.0
1*e
lec_
pre
fac*
(1.2
*2.4
)/1
.6/s
qrt
(1.*
n_
pa
rt)
f_o
pt_
rec
=0
do
i_ty
pe
=1,n
_ty
pe
do
j_ty
pe
=1,n
_ty
pe
r_sk
in(i_
typ
e,j_
typ
e)
=0
.45
en
dd
oe
nd
do
tk=
36
00
./n
_tr
ot
!--
--tim
est
ep
=1
fsd
t=
1.3
09
1e
-4f_
pre
ssu
re=
1p
ress
=.0
if(n
_o
rde
r.eq
.2)
the
n!-
---
che
cke
ne
rgy
con
serv
atio
nfr
ictio
n(1
)=
0.
fric
_b
ox
=0
.d
t=
dt/2
els
efr
ictio
n(1
)=
0.0
1/
dt
fric
_b
ox
=0
.01
/d
te
nd
iffr
ictio
n(2
)=
fric
tion
(1)
!---
de
fine
ine
rtia
for
bo
xd
efo
rma
tion
ma
ss_
bo
x=
(n_
silic
*ma
ss(0
,1)
+n
_o
xy*m
ass
(0,2
))/
12
ma
ss_
bo
x=
ma
ss_
bo
x/
8e
lse
!i_
dum
my
if(i_
du
mm
y.ne
.f_
po
ten
tial)
&st
op
"f_
po
ten
tial
an
dp
imd
.inp
mis
ma
tch
"re
ad
(10
,21
0)
i_d
um
my,
cha
r_d
um
my
if(i_
du
mm
y.ne
.f_
cha
rge
ad
just
)&
sto
p"f
_ch
arg
ea
dju
sta
nd
pim
d.in
pm
ism
atc
h"
rea
d(1
0,2
10
)n
_re
lax
rea
d(1
0,2
10
)n
_o
bse
rre
ad
(10
,21
0)
n_sa
fere
ad
(10
,21
0)
ise
ed
rea
d(1
0,2
00
)ch
ar_
du
mm
yre
ad
(10
,20
1)
dt
rea
d(1
0,2
01
)tk
rea
d(1
0,2
00
)ch
ar_
du
mm
yre
ad
(10
,20
2)
(ma
ss(0
,i_ty
pe
),i_
typ
e=
1,n
_ty
pe
)re
ad
(10
,20
2)
(frict
ion
(i_
typ
e),
i_ty
pe
=1,n
_ty
pe
)re
ad
(10
,20
2)
mass
_b
ox,
fric
_b
ox
rea
d(1
0,2
00
)ch
ar_
du
mm
yre
ad
(10
,20
1)
pre
ssre
ad
(10
,21
0)
f_p
ress
ure
rea
d(1
0,2
10
)f_
op
t_re
cre
ad
(10
,20
0)
cha
r_d
um
my
rea
d(1
0,2
00
)ch
ar_
du
mm
y
if(f
_ch
arg
ead
just
.ne
.1)
the
nre
ad
(10
,20
2)
(qe
qe
lect
ron
eg
(i_
typ
e),
i_ty
pe
=1
,n_
typ
e)
rea
d(1
0,2
02
)(q
eq
ha
rdn
ess
(i_
typ
e),
i_ty
pe
=1
,n_
typ
e)
en
dif
rea
d(1
0,2
00
)ch
ar_
du
mm
y
do
i_ty
pe
=1
,n_
typ
ere
ad
(10
,20
2)
(ep
sil(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
ore
ad
(10
,20
0)
cha
r_d
um
my
do
i_ty
pe
=1
,n_
typ
ere
ad
(10
,20
2)
(sig
ma
(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
o
rea
d(1
0,2
00
)ch
ar_
du
mm
yd
oi_
typ
e=
1,n
_ty
pe
rea
d(1
0,2
02)
(c_
van
dw
aa
ls(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
o
rea
d(1
0,2
00
)ch
ar_
du
mm
y
rea
d(1
0,2
02)
alp
ha
,v_
cut
rea
d(1
0,2
00
)ch
ar_
du
mm
yd
oi_
typ
e=
1,n
_ty
pe
rea
d(1
0,2
02)
(r_
skin
(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
o
en
dif
!i_
du
mm
ycl
ose
(10
)e
lse
!i_ru
ntk
=tk
-0
.25
en
dif
!i_ru
n
alp
ha
_p
refa
c=
2*a
lph
a/s
qrt
(pi)
r_cu
toff(1
,1)
=3
./a
lph
ar_
cuto
ff(2
,2)
=3
./a
lph
ar_
cuto
ff(2
,1)
=3
./a
lph
ar_
cuto
ff(1
,2)
=r_
cuto
ff(2
,1)
!if
(r_
cuto
ff(1
,1).
lt.r_
cut_
sho
rt)
!&
stop
"cu
to
ffto
osm
all
for
sho
rtra
ng
e"
89
B. Programsq
_cu
t_2
=(6
.*a
lph
a)*
*2!-
--a
ny
pe
ak
|f(k
|ˆ2
ino
rde
r1
/sq
rt(N
)g
ets
cut
off
do
i_ty
pe
=1
,n_
typ
ed
oj_
typ
e=
1,n
_ty
pe
sig
ma
_2
(i_
typ
e,j_
typ
e)
=si
gm
a(i_
typ
e,j_
typ
e)*
*2e
nd
do
en
dd
or_
cuto
ff_
ma
x=
0.0
do
i_ty
pe
=1
,n_
typ
ed
oj_
typ
e=
1,n
_ty
pe
r_cu
toff_
ma
x=
ma
x(r_
cuto
ff_
ma
x,r_
cuto
ff(i_
typ
e,j_
typ
e))
en
dd
oe
nd
do
do
i_ty
pe
=1
,n_
typ
ed
oj_
typ
e=
1,n
_ty
pe
r_cu
toff_
2(i_
typ
e,j_
typ
e)
=r_
cuto
ff(i_
typ
e,j_
typ
e)*
*2r_
ran
ge
(i_
typ
e,j_
typ
e)
=r_
cuto
ff(i_
typ
e,j_
typ
e)
+&
r_sk
in(i_
typ
e,j_
typ
e)
r_ra
ng
e_
2(i_ty
pe
,j_ty
pe
)=
r_ra
ng
e(i_ty
pe
,j_ty
pe
)**2
en
dd
oe
nd
do
!---
de
fine
shift
sin
en
erg
y
do
i_ty
pe
=1
,n_
typ
ed
oj_
typ
e=
1,n
_ty
pe
!---
-e
lect
rost
atic
e_
shift
(i_
typ
e,j_
typ
e)
=e
rfcc
(alp
ha
*r_cu
toff(i_
typ
e,j_
typ
e))
*&
ele
c_p
refa
c/r_
cuto
ff(i_
typ
e,j_
typ
e)
!---
-sh
ort
ran
ge
e_
shift
_sh
ort
(i_
typ
e,j_
typ
e)
=e
psi
l(i_
typ
e,j_
typ
e)*
&e
xp(-
sig
ma(i_
typ
e,j_
typ
e)*
r_cu
t_sh
ort
)-&
c_va
nd
wa
als
(i_
typ
e,j_
typ
e)/
r_cu
t_sh
ort
**6
en
dd
oe
nd
do
!---
-ta
bu
late
po
ten
tial
v(r)
an
dd
v/d
rd
oi_
typ
e=
1,n
_ty
pe
do
j_ty
pe
=1,n
_ty
pe
do
i_p
ote
ntia
l=
0,n
_p
ote
ntia
lr_
1=
i_p
ote
ntia
l*r_
ran
ge
(i_
typ
e,j_
typ
e)/
n_
po
ten
tial
r_2
=r_
1**
2!-
----
-cu
toff
at
5.5
\AA
sho
rtra
nge
inte
ract
ion
(SiO
_2
)if(
r_1
.le.r
_cu
t_sh
ort
)th
en
exp
_p
ot
=e
psi
l(i_
typ
e,j_
typ
e)*
exp
(-si
gm
a(i_
typ
e,j_
typ
e)*
r_1
)e
lse
exp
_p
ot
=0
.0e
nd
ifif(
r_2
.lt.2
.0)
the
nif(
i_ty
pe
.eq
.j_ty
pe
)th
en
r_2
=2
.0r_
1=
sqrt
2e
lse
if(r_
2.lt
.1.2
1)
the
nr_
2=
1.2
1r_
1=
1.1
en
dif
en
dif
!---
---
cuto
ffa
tsh
ort
ran
ge
inte
ract
ion
(SiO
_2
)if(
r_1
.le.r
_cu
t_sh
ort
)th
en
r_6
=c_
van
dw
aa
ls(i_
typ
e,j_
typ
e)*
(1./r_
2)*
*3e
lse
r_6
=0
.e
nd
ifv_
cou
lom
b=
erf
cc(a
lph
a*r
_1
)*e
lec_
pre
fac/
r_1
po
t_lo
c=
exp
_p
ot
-r_
6if(
r_1
.le.r
_cu
t_sh
ort
)&
po
t_lo
c=
po
t_lo
c-
e_
shift
_sh
ort
(i_
typ
e,j_
typ
e)
!---
-r_
dum
my
={\
pa
rtia
lV
\ove
r\p
art
ial
r}/
rr_
du
mm
y=
-sig
ma
(i_
typ
e,j_
typ
e)*
exp
_po
t/r_
1+
6*r
_6
/r_
2r_
po
t_1
(i_
typ
e,j_
typ
e,i_
po
ten
tial)
=p
ot_
loc
r_p
ot_
2(i_
typ
e,j_
typ
e,i_
po
ten
tial)
=-e
_sh
ift(i_
typ
e,j_
typ
e)
&+
v_co
ulo
mb
r_p
ot_
d_
1(i_ty
pe
,j_ty
pe
,i_p
ote
ntia
l)=
r_d
um
my
r_p
ot_
d_
2(i_ty
pe
,j_ty
pe
,i_p
ote
ntia
l)=
-(1
./r_
2)
*(v
_co
ulo
mb+
&e
lec_
pre
fac*
alp
ha
_p
refa
c*e
xp(-
(alp
ha
*r_
1)*
*2))
en
dd
oe
nd
do
en
dd
od
oi_
po
ten
tial
=-n
_p
ote
ntia
l,n_
po
ten
tial
r_d
um
my
=i_
po
ten
tial*
2*p
i/n_
po
ten
tial
c_d
um
my
=r_
du
mm
y*(
0.,1
.)ta
b_
exp
_im
a(i_
po
ten
tial)
=e
xp(c
_d
um
my)
en
dd
o
!**
****
****
****
*f_
po
ten
tial
4e
lse
if(f
_p
ote
ntia
l.eq
.4)
the
nif
(i_
run
.eq
.1)
the
no
pe
n(1
0,
file
="p
imd
.inp
",st
atu
s="o
ld")
rea
d(1
0,2
10
)i_
du
mm
y,ch
ar_
du
mm
y
if(i_
du
mm
y.e
q.0
)th
en
!---
-ta
kede
fau
ltp
ara
me
ters
n_
rela
x=
50
n_
ob
ser
=5
0n
_sa
fe=
100
ise
ed
=4
75
91
+2
*in
t(n
_p
art
/2)+
2*i
nt(
10
*tk)
+n
_tr
ot
jse
ed
=is
eed
if(f
_ch
arg
ea
dju
st.n
e.1
)th
en
qe
qe
lect
ron
eg
(1)
=4
.16
8*1
16
04
.50
49
!e
V->
kBK
qe
qe
lect
ron
eg
(2)
=8
.74
1*1
16
04
.50
49
qe
qh
ard
ne
ss(1
)=
6.9
74
*11
60
4.5
04
9q
eq
ha
rdn
ess
(2)
=1
3.3
64
*11
60
4.5
04
9e
nd
if
n_
rela
x=
50
n_
ob
ser
=5
0n
_sa
fe=
10
0m
ass
(0,1
)=
4*m
ass
_a
mu
ma
ss(0
,2)
=m
ass
(0,1
)r_
cuto
ff(1
,1)
=1
0.
r_sk
in(1
,1)
=1
.1tk
=4
.5d
t=
0.5
e-2
f_p
ress
ure
=1
!--
-cr
it.is
ob
ar
of
He
3?
pre
ss=
.72
43
e-2
!--
-cr
it.is
ob
ar
of
He
lium
4p
ress
=.1
647
50
e-1
!--
-in
itia
liza
tion
of
fo_
sca
...c
or
ina
ziz_
loca
l
if(n
_o
rde
r.e
q.2
)th
en
!---
-ch
eck
en
erg
yco
nse
rva
tion
90
B.1. Molecular Dynamics Code
fric
tion
(1)
=0
.fr
ic_
bo
x=
0.
dt
=d
t/2
els
efr
ictio
n(1
)=
0.0
1/
dt
fric
_b
ox
=0
.01
/d
te
nd
iffr
ictio
n(2
)=
fric
tion
(1)
!---
de
fine
ine
rtia
for
bo
xd
efo
rma
tion
ma
ss_
bo
x=
(n_
silic
*ma
ss(0
,1)
+n
_o
xy*m
ass
(0,2
))/
12
ma
ss_
bo
x=
mass
_b
ox
/5
els
e!
i_d
um
my
if(i_
du
mm
y.ne
.f_
po
ten
tial)
&st
op
"f_
po
ten
tial
an
dp
imd
.inp
mis
ma
tch
"re
ad
(10
,21
0)
i_d
um
my,
cha
r_d
um
my
if(i_
du
mm
y.ne
.f_
cha
rge
ad
just
)&
sto
p"f
_ch
arg
ea
dju
sta
nd
pim
d.in
pm
ism
atc
h"
rea
d(1
0,2
10
)n
_re
lax
rea
d(1
0,2
10
)n
_o
bse
rre
ad
(10
,21
0)
n_
safe
rea
d(1
0,2
10
)is
ee
dre
ad
(10
,20
0)
cha
r_d
um
my
rea
d(1
0,2
01
)d
tre
ad
(10
,20
1)
tkre
ad
(10
,20
0)
cha
r_d
um
my
rea
d(1
0,2
02
)(m
ass
(0,i_
typ
e),
i_ty
pe
=1,n
_ty
pe
)re
ad
(10
,20
2)
(frict
ion
(i_
typ
e),
i_ty
pe=
1,n
_ty
pe
)re
ad
(10
,20
2)
ma
ss_
bo
x,fr
ic_
bo
x
rea
d(1
0,2
00)
cha
r_d
um
my
rea
d(1
0,2
01)
pre
ssre
ad
(10
,21
0)
f_p
ress
ure
rea
d(1
0,2
00)
cha
r_d
um
my
if(f
_ch
arg
ea
dju
st.n
e.1
)th
en
rea
d(1
0,2
02)
(qe
qe
lect
ron
eg
(i_
typ
e),
i_ty
pe
=1
,n_
typ
e)
rea
d(1
0,2
02)
(qe
qh
ard
ne
ss(i_
typ
e),
i_ty
pe
=1
,n_
typ
e)
en
dif
rea
d(1
0,2
00)
cha
r_d
um
my
rea
d(1
0,2
00)
cha
r_d
um
my
do
i_ty
pe
=1,n
_ty
pe
rea
d(1
0,2
02)
(r_
cuto
ff(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
o
rea
d(1
0,2
00)
cha
r_d
um
my
do
i_ty
pe
=1
,n_
typ
ere
ad
(10
,20
2)
(r_
skin
(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
o
en
dif
!i_d
um
my
clo
se(1
0)
els
e!
i_ru
ntk
=tk
-0
.25
en
dif
!i_
run
do
i_ty
pe
=1,n
_ty
pe
do
j_ty
pe
=1,n
_ty
pe
r_cu
toff_
2(i_ty
pe
,j_ty
pe
)=
r_cu
toff(i_
typ
e,j_
typ
e)*
*2r_
ran
ge
(i_
type
,j_ty
pe
)=
r_cu
toff(i_
typ
e,j_
typ
e)
+&
r_sk
in(i_
typ
e,j_
typ
e)
r_ra
ng
e_
2(i_
typ
e,j_
typ
e)
=r_
ran
ge
(i_ty
pe
,j_ty
pe
)**2
en
dd
oe
nd
do
!---
de
fine
shift
sin
en
erg
y
i_ty
pe
=1
r_1
=r_
cuto
ff(1
,1)
call
azi
z_lo
cal(r_
1,d
_d
um
m1
)e
_sh
ift_
sho
rt(1
,1)
=d
_d
um
m1
do
i_p
ote
ntia
l=
5,
n_
po
ten
tial
r_1
=i_
po
ten
tial
*r_
ran
ge
(1,1
)/
n_
po
ten
tial
call
azi
z_lo
cal(r_
1,d
_d
um
m1
)r_
po
t(1
,1,i_
po
ten
tial)
=d
_d
um
m1
-e
_sh
ift_
sho
rt(1
,1)
r_1
=(i_
pote
ntia
l-1
)*
r_ra
ng
e(1
,1)
/n
_p
ote
ntia
lr_
2=
r_1
**2
call
azi
z_lo
cal(r_
1,d
_d
um
m1
)r_
1=
(i_
pote
ntia
l+1
)*
r_ra
ng
e(1
,1)
/n
_p
ote
ntia
lr_
2=
r_1
**2
call
azi
z_lo
cal(r_
1,d
_d
um
m2
)r_
po
t_d
(1,1
,i_p
ote
ntia
l)=
(d_
du
mm
2-d
_d
um
m1
)&
/(r
_ra
ng
e(1
,1)
/n
_p
ote
ntia
l)**
2/
(2*i
_p
ote
ntia
l)e
nd
do
!**
****
****
****
*f_
po
ten
tial
5+
6+
7
els
eif
((f_
po
ten
tial.g
e.5
).a
nd
.(f_
pote
ntia
l.le
.7))
the
n
if((
f_p
ote
ntia
l.eq
.5).
an
d.(
f_ch
arg
ead
just
.eq
.3))
the
nst
op
"MS
-Qp
ote
ntia
ld
oe
sn
ot
wo
rkw
ithE
xtL
ag
ran
ge
"e
nd
if
if((
f_p
ote
ntia
l.eq
.6).
an
d.(
f_ch
arg
ead
just
.eq
.4))
the
nst
op
"Ms-
fluc
Qp
ote
ntia
ld
oe
sn
ot
wo
rkw
ithe
xact
&d
iag
on
alis
atio
n"
en
dif
con
sta
nt_
cha
rge
(1)
=1
.3D
0co
nst
an
t_ch
arg
e(2
)=
-0.6
5D
0
if(i_
run
.eq
.1)
the
no
pe
n(1
0,
file=
"pim
d.in
p",
sta
tus=
"old
")re
ad
(10
,21
0)
i_d
um
my,
cha
r_d
um
my
if(i_
du
mm
y.eq
.0)
the
n!-
---
take
de
fau
ltp
ara
me
ters
n_
rela
x=
50
n_
ob
ser
=5
0n
_sa
fe=
10
0is
ee
d=
47
59
1+
2*i
nt(
n_
pa
rt/2
)+2
*in
t(1
0*t
k)+
n_
tro
tjs
ee
d=
ise
ed
n_
rela
x=
30
n_
ob
ser
=30
n_
safe
=30
!---
-si
liciu
mm
ass
(0,1
)=
28
.1*m
ass
_a
mu
91
B. Programs!-
---
oxy
ge
nm
ass
(0,2
)=
16
.0*m
ass
_a
mu
if(f
_ch
arg
ea
dju
st.n
e.1
)th
en
qe
qe
lect
ron
eg(1
)=
4.1
68
*11
60
4.5
04
9!
eV
->kB
Kq
eq
ele
ctro
ne
g(2
)=
8.7
41
*11
60
4.5
04
9q
eq
ha
rdn
ess
(1)
=6
.97
4*1
16
04
.50
49
qe
qh
ard
ne
ss(2
)=
13
.36
4*1
16
04
.50
49
en
dif
d0
(1,1
)=
0.2
956
d0
(2,2
)=
0.5
363
d0
(1,2
)=
45
.997
!26
.37
65
d0
(2,1
)=
d0
(1,2
)m
sr0
(1,1
)=
3.4
10
3m
sr0
(2,2
)=
3.7
83
5m
sr0
(1,2
)=
1.6
14
8!1
.83
77
9m
sr0
(2,1
)=
msr
0(1
,2)
ga
mm
a(1
,1)
=1
1.7
13
9g
am
ma
(2,2
)=
10.4
11
2g
am
ma
(1,2
)=
8.8
02
2!8
.1g
am
ma
(2,1
)=
gam
ma
(1,2
)
msn
(1)=
3m
sn(2
)=2
msz
eta
(1,1
)=0
.14
88
10
e1
msz
eta
(1,2
)=0
.14
88
10
e1
msz
eta
(2,1
)=0
.18
68
46
e1
msz
eta
(2,2
)=0
.18
68
46
e1
alp
ha
=0
.3*
(10
02
./n
_p
art
)**(
1./6
)a
lph
a=
0.4
v_cu
t=
0.0
1*e
lec_
pre
fac*
(1.2
*2.4
)/1
.6/s
qrt
(1.*
n_
pa
rt)
v_cu
t=
0.
f_o
pt_
rec
=0
do
i_ty
pe
=1
,n_
typ
ed
oj_
typ
e=
1,n
_ty
pe
r_sk
in(i_
typ
e,j_
typ
e)
=0
.45
en
dd
oe
nd
do
tk=
36
00
./n
_tr
ot
!--
--tim
est
ep
=1
fsd
t=
1.3
09
1e
-4f_
pre
ssu
re=
1p
ress
=.0
if(f
_ch
arg
ea
dju
st.e
q.3
)th
en
qe
qm
ass
(1)
=0
.04
do
i_ty
pe
=2,
n_
typ
eq
eq
ma
ss(i_
typ
e)=
&q
eq
ma
ss(1
)*
sqrt
(qe
qh
ard
ne
ss(i_
typ
e)/
qe
qh
ard
ne
ss(1
))e
nd
do
qe
qfr
ictio
n=
0.1
/d
te
nd
if
if(n
_o
rde
r.e
q.2
)th
en
!---
-ch
eck
en
erg
yco
nse
rva
tion
fric
tion
(1)
=0
.fr
ic_
bo
x=
0.
dt
=d
t/2
els
e
fric
tion
(1)
=0
.01
/d
tfr
ic_
bo
x=
0.0
1/
dt
en
dif
fric
tion
(2)
=fr
ictio
n(1
)!-
--d
efin
ein
ert
iafo
rb
ox
de
form
atio
nm
ass
_b
ox
=(n
_si
lic*m
ass
(0,1
)+
n_
oxy
*ma
ss(0
,2))
/1
2m
ass
_b
ox
=m
ass
_b
ox
/8
els
e!
i_d
um
my
if(i_
du
mm
y.n
e.f_
po
ten
tial)
&st
op
"f_
po
ten
tial
an
dp
imd
.inp
mis
ma
tch
"re
ad
(10
,21
0)
i_d
um
my,
cha
r_d
um
my
if(i_
du
mm
y.n
e.f_
cha
rge
ad
just
)&
sto
p"f
_ch
arg
ea
dju
sta
nd
pim
d.in
pm
ism
atc
h"
rea
d(1
0,2
10
)n
_re
lax
rea
d(1
0,2
10
)n
_o
bse
rre
ad
(10
,21
0)
n_
safe
rea
d(1
0,2
10
)is
ee
dre
ad
(10
,20
0)
cha
r_d
um
my
rea
d(1
0,2
01
)d
tre
ad
(10
,20
1)
tkre
ad
(10
,20
0)
cha
r_d
um
my
rea
d(1
0,2
02
)(m
ass
(0,i_
typ
e),
i_ty
pe
=1,n
_ty
pe
)re
ad
(10
,20
2)
(frict
ion
(i_
typ
e),
i_ty
pe=
1,n
_ty
pe
)re
ad
(10
,20
2)
ma
ss_
bo
x,fr
ic_
bo
x
rea
d(1
0,2
00
)ch
ar_
du
mm
yre
ad
(10
,20
1)
pre
ssre
ad
(10
,21
0)
f_p
ress
ure
rea
d(1
0,2
10
)f_
op
t_re
cre
ad
(10
,20
0)
cha
r_d
um
my
if(f
_ch
arg
ea
dju
st.n
e.1
)th
en
rea
d(1
0,2
02
)(q
eq
ele
ctro
ne
g(i_
typ
e),
i_ty
pe
=1
,n_
typ
e)
rea
d(1
0,2
02
)(q
eq
ha
rdn
ess
(i_
typ
e),
i_ty
pe
=1
,n_
typ
e)
en
dif
rea
d(1
0,2
00
)ch
ar_
du
mm
y
if(f
_ch
arg
ea
dju
st.e
q.3
)th
en
rea
d(1
0,2
02
)(q
eq
ma
ss(i_
typ
e),
i_ty
pe
=1
,n_
typ
e)
rea
d(1
0,2
01
)qe
qfr
ictio
ne
nd
ifre
ad
(10
,20
0)
cha
r_d
um
my
do
i_ty
pe
=1
,n_
typ
ere
ad
(10
,20
2)
(d0
(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
ore
ad
(10
,20
0)
cha
r_d
um
my
do
i_ty
pe
=1
,n_
typ
ere
ad
(10
,20
2)
(msr
0(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
o
rea
d(1
0,2
00
)ch
ar_
du
mm
yd
oi_
typ
e=
1,n
_ty
pe
rea
d(1
0,2
02
)(g
am
ma
(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
o
rea
d(1
0,2
00
)ch
ar_
du
mm
yd
oi_
typ
e=
1,n
_ty
pe
rea
d(1
0,2
02
)(m
sze
ta(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
o
92
B.1. Molecular Dynamics Code
rea
d(1
0,2
00)
cha
r_d
um
my
rea
d(1
0,2
20)
(msn
(i_
typ
e),
i_ty
pe
=1
,n_
typ
e)
rea
d(1
0,2
00)
cha
r_d
um
my
rea
d(1
0,2
02
)a
lph
a,
v_cu
t
rea
d(1
0,2
00)
cha
r_d
um
my
do
i_ty
pe
=1
,n_
typ
ere
ad
(10
,20
2)
(r_
skin
(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
o
en
dif
!i_
du
mm
ycl
ose
(10
)e
lse
!i_ru
ntk
=tk
-0
.25
en
dif
!i_ru
n
!a
lph
a=
0.0
!clu
ste
ra
lph
a_
pre
fac
=2
*alp
ha
/sq
rt(p
i)r_
cuto
ff(1
,1)
=3
./a
lph
ar_
cuto
ff(2
,2)
=r_
cuto
ff(1
,1)
r_cu
toff(2
,1)
=r_
cuto
ff(1
,1)
r_cu
toff(1
,2)
=r_
cuto
ff(1
,1)
!if
(r_
cuto
ff(1
,1).
lt.r_
cut_
short
)!
&st
op
"cu
to
ffto
osm
all
for
sho
rtra
ng
e"
q_
cut_
2=
(6.*
alp
ha
)**2
!clu
ste
r!-
--a
ny
pea
k|f(k
|ˆ2
ino
rde
r1
/sq
rt(N
)g
ets
cut
off
r_cu
toff_
ma
x=
0.0
do
i_ty
pe
=1,n
_ty
pe
do
j_ty
pe
=1,n
_ty
pe
r_cu
toff_
max
=m
ax(
r_cu
toff_
ma
x,r_
cuto
ff(i_
typ
e,j_
typ
e))
en
dd
oe
nd
do
do
i_ty
pe
=1,n
_ty
pe
do
j_ty
pe
=1,n
_ty
pe
r_cu
toff_
2(i_
typ
e,j_
typ
e)
=r_
cuto
ff(i_
typ
e,j_
typ
e)*
*2r_
ran
ge
(i_
typ
e,j_
typ
e)
=r_
cuto
ff(i_
typ
e,j_
typ
e)
+&
r_sk
in(i_ty
pe
,j_ty
pe
)r_
ran
ge
_2
(i_
typ
e,j_
typ
e)
=r_
ran
ge
(i_
typ
e,j_
typ
e)*
*2e
nd
do
en
dd
o
!ch
arg
e(1
)=
0.
!1
.3fu
er
de
nn
eu
en
Ha
milt
on
ian
,w
ird
!ch
arg
e(2
)=
0.
!-0
.65
na
chh
er
wie
de
ru
eb
ers
chrieb
en
!a
dd
mo
rse
-str
etc
hte
rma
nd
cou
lom
bte
rmd
oi_
typ
e=
1,n
_ty
pe
do
j_ty
pe
=1,n
_ty
pe
sla
terc
uto
ff=
sla
terin
t(i_
typ
e,j_
typ
e,r
_cu
toff(i_
typ
e,j_
typ
e))
do
i_p
ote
ntia
l=1
,n
_p
ote
ntia
lr_
1=
i_p
ote
ntia
l*r_
ran
ge
(i_
typ
e,j_
type
)/n
_p
ote
ntia
l
sla
terijr
=sl
ate
rin
t(i_
typ
e,j_
typ
e,r
_1
)
!ta
bu
late
pote
ntia
l
!m
ors
est
retc
hte
rm
if(r
_1
.lt.r
_cu
t_sh
ort
)th
en
po
t_lo
c=
tra
ns_
un
its*d
0(i_
typ
e,j_
typ
e)*
&(e
xp(g
am
ma
(i_
typ
e,j_
typ
e)*
(1-r
_cu
t_sh
ort
/msr
0(i_
typ
e,j_
type
)))
&-2
*exp
(ga
mm
a(i_
typ
e,j_
typ
e)/
2&
*(1-r
_cu
t_sh
ort
/msr
0(i_
typ
e,j_
typ
e))
))r_
po
t_1
(i_
type
,j_ty
pe
,i_p
ote
ntia
l)=
-p
ot_
loc
&+
tra
ns_
un
its*d
0(i_
typ
e,j_
typ
e)*
&(e
xp(g
am
ma
(i_
typ
e,j_
typ
e)*
(1-r
_1
/msr
0(i_
typ
e,j_
typ
e))
)&
-2*e
xp(g
am
ma
(i_
typ
e,j_
typ
e)/
2&
*(1-r
_1
/msr
0(i_
typ
e,j_
typ
e))
))
if(f
_p
ote
ntia
l.eq
.6)
the
nr_
po
t_1
(i_
typ
e,j_
typ
e,i_
po
ten
tial)
=&
r_p
ot_
1(i_
typ
e,j_
typ
e,i_
po
ten
tial)
+&
con
sta
nt_
cha
rge
(i_
typ
e)*
con
sta
nt_
cha
rge
(j_
typ
e)
&*e
lec_
pre
fac*
((1
./r_
1-s
late
rijr)
&-(
1./r_
cuto
ff(i_
typ
e,j_
typ
e)-
sla
terc
uto
ff))
en
dif
els
e r_p
ot_
1(i_
typ
e,j_
typ
e,i_
po
ten
tial)
=0.0
en
dif
!S
late
ro
rbita
lo
verla
p
r_p
ot_
2q
(i_ty
pe
,j_ty
pe
,i_p
ote
ntia
l)=
&e
lec_
pre
fac*
(sla
terijr-s
late
rcu
toff)
&-
ele
c_p
refa
c*(1
./r_
1-1
./r_
cuto
ff(i_
typ
e,j_
typ
e))
&+
erf
cc(a
lph
a*r
_1
)*!c
lust
er
&e
lec_
pre
fac/
r_1
-&
erf
cc(a
lph
a*r
_cu
toff(i_
typ
e,j_
typ
e))
*!c
lust
er
&e
lec_
pre
fac/
r_cu
toff(i_
typ
e,j_
typ
e)
if((
f_p
ote
ntia
l.eq
.6).
or.
(f_
po
ten
tial.e
q.7
))th
en
r_p
ot_
2(i_
typ
e,j_
typ
e,i_
po
ten
tial)
=&
r_po
t_2
q(i_
typ
e,j_
typ
e,i_
pote
ntia
l)e
nd
if
if(f
_p
ote
ntia
l.eq
.5)
the
nr_
po
t_2
(i_
typ
e,j_
typ
e,i_
po
ten
tial)
=&
erf
cc(a
lph
a*r
_1
)*!c
lust
er
&e
lec_
pre
fac/
r_1
-&
erf
cc(a
lph
a*r
_cu
toff(i_
typ
e,j_
typ
e))
*!c
lust
er
&e
lec_
pre
fac/
r_cu
toff(i_
typ
e,j_
typ
e)
en
dif
if(r
_1
.ge
.r_
cuto
ff(i_
typ
e,j_
typ
e))
the
nr_
po
t_2
(i_
typ
e,j_
typ
e,i_
po
ten
tial)=
0.0
r_p
ot_
2q
(i_
type
,j_ty
pe
,i_p
ote
ntia
l)=
0.0
en
dif
en
dd
oe
nd
do
en
dd
o
!n
um
erica
lde
riva
tive
for
the
two
pote
ntia
lte
rms
do
i_p
ote
ntia
l=
2,
n_
po
ten
tial-1
do
i_ty
pe
=1
,n
_ty
pe
do
j_ty
pe
=1,
n_
typ
er_
1=
i_p
ote
ntia
l*r_
ran
ge
(i_
typ
e,j_
typ
e)/
n_
po
ten
tial
93
B. Programsr_
po
t_d
_1
(i_
typ
e,j_
typ
e,i_
po
ten
tial)=
1./r_
1*
&(r
_p
ot_
1(i_
typ
e,j_
typ
e,i_
po
ten
tial+
1)-
&r_
po
t_1
(i_
typ
e,j_
typ
e,i_
po
ten
tial-1
))/
&(2
.*r_
ran
ge
(i_
typ
e,j_
typ
e)/
n_
po
ten
tial)
r_p
ot_
d_
2(i_
typ
e,j_
typ
e,i_
po
ten
tial)=
1./r_
1*
&(r
_p
ot_
2(i_
typ
e,j_
typ
e,i_
po
ten
tial+
1)-
&r_
po
t_2
(i_
typ
e,j_
typ
e,i_
po
ten
tial-1
))/
&(2
.*r_
ran
ge
(i_
typ
e,j_
typ
e)/
n_
po
ten
tial)
r_p
ot_
d_
2q
(i_
typ
e,j_
typ
e,i_
po
ten
tial)=
1./r_
1*
&(r
_p
ot_
2q
(i_
typ
e,j_
type
,i_p
ote
ntia
l+1
)-&
r_p
ot_
2q
(i_
typ
e,j_
typ
e,i_
po
ten
tial-1
))/
&(2
.*r_
ran
ge
(i_
typ
e,j_
typ
e)/
n_
po
ten
tial)
en
dd
oe
nd
do
en
dd
o
do
i_p
ote
ntia
l=
-n_
po
ten
tial,n
_p
ote
ntia
lr_
du
mm
y=
i_p
ote
ntia
l*2
*pi/n
_p
ote
ntia
lc_
du
mm
y=
r_d
um
my
*(0
.,1
.)ta
b_
exp
_im
a(i_p
ote
ntia
l)=
exp
(c_
du
mm
y)e
nd
do
!**
****
****
****
f_p
ote
ntia
l8
els
eif
(f_
po
ten
tial.e
q.8
)th
en
if(f
_ch
arg
ea
dju
st.n
e.1
)th
en
sto
p"V
ash
ish
tap
ote
ntia
ld
oe
sn
ot
wo
rkw
ithva
ria
ble
cha
rge
"e
nd
if
n_
an
g(1
)=n
_an
gu
lar
n_
an
g(2
)=1
if(i_
run
.eq.1
)th
en
op
en
(10
,fil
e=
"pim
d.in
p",
sta
tus=
"old
")re
ad
(10
,21
0)
i_d
um
my,
cha
r_d
um
my
con
sta
nt_
charg
e(1
)=
1.6
D0
con
sta
nt_
charg
e(2
)=
-0.8
D0
if(i_
du
mm
y.e
q.0
)th
en
!---
-ta
ked
efa
ult
pa
ram
ete
rsn
_re
lax
=5
0n
_o
bse
r=
50
n_
safe
=1
00
ise
ed
=4
75
91
+2
*in
t(n
_p
art
/2)+
2*i
nt(
10*t
k)+
n_
tro
tjs
ee
d=
ise
ed
n_
rela
x=
30
n_
ob
ser
=3
0n
_sa
fe=
30
!---
-si
liciu
mm
ass
(0,1
)=
28.1
*ma
ss_
am
u!-
---
oxy
gen
ma
ss(0
,2)
=1
6.0
*ma
ss_
am
uva
sh_
h(1
,1)
=0
.05
7*e
lec_
pre
fac
vash
_h
(2,2
)=
51
.69
2*e
lec_
pre
fac
vash
_h
(2,1
)=
11
.38
7*e
lec_
pre
fac
vash
_h
(1,2
)=
vash
_h
(2,1
)va
sh_
eta
(1,1
)=
11
.d0
vash
_e
ta(2
,2)
=7
.d0
vash
_e
ta(2
,1)
=9
.d0
vash
_e
ta(1
,2)
=va
sh_
eta
(2,1
)
vash
_a
lph
a(1
)=
0.d
0*e
lec_
pre
fac
vash
_a
lph
a(2
)=
2.4
d0
*ele
c_p
refa
cva
sh_
B(1
)=
0.3
5va
sh_
B(2
)=
1.4
vash
_l(1
)=
1.0
vash
_l(2
)=
1.0
vash
_ct
he
ta(1
)=
cos(
pi*
10
9.4
7/1
80
.)va
sh_
cth
eta
(2)
=co
s(p
i*1
41
.00
/18
0.)
vash
_r0
(1)
=2
.6va
sh_
r0(2
)=
2.6
alp
ha
=0
.3*
(10
02
./n
_p
art
)**(
1./6
)a
lph
a=
0.3
v_cu
t=
0.0
1*e
lec_
pre
fac*
(1.2
*2.4
)/1
.6/s
qrt
(1.*
n_
pa
rt)
f_o
pt_
rec
=0
do
i_ty
pe
=1
,n_
typ
ed
oj_
typ
e=
1,n
_ty
pe
r_sk
in(i_
typ
e,j_
typ
e)
=0
.45
en
dd
oe
nd
do
tk=
36
00
./n_
tro
t!
----
time
ste
p=
1fs
dt
=1
.30
91
e-4
f_p
ress
ure
=1
pre
ss=
.0
if(n
_o
rde
r.e
q.2
)th
en
!---
-ch
eck
en
erg
yco
nse
rva
tion
fric
tion
(1)
=0
.fr
ic_
bo
x=
0.
dt
=d
t/2
els
efr
ictio
n(1
)=
0.0
1/
dt
fric
_b
ox
=0
.01
/d
te
nd
iffr
ictio
n(2
)=
fric
tion
(1)
!---
de
fine
ine
rtia
for
bo
xd
efo
rmatio
nm
ass
_b
ox
=(n
_si
lic*m
ass
(0,1
)+
n_
oxy
*ma
ss(0
,2))
/1
2m
ass
_b
ox
=m
ass
_b
ox
/8
els
e!
i_d
um
my
if(i_
du
mm
y.n
e.f_
po
ten
tial)
&st
op
"f_
po
ten
tial
an
dp
imd
.inp
mis
ma
tch
"re
ad
(10
,21
0)
i_d
um
my,
cha
r_d
um
my
if(i_
du
mm
y.n
e.f_
cha
rge
ad
just
)&
sto
p"f
_ch
arg
ea
dju
sta
nd
pim
d.in
pm
ism
atc
h"
rea
d(1
0,2
10
)n
_re
lax
rea
d(1
0,2
10
)n
_o
bse
rre
ad
(10
,21
0)
n_
safe
rea
d(1
0,2
10
)is
ee
dre
ad
(10
,20
0)
cha
r_d
um
my
rea
d(1
0,2
01
)d
tre
ad
(10
,20
1)
tkre
ad
(10
,20
0)
cha
r_d
um
my
rea
d(1
0,2
02
)(m
ass
(0,i_
typ
e),
i_ty
pe
=1,n
_ty
pe
)re
ad
(10
,20
2)
(frict
ion
(i_
typ
e),
i_ty
pe=
1,n
_ty
pe
)re
ad
(10
,20
2)
ma
ss_
bo
x,fr
ic_
bo
x
rea
d(1
0,2
00
)ch
ar_
du
mm
yre
ad
(10
,20
1)
pre
ssre
ad
(10
,21
0)
f_p
ress
ure
rea
d(1
0,2
10
)f_
op
t_re
c
94
B.1. Molecular Dynamics Code
rea
d(1
0,2
00)
cha
r_d
um
my
rea
d(1
0,2
00)
cha
r_d
um
my
rea
d(1
0,2
00)
cha
r_d
um
my
do
i_ty
pe
=1,n
_ty
pe
rea
d(1
0,2
02)
(va
sh_
h(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
o
rea
d(1
0,2
00)
cha
r_d
um
my
do
i_ty
pe
=1,n
_ty
pe
rea
d(1
0,2
02)
(va
sh_
eta
(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
ore
ad
(10
,20
0)
cha
r_d
um
my
rea
d(1
0,2
02
)(v
ash
_a
lph
a(i_
typ
e),
i_ty
pe
=1
,n_
typ
e)
rea
d(1
0,2
02
)(v
ash
_B
(i_
typ
e),
i_ty
pe
=1,n
_ty
pe
)re
ad
(10
,20
2)
(va
sh_
l(i_
typ
e),
i_ty
pe
=1,n
_ty
pe
)re
ad
(10
,20
2)
(va
sh_
cth
eta
(i_
typ
e),
i_ty
pe
=1
,n_
typ
e)
rea
d(1
0,2
02
)(v
ash
_r0
(i_
typ
e),
i_ty
pe
=1
,n_
typ
e)
rea
d(1
0,2
00)
cha
r_d
um
my
rea
d(1
0,2
02
)a
lph
a,
v_cu
t
rea
d(1
0,2
00)
cha
r_d
um
my
do
i_ty
pe
=1
,n_
typ
ere
ad
(10
,20
2)
(r_
skin
(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
o
en
dif
!i_
du
mm
ycl
ose
(10
)e
lse
!i_ru
ntk
=tk
-0
.25
en
dif
!i_ru
n
alp
ha
_p
refa
c=
2*a
lph
a/s
qrt
(pi)
r_cu
toff(1
,1)
=3
./a
lph
ar_
cuto
ff(2
,2)
=3
./a
lph
ar_
cuto
ff(2
,1)
=3
./a
lph
ar_
cuto
ff(1
,2)
=r_
cuto
ff(2
,1)
!if
(r_
cuto
ff(1
,1).
lt.r_
cut_
short
)!
&st
op
"cu
to
ffto
osm
all
for
sho
rtra
ng
e"
q_
cut_
2=
(6.*
alp
ha
)**2
!---
an
yp
ea
k|f(k
|ˆ2
ino
rde
r1
/sq
rt(N
)g
ets
cut
off
r_cu
toff_
ma
x=
0.0
do
i_ty
pe
=1,n
_ty
pe
do
j_ty
pe
=1,n
_ty
pe
r_cu
toff_
max
=m
ax(
r_cu
toff_
ma
x,r_
cuto
ff(i_
typ
e,j_
typ
e))
en
dd
oe
nd
do
do
i_ty
pe
=1,n
_ty
pe
do
j_ty
pe
=1,n
_ty
pe
r_cu
toff_
2(i_
typ
e,j_
typ
e)
=r_
cuto
ff(i_
typ
e,j_
typ
e)*
*2r_
ran
ge
(i_
typ
e,j_
typ
e)
=r_
cuto
ff(i_
typ
e,j_
typ
e)
+&
r_sk
in(i_ty
pe
,j_ty
pe
)r_
ran
ge
_2
(i_
typ
e,j_
typ
e)
=r_
ran
ge
(i_
typ
e,j_
typ
e)*
*2e
nd
do
en
dd
o
!---
de
fine
shift
sin
en
erg
y
do
i_ty
pe
=1,n
_ty
pe
do
j_ty
pe
=1,n
_ty
pe
!---
-e
lect
rost
atic
e_
shift
(i_
typ
e,j_
typ
e)
=e
rfcc
(alp
ha
*r_
cuto
ff(i_
typ
e,j_
typ
e))
*&
ele
c_p
refa
c/r_
cuto
ff(i_
typ
e,j_
typ
e)
po
t_lo
c=
r_cu
t_sh
ort
**(v
ash
_e
ta(i_ty
pe
,j_ty
pe
))p
ot_
loc
=va
sh_
h(i_
typ
e,j_
typ
e)/
po
t_lo
ce
xp_
po
t=
0.5
*(va
sh_
alp
ha
(i_
typ
e)*
con
sta
nt_
cha
rge
(j_
typ
e)*
*2&
+va
sh_
alp
ha
(j_
typ
e)*
con
sta
nt_
cha
rge
(i_
typ
e)*
*2)
exp
_p
ot
=exp
_p
ot/(r
_cu
t_sh
ort
**4
)e
xp_
po
t=
exp
_p
ot
*e
xp(-
r_cu
t_sh
ort
/4.4
3d
0)
e_
shift
_sh
ort
(i_
typ
e,j_
typ
e)
=p
ot_
loc
-e
xp_
po
te
nd
do
en
dd
o!-
---
tabu
late
po
ten
tial
v(r)
an
dd
v/d
rd
oi_
typ
e=
1,n
_ty
pe
do
j_ty
pe
=1,n
_ty
pe
do
i_p
ote
ntia
l=
1,n
_p
ote
ntia
lr_
1=
i_p
ote
ntia
l*r_
ran
ge
(i_
typ
e,j_
typ
e)/
n_
po
ten
tial
r_2
=r_
1**
2!-
----
-cu
toff
at
sho
rtra
ng
ein
tera
ctio
nif(
r_1
.le.r
_cu
t_sh
ort
)th
en
po
t_lo
c=
r_1
**(v
ash
_e
ta(i_
typ
e,j_
typ
e))
po
t_lo
c=
vash
_h
(i_
typ
e,j_
typ
e)/
po
t_lo
ce
xp_
po
t=
0.5
*(va
sh_
alp
ha
(i_
typ
e)*
con
sta
nt_
cha
rge
(j_
typ
e)*
*2&
+va
sh_
alp
ha
(j_
typ
e)*
con
sta
nt_
cha
rge
(i_
typ
e)*
*2)
exp
_p
ot
=e
xp_
po
t/(r
_1
**4
)e
xp_
po
t=
exp
_p
ot
*e
xp(-
r_1
/4.4
3d
0)
r_p
ot_
1(i_
type
,j_ty
pe
,i_p
ote
ntia
l)=
po
t_lo
c-
exp
_p
ot
&-e
_sh
ift_
sho
rt(i_
typ
e,j_
typ
e)
els
e r_p
ot_
1(i_
type
,j_ty
pe
,i_p
ote
ntia
l)=
0.d
0e
nd
if
if(r
_1
.le.r
_cu
toff(i_
typ
e,j_
typ
e))
the
nr_
po
t_2
(i_
type
,j_ty
pe
,i_p
ote
ntia
l)=
-e_
shift
(i_
typ
e,j_
typ
e)
&+
erf
cc(a
lph
a*r
_1
)*e
lec_
pre
fac/
r_1
els
e r_p
ot_
2(i_
type
,j_ty
pe
,i_p
ote
ntia
l)=
0.d
0e
nd
if
!r_
po
t_d
_2
(i_
typ
e,j_
typ
e,i_
po
ten
tial)
=-(
1./r_
2)
*(v
_co
ulo
mb
+!
&e
lec_
pre
fac*
alp
ha
_p
refa
c*e
xp(-
(alp
ha
*r_
1)*
*2))
en
dd
oe
nd
do
en
dd
o
do
i_p
ote
ntia
l=
2,
n_
po
ten
tial-1
do
i_ty
pe
=1
,n
_ty
pe
do
j_ty
pe
=1
,n
_ty
pe
r_1
=i_
po
ten
tial*
r_ra
ng
e(i_
typ
e,j_
typ
e)/
n_
po
ten
tial
r_p
ot_
d_
1(i_
typ
e,j_
typ
e,i_
po
ten
tial)=
1./r_
1*
&(r
_p
ot_
1(i_
typ
e,j_
typ
e,i_
po
ten
tial+
1)-
&r_
po
t_1
(i_
typ
e,j_
typ
e,i_
po
ten
tial-1
))/
&(2
.*r_
ran
ge
(i_
typ
e,j_
typ
e)/
n_
po
ten
tial)
r_p
ot_
d_
2(i_
typ
e,j_
typ
e,i_
po
ten
tial)=
1./r_
1*
&(r
_p
ot_
2(i_
typ
e,j_
typ
e,i_
po
ten
tial+
1)-
&r_
po
t_2
(i_
typ
e,j_
typ
e,i_
po
ten
tial-1
))/
&(2
.*r_
ran
ge
(i_
typ
e,j_
typ
e)/
n_
po
ten
tial)
en
dd
o
95
B. Programse
nd
do
en
dd
o
do
i_p
ote
ntia
l=
-n_
po
ten
tial,n
_p
ote
ntia
lr_
du
mm
y=
i_p
ote
ntia
l*2
*pi/n
_p
ote
ntia
lc_
du
mm
y=
r_d
um
my
*(0
.,1
.)ta
b_
exp
_im
a(i_
po
ten
tial)
=e
xp(c
_d
um
my)
en
dd
o
!**
****
****
****
f_p
ote
ntia
l9
(Sca
nd
olo
)
els
eif
(f_
po
ten
tial.e
q.9
)th
en
if(f
_ch
arg
ea
dju
st.n
e.1
)th
en
sto
p"S
can
do
lop
ote
ntia
ld
oe
sn
ot
wo
rkw
ithva
ria
ble
cha
rge
"e
nd
if
if(n
_tr
ot.ne
.1)
the
nst
op
"Sca
nd
olo
po
ten
tial
do
es
no
tw
ork
with
n_
tro
tte
r>
1"
en
dif
if(i_
run
.eq.1
)th
en
op
en
(10
,fil
e=
"pim
d.in
p",
sta
tus=
"old
")re
ad
(10
,21
0)
i_d
um
my,
cha
r_d
um
my
if(i_
du
mm
y.e
q.0
)th
en
!---
-ta
ked
efa
ult
pa
ram
ete
rsn
_re
lax
=5
0n
_o
bse
r=
50
n_
safe
=1
00
ise
ed
=4
75
91
+2
*in
t(n
_p
art
/2)+
2*i
nt(
10
*tk)
+n
_tr
ot
jse
ed
=is
ee
d
n_
rela
x=
0n
_o
bse
r=
0n
_sa
fe=
0!-
---
silic
ium
ma
ss(0
,1)
=2
8.1
*ma
ss_
am
u!-
---
oxy
ge
nm
ass
(0,2
)=
16
.0*m
ass
_a
mu
alp
ha
=0
.3*
(10
02
./n
_p
art
)**(
1./6
)a
lph
a=
0.3
v_cu
t=
0.0
1*e
lec_
pre
fac*
(1.2
*2.4
)/1
.6/s
qrt
(1.*
n_
pa
rt)
f_o
pt_
rec
=0
do
i_ty
pe
=1
,n_
typ
ed
oj_
typ
e=
1,n
_ty
pe
r_sk
in(i_
typ
e,j_
typ
e)
=0
.45
en
dd
oe
nd
do
tk=
36
00
./n
_tr
ot
!--
--tim
est
ep
=1
fsd
t=
1.3
09
1e
-4f_
pre
ssu
re=
1p
ress
=.0
if(n
_o
rde
r.e
q.2
)th
en
!---
-ch
eck
en
erg
yco
nse
rva
tion
fric
tion
(1)
=0
.fr
ic_
bo
x=
0.
dt
=d
t/2
els
e
fric
tion
(1)
=0
.01
/d
tfr
ic_
bo
x=
0.0
1/
dt
en
dif
fric
tion
(2)
=fr
ictio
n(1
)!-
--d
efin
ein
ert
iafo
rb
ox
de
form
atio
nm
ass
_b
ox
=(n
_si
lic*m
ass
(0,1
)+
n_
oxy
*ma
ss(0
,2))
/1
2m
ass
_b
ox
=m
ass
_b
ox
/8
els
e!
i_d
um
my
if(i_
du
mm
y.n
e.f_
po
ten
tial)
&st
op
"f_
po
ten
tial
an
dp
imd
.inp
mis
ma
tch
"re
ad
(10
,21
0)
i_d
um
my,
cha
r_d
um
my
if(i_
du
mm
y.n
e.f_
cha
rge
ad
just
)&
sto
p"f
_ch
arg
ea
dju
sta
nd
pim
d.in
pm
ism
atc
h"
rea
d(1
0,2
10
)n
_re
lax
rea
d(1
0,2
10
)n
_o
bse
rre
ad
(10
,21
0)
n_
safe
rea
d(1
0,2
10
)is
ee
dre
ad
(10
,20
0)
cha
r_d
um
my
rea
d(1
0,2
01
)d
tre
ad
(10
,20
1)
tkre
ad
(10
,20
0)
cha
r_d
um
my
rea
d(1
0,2
02
)(m
ass
(0,i_
typ
e),
i_ty
pe
=1,n
_ty
pe
)re
ad
(10
,20
2)
(frict
ion
(i_
typ
e),
i_ty
pe=
1,n
_ty
pe
)re
ad
(10
,20
2)
ma
ss_
bo
x,fr
ic_
bo
x
rea
d(1
0,2
00
)ch
ar_
du
mm
yre
ad
(10
,20
1)
pre
ssre
ad
(10
,21
0)
f_p
ress
ure
rea
d(1
0,2
00
)ch
ar_
du
mm
yre
ad
(10
,20
0)
cha
r_d
um
my
rea
d(1
0,2
00
)ch
ar_
du
mm
yre
ad
(10
,20
0)
cha
r_d
um
my
rea
d(1
0,2
02
)a
lph
a,
v_cu
t
rea
d(1
0,2
00
)ch
ar_
du
mm
yd
oi_
typ
e=
1,n
_ty
pe
rea
d(1
0,2
02
)(r
_sk
in(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e)
en
dd
o
en
dif
!i_
du
mm
ycl
ose
(10
)e
lse
!i_ru
ntk
=tk
-0
.25
en
dif
!i_ru
n
alp
ha
_p
refa
c=
2*a
lph
a/s
qrt
(pi)
r_cu
toff(1
,1)
=3
./a
lph
ar_
cuto
ff(2
,2)
=3
./a
lph
ar_
cuto
ff(2
,1)
=3
./a
lph
ar_
cuto
ff(1
,2)
=r_
cuto
ff(2
,1)
!if
(r_
cuto
ff(1
,1).
lt.r_
cut_
sho
rt)
!&
sto
p"c
ut
off
too
sma
llfo
rsh
ort
ran
ge
"q
_cu
t_2
=(6
.*a
lph
a)*
*2!-
--a
ny
pea
k|f(k
|ˆ2
ino
rde
r1
/sqrt
(N)
ge
tscu
to
ff
r_cu
toff_
ma
x=
0.0
do
i_ty
pe
=1
,n_
typ
ed
oj_
typ
e=
1,n
_ty
pe
r_cu
toff_
ma
x=
ma
x(r_
cuto
ff_
ma
x,r_
cuto
ff(i_
typ
e,j_
typ
e))
96
B.1. Molecular Dynamics Code
en
dd
oe
nd
do
do
i_ty
pe
=1,n
_ty
pe
do
j_ty
pe
=1,n
_ty
pe
r_cu
toff_
2(i_
typ
e,j_
typ
e)
=r_
cuto
ff(i_
typ
e,j_
typ
e)*
*2r_
ran
ge
(i_
typ
e,j_
typ
e)
=r_
cuto
ff(i_ty
pe
,j_ty
pe
)+
&r_
skin
(i_ty
pe
,j_ty
pe
)r_
ran
ge
_2
(i_
typ
e,j_
typ
e)
=r_
ran
ge
(i_
typ
e,j_
typ
e)*
*2e
nd
do
en
dd
o
n_
pb
c=1
do
i_d
im=
1,
n_
dim
if((
int(
r_cu
toff_
ma
x/sc
al_
0(i_
dim
))+
1).
gt.n
_p
bc)
the
nn
_p
bc=
(in
t(r_
cuto
ff_
ma
x/sc
al_
0(i_
dim
))+
1)
en
dif
en
dd
o
!p
ote
ntia
lis
calc
ula
ted
inp
au
lta
ngn
eys
rou
tine
els
e sto
P"f
_p
ote
ntia
lfla
gg
ma
kes
no
sen
se"
en
dif
!**
****
****
****
all
valu
es
f_p
ote
ntia
l
if(i_
run
.eq
.1)
ma
ss_
bo
x=
n_
tro
t*
ma
ss_
bo
x
jse
ed
=is
ee
dif
(f_
po
ten
tial.e
q.1
)f_
pre
ssu
re=
0
dt
=d
t/n
_tim
e_sc
al
dt_
2=
dt*
*2tk
p=
tk*n
_tr
ot
sqrt
p=
sqrt
(rea
l(n
_tr
ot)
)b
eta
=1
.d0
/tk
be
tap
=1
.d0
/tkp
do
i_ty
pe
=1
,n_
typ
ek_
qu
an
t(i_
type
)=
ma
ss(0
,i_ty
pe
)/b
eta
p**
2!-
---
sprin
gco
nst
an
tin
reci
pro
cal
spa
ced
oi_
tro
t=
0,n
_tr
ot-
1k_
eig
en
(i_
tro
t,i_
typ
e)
=4
*k_
qu
an
t(i_
typ
e)
&*s
in(i_
tro
t*p
i/n_
tro
t)**
2e
nd
do
v_th
erm
(0,i_
typ
e)
=sq
rt(t
kp/m
ass
(0,i_
typ
e))
w_
the
rm=
sqrt
(tkp
/ma
ss_
bo
x)!-
---
fictic
iuo
sm
ass
es
do
i_tr
ot
=1,n
_tr
ot-
1if(
f_p
ote
ntia
l.eq
.1)
the
nm
ass
(i_
tro
t,i_
typ
e)
=m
ass
(0,i_
typ
e)*
&(1
.+k_
eig
en
(i_
tro
t,i_
typ
e))
ma
ss(i_
tro
t,i_
typ
e)
=m
ass
(i_
tro
t,i_
typ
e)
/n
_tim
e_
sca
l**2
els
eif
(f_p
ote
ntia
l.eq
.2)
the
nm
ass
(i_
tro
t,i_
typ
e)
=m
ass
(0,i_
typ
e)*
&(2
56
*ep
sil(i_
typ
e,i_
typ
e)/
sig
ma
(i_
typ
e,i_
typ
e)*
*2&
+k_
eig
en(i_
tro
t,i_
typ
e))
/&
(25
6*e
psi
l(i_
typ
e,i_
typ
e)/
sig
ma
(i_
typ
e,i_
typ
e)*
*2)
ma
ss(i_
tro
t,i_
typ
e)
=m
ass
(i_
tro
t,i_
typ
e)
/n
_tim
e_
sca
l**2
els
eif
(f_
pote
ntia
l.eq
.3)
the
nm
ass
(i_
tro
t,i_
typ
e)
=m
ass
(0,i_
typ
e)*
&(1
.25
e6
+k_
eig
en
(i_
tro
t,i_
typ
e))
/1.2
5e
6m
ass
(i_
tro
t,i_
typ
e)
=m
ass
(i_
tro
t,i_
type
)/
n_
time
_sc
al*
*2e
lse
if(f
_p
ote
ntia
l.eq
.4)
the
nm
ass
(i_
tro
t,i_
typ
e)
=m
ass
(0,i_
typ
e)*
&(4
25
.73
3+
k_e
ige
n(i_
tro
t,i_
typ
e))
/4
25
.73
3m
ass
(i_
tro
t,i_
typ
e)
=m
ass
(i_
tro
t,i_
type
)/
n_
time
_sc
al*
*2e
lse
if((
f_po
ten
tial.g
e.5
).a
nd
.(f_
pote
ntia
l.le
.8))
the
nm
ass
(i_
tro
t,i_
typ
e)
=m
ass
(0,i_
typ
e)*
&(1
.25
e6
+k_
eig
en
(i_
tro
t,i_
typ
e))
/1
.25
e6
ma
ss(i_
tro
t,i_
typ
e)
=m
ass
(i_
tro
t,i_
type
)/
n_
time
_sc
al*
*2e
nd
ifv_
the
rm(i_
tro
t,i_
typ
e)
=sq
rt(t
kp/m
ass
(i_
tro
t,i_
typ
e))
en
dd
o!-
---
wid
tho
fG
au
ssia
nd
istr
ibu
ted
no
ise
do
i_tr
ot
=0
,n_
tro
t-1
rf_
wid
th(i_
tro
t,i_
typ
e)
=&
sqrt
(2*t
kp*m
ass
(i_
tro
t,i_
typ
e)*
fric
tion
(i_
typ
e)/
dt)
!---
-lin
ea
rb
lock
dis
trib
utio
nrf
_w
idth
(i_
tro
t,i_
typ
e)
=sq
rt3
*rf_
wid
th(i_
tro
t,i_
typ
e)
if(m
od
(2*i
_tr
ot,n
_tr
ot)
.ne
.0)
the
nrf
_w
idth
(i_
tro
t,i_
typ
e)
=rf
_w
idth
(i_
tro
t,i_
typ
e)/
sqrt
2e
nd
ife
nd
do
en
dd
orf
b_
wid
th=
sqrt
(2
*tkp
*ma
ss_
bo
x*fr
ic_
bo
x/d
t)
rfb
_w
idth
=sq
rt3
*rf
b_
wid
th
!---
initi
aliz
ep
red
icto
rco
effic
ien
tsd
oi_
ord
er
=0
,n_
ord
er_
ma
x-1
do
j_o
rde
r=
0,n
_o
rde
r_m
ax
pre
d_
coe
f(i_
ord
er,
j_o
rde
r)=
0.
en
dd
op
red
_co
ef(
0,i_
ord
er+
1)
=1
.if(
i_o
rde
r.g
e.1
)p
red
_co
ef(
1,i_
ord
er+
1)
=i_
ord
er+
1p
red
_co
ef(
i_o
rde
r,i_
ord
er)
=1
.e
nd
do
pre
d_
coe
f(2
,3)
=3
.p
red
_co
ef(
2,4
)=
6.
pre
d_
coe
f(2
,5)
=1
0.
pre
d_
coe
f(3
,4)
=4
.p
red
_co
ef(
3,5
)=
10
.p
red
_co
ef(
4,5
)=
5.
do
i_o
rde
r=
0,n
_o
rde
r-1
do
j_o
rde
r=
0,n
_o
rde
rp
red
ict_
coe
f(i_
ord
er,
j_o
rde
r)=
0.
en
dd
od
oj_
ord
er
=i_
ord
er,
n_
ord
er
pre
dic
t_co
ef(
i_o
rde
r,j_
ord
er)
=p
red
_co
ef(
i_o
rde
r,j_
ord
er)
en
dd
oe
nd
do
!---
initi
aliz
eco
rre
cto
rd
oi_
ord
er
=1
,n_
ord
er
corr
_co
ef(
i_o
rde
r)=
0.
en
dd
oi_
ord
er
=n
_o
rde
rif(
i_o
rde
r.eq
.2)
the
n!-
---
velo
city
Ve
rle
ta
lgo
rith
mco
rr_
coe
f(0
)=
0.
corr
_co
ef(
1)
=1
.
97
B. Programse
lse
if(i_
ord
er.
eq
.3)
the
nco
rr_
coe
f(0
)=
1./6
corr
_co
ef(
1)
=5
./6
corr
_co
ef(
3)
=1
./3
els
eif
(i_
ord
er.
eq
.4)
the
nco
rr_
coe
f(0
)=
19
./9
0!
corr
_co
ef(
0)
=1
9./1
20
on
lyif
the
rmo
sta
ta
bse
nt
corr
_co
ef(
1)
=3
./4
corr
_co
ef(
3)
=1
./2
corr
_co
ef(
4)
=1
./1
2e
lse
if(i_
ord
er.
eq
.5)
the
nco
rr_
coe
f(0
)=
3./1
6!
corr
_co
ef(
0)
=3
./2
0o
nly
ifth
erm
ost
at
ab
sen
tco
rr_
coe
f(1
)=
25
1./3
60
corr
_co
ef(
3)
=1
1./1
8co
rr_
coe
f(4
)=
1./6
corr
_co
ef(
5)
=1
./6
0e
lse
sto
P’O
rde
rfo
rp
red
icto
rco
rre
cto
ru
nava
ilab
le’
en
dif
corr
_co
ef(
2)
=1
.d
oi_
ord
er
=0
,n_
ord
er
corr
ect
_co
ef(
i_o
rde
r)=
corr
_co
ef(
i_o
rde
r)e
nd
do
if(i_
run
.eq
.1)
the
n!-
---
initi
aliz
era
nd
om
nu
mb
er
ge
nera
tor
kptr
=1
call
inr2
50
(mz,
ise
ed
,kp
tr)
if(n
_ru
n.g
t.1
)th
en
n_
rela
x=
1*n
_re
lax
en
dif
els
eif(
n_
rela
x.e
q.2
)th
en
n_
rela
x=
n_
rela
x/1
en
dif
20
0fo
rma
t(a
)2
10
form
at(
1i1
4,a
)2
20
form
at(
2i1
4,a
)2
01
form
at(
1e
14
.6,a
)2
02
form
at(
2e
14
.6,a
)2
03
form
at(
3e
14
.6,a
)
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
do
ub
lep
reci
sio
nfu
nct
ion
sla
terin
t(i_
typ
e_
sl,j_
typ
e_
sl,r
_1
_sl
)im
plic
itn
one
incl
ud
e"p
imd
.co
m.f"
do
ub
lep
reci
sio
nr_
1_
slin
teg
er
i_ty
pe
_sl
,j_
typ
e_
sld
ou
ble
pre
cisi
on
ate
mp
,b
tem
pin
teg
er
bin
om
ial,
fact
oria
lin
teg
er
v,k,
ld
ou
ble
pre
cisi
on
sum
1,
sum
2,
sum
21
,su
m2
2
if(r
_1
_sl
.gt.1
e-8
)th
en
sum
1=
0d
ov
=0
,2
*msn
(i_
typ
e_
sl)-
1su
m1
=su
m1
+b
ino
mia
l(2
*msn
(i_
typ
e_
sl)-
1,v
)*&
ate
mp(2
*msn
(i_
typ
e_
sl)-
1-v
,1.d
0*
&m
sze
ta(i_
typ
e_
sl,j_
typ
e_
sl)*
r_1
_sl
)*&
bte
mp
(v,1
.d0
*msz
eta
(i_
typ
e_sl
,j_ty
pe
_sl
)*r_
1_
sl)
en
dd
osu
m1
=(r
_1
_sl
/2)*
*(2
*msn
(i_
typ
e_
sl))
*sum
1su
m2
=0
do
v=
1,
2*m
sn(j_
typ
e_
sl)
sum
22
=0
do
k=
0,
2*m
sn(i_
typ
e_
sl)-
1su
m2
1=
0d
ol
=0
,2*m
sn(j_
typ
e_
sl)-
vsu
m2
1=
sum
21
+bin
om
ial(2
*msn
(j_
typ
e_
sl)-
v,l)*(
-1)*
*l*
&a
tem
p(2
*msn
(i_
typ
e_
sl)+
2*m
sn(j_
typ
e_
sl)-
k-v-
l-1
,&
1.d
0*(
msz
eta
(i_
typ
e_
sl,j_
typ
e_
sl)
&+
msz
eta
(j_
typ
e_
sl,i_
typ
e_
sl))
*r_
1_
sl)*
&b
tem
p(k
+l,1
.d0
*(m
sze
ta(i_
typ
e_
sl,j_
typ
e_
sl)
&-m
sze
ta(j_
typ
e_
sl,i_
typ
e_
sl))
*r_
1_
sl)
en
dd
osu
m2
2=
sum
22+
sum
21
*bin
om
ial(2
*msn
(i_ty
pe
_sl
)-1
,k)
en
dd
osu
m2
2=
sum
22
r_d
um
my=
(r_
1_
sl/2
)**(
2*m
sn(i_
typ
e_
sl)+
2*m
sn(j_
typ
e_
sl)-
v)r_
du
mm
y=r_
dum
my*
v*(2
*&
msz
eta
(j_
typ
e_
sl,i_
typ
e_
sl))
**(2
*msn
(j_
typ
e_
sl)-
v)r_
du
mm
y=r_
du
mm
y/(f
act
oria
l(2
*msn
(j_
typ
e_
sl)-
v)*2
*msn
(j_
typ
e_
sl))
sum
2=
sum
2+
r_d
um
my*
sum
22
en
dd
o
r_d
um
my=
0.5
*(2*m
sze
ta(i_
typ
e_
sl,j_
typ
e_sl
))**
(2*m
sn(i_
typ
e_
sl)+
1)
r_d
um
my=
r_d
um
my/
fact
oria
l(2
*msn
(i_
typ
e_sl
))sl
ate
rin
t=r_
dum
my*
(su
m1
-su
m2
)
els
e!
spe
cia
lca
ser=
0
sum
2=
0
do
v=
1,
2*m
sn(j_
typ
e_
sl)
r_d
um
my=
(2.0
*(m
sze
ta(i_
typ
e_
sl,j_
typ
e_
sl)
&+
msz
eta
(j_
typ
e_
sl,i_
typ
e_
sl))
)**
&(2
*msn
(i_
type
_sl
)+2
*msn
(j_
typ
e_
sl)-
v)su
m2
1=
1.0
*fa
cto
ria
l(2
*msn
(i_
typ
e_
sl)+
2*m
sn(j_
typ
e_
sl)-
v-1
)/&
r_d
um
my
sum
21
=su
m2
1*v
*((2
*msz
eta
(j_
typ
e_
sl,i_
typ
e_
sl))
**&
(2*m
sn(j_
typ
e_
sl)-
v))/
&(f
act
oria
l(2
*msn
(j_
typ
e_
sl)-
v)*2
*msn
(j_
typ
e_
sl))
sum
2=
sum
2+
sum
21
en
dd
o
r_d
um
my=
(2.0
*msz
eta
(i_
typ
e_
sl,j_
typ
e_
sl))
**(2
*msn
(i_
typ
e_
sl)+
1)
r_d
um
my=
r_d
um
my*
1.0
/(fa
cto
ria
l(2
*msn
(i_ty
pe
_sl
)))
sla
terin
t=-r
_du
mm
y*su
m2
+m
sze
ta(i_
typ
e_
sl,j_
typ
e_
sl)/
msn
(i_
typ
e_sl
)
en
dif
en
dfu
nct
ion
!---
----
----
----
----
----
----
----
----
----
-
do
ub
lep
reci
sio
nfu
nct
ion
sla
terin
t_d
(i_
typ
e_
sl,j_
typ
e_
sl,r
_1
_sl
)im
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
98
B.1. Molecular Dynamics Code
do
ub
lep
reci
sion
r_1
_sl
inte
ge
ri_
typ
e_sl
,j_
typ
e_
sld
ou
ble
pre
cisi
on
ate
mp
,b
tem
pin
teg
er
bin
om
ial,
fact
oria
lin
teg
er
v,k,
ld
ou
ble
pre
cisi
on
sum
1,
sum
2,
sum
21
,su
m2
2,
sum
21
1
sum
1=
0d
ov
=0
,2
*msn
(i_
typ
e_
sl)-
1su
m1
=su
m1
+b
ino
mia
l(2
*msn
(i_
typ
e_
sl)-
1,v
)*&
(m
sn(i_
typ
e_
sl)*
&a
tem
p(2
*msn
(i_
typ
e_
sl)-
1-v
,1.d
0&
*msz
eta
(i_
typ
e_
sl,j_
typ
e_sl
)*r_
1_
sl)*
&b
tem
p(v
,1.d
0*m
sze
ta(i_
typ
e_
sl,j_
typ
e_
sl)*
r_1
_sl
)&
-r_
1_
sl/2
*msz
eta
(i_
typ
e_
sl,j_
typ
e_
sl)*
&a
tem
p(2
*msn
(i_
typ
e_
sl)-
v,1
.d0
&*m
sze
ta(i_
typ
e_
sl,j_
typ
e_
sl)*
r_1
_sl
)*&
bte
mp
(v,1
.d0
*msz
eta
(i_
typ
e_
sl,j_
typ
e_
sl)*
r_1
_sl
)&
-r_
1_
sl/2
*msz
eta
(i_
typ
e_
sl,j_
typ
e_
sl)*
&a
tem
p(2
*msn
(i_
typ
e_
sl)-
1-v
,&
1.d
0*m
sze
ta(i_
typ
e_
sl,j_
typ
e_
sl)*
r_1
_sl
)*&
bte
mp
(v+
1,1
.d0
*msz
eta
(i_
typ
e_
sl,j_
typ
e_
sl)*
r_1
_sl
))
en
dd
osu
m1
=(r
_1
_sl
/2)*
*(2
*msn
(i_
typ
e_
sl)-
1)*
sum
1su
m2
=0
do
v=
1,
2*m
sn(j_
typ
e_
sl)
sum
22
=0
do
k=
0,
2*m
sn(i_
typ
e_
sl)-
1su
m2
1=
0d
ol
=0
,2
*msn
(j_
typ
e_
sl)-
vsu
m2
11
=(m
sn(i_
typ
e_
sl)+
msn
(j_
typ
e_
sl)-
0.5
*v)*
&a
tem
p(2
*msn
(i_
typ
e_
sl)+
2*m
sn(j_
typ
e_
sl)-
k-v-
l-1,
&1
.d0
*(m
sze
ta(i_
typ
e_
sl,j_
typ
e_
sl)
&+
msz
eta
(j_ty
pe
_sl
,i_ty
pe
_sl
))*r
_1
_sl
)*&
bte
mp
(k+
l,&
1.d
0*(
msz
eta
(i_
typ
e_
sl,j_
typ
e_
sl)
&-m
sze
ta(j_
typ
e_
sl,i_
typ
e_
sl))
*r_
1_
sl)
sum
21
1=
sum
211
-.5
d0
*(m
sze
ta(i_
typ
e_
sl,j_
typ
e_
sl)
&+
msz
eta
(j_
typ
e_
sl,i_
typ
e_
sl))
*r_
1_
sl*
&a
tem
p(2
*msn
(i_
typ
e_
sl)+
2*m
sn(j_
typ
e_
sl)-
k-v-
l,&
1.d
0*(
msz
eta
(i_
typ
e_
sl,j_
typ
e_
sl)
&+
msz
eta
(j_
typ
e_
sl,i_
typ
e_
sl))
*r_
1_
sl)*
&b
tem
p(k
+l,
&1
.d0
*(m
sze
ta(i_
typ
e_
sl,j_
typ
e_
sl)
&-m
sze
ta(j_
typ
e_
sl,i_
typ
e_
sl))
*r_1
_sl
)su
m2
11
=su
m2
11
-.5
d0
*(m
sze
ta(i_
typ
e_
sl,j_
typ
e_
sl)
&-m
sze
ta(j_
typ
e_
sl,i_
typ
e_
sl))
*r_
1_
sl*
&a
tem
p(2
*msn
(i_
typ
e_
sl)+
2*m
sn(j_
typ
e_
sl)-
k-v-
l-1,
&1
.d0
*(m
sze
ta(i_
typ
e_
sl,j_
typ
e_
sl)
&+
msz
eta
(j_
typ
e_
sl,i_
typ
e_
sl))
*r_1
_sl
)*&
bte
mp
(k+
l+1
,&
1.d
0*(
msz
eta
(i_
typ
e_
sl,j_
typ
e_
sl)
&-m
sze
ta(j_
typ
e_
sl,i_
typ
e_
sl))
*r_1
_sl
)su
m2
1=
sum
21
+b
ino
mia
l(2
*msn
(j_
typ
e_
sl)-
v,l)*(
-1)*
*l&
*su
m2
11
en
dd
osu
m2
2=
sum
22
+su
m2
1*b
ino
mia
l(2
*msn
(i_
typ
e_
sl)-
1,k
)e
nd
do
sum
22
=su
m2
2r_
du
mm
y=(r
_1
_sl
/2)*
*(2
*msn
(i_
typ
e_
sl)+
2*m
sn(j_
typ
e_
sl)-
v-1
)r_
du
mm
y=r_
du
mm
y*v*
&(2
*msz
eta
(j_
typ
e_
sl,i_
typ
e_
sl))
**(2
*msn
(j_
typ
e_sl
)-v)
r_d
um
my=
r_d
um
my/
(fa
cto
ria
l(2
*msn
(j_
typ
e_
sl)-
v)*2
*msn
(j_
typ
e_
sl))
sum
2=
sum
2+
r_d
um
my*
sum
22
en
dd
o
r_d
um
my=
0.5
*(2
*msz
eta
(i_
typ
e_
sl,j_
type
_sl
))**
(2*m
sn(i_
typ
e_
sl)+
1)
r_d
um
my=
r_d
um
my/
fact
oria
l(2
*msn
(i_
type
_sl
))sl
ate
rin
t_d
=r_
du
mm
y*(s
um
1-s
um
2)
en
dfu
nct
ion
!---
----
----
----
----
----
----
----
----
----
-
inte
ge
rfu
nct
ion
fact
oria
l(k)
imp
licit
no
ne
inte
ge
rk
inte
ge
ri,f
ac
fac=
1d
oi=
1,
kfa
c=fa
c*i
en
dd
ofa
cto
ria
l=fa
ce
nd
fun
ctio
n
!---
----
----
----
----
----
----
----
----
----
-
inte
ge
rfu
nct
ion
bin
om
ial(n
,l)im
plic
itn
on
ein
teg
er
fact
oria
l
inte
ge
rn
,lin
teg
er
de
no
m,n
um
,id
en
om
=1
nu
m=
1d
oi=
1,l
de
no
m=
de
no
m*i
nu
m=
nu
m*(
n-i+
1)
en
dd
ob
ino
mia
l=n
um
/de
no
me
nd
fun
ctio
n
!---
----
----
----
----
----
----
----
----
----
-
do
ub
lep
reci
sio
nfu
nct
ion
ate
mp
(k,x
)im
plic
itn
on
ein
teg
er
fact
oria
l
inte
ge
rk
do
ub
lep
reci
sio
nx
do
ub
lep
reci
sio
nsu
m1
inte
ge
rv
sum
1=
0d
ov=
0,
ksu
m1
=su
m1
+x*
*v/fa
cto
ria
l(v)
en
dd
oa
tem
p=
exp
(-x)
*fa
cto
ria
l(k)
/(x*
*(k+
1))
*su
m1
en
dfu
nct
ion
!---
----
----
----
----
----
----
----
----
----
-
do
ub
lep
reci
sio
nfu
nct
ion
bte
mp
(k,x
)im
plic
itn
on
ein
teg
er
fact
oria
l,k,
vd
ou
ble
pre
cisi
on
ate
mp
,x,
sum
1,
sum
1b
,a
t,fr
ac
99
B. Programsif
(ab
s(x)
.gt.1
e-9
)th
en
sum
1=
0.d
0if
(mo
d(k
,2).
eq.0
)th
en
fra
c=1
.d0
do
v=0
,1
00
00
sum
1b
=2
.d0
*fra
c/(k
+(2
.d0
*v)+
1.d
0)
fra
c=fr
ac*
(x**
2)/
((2
.d0
*v+
1.d
0)*
(2.d
0*v
+2
.d0
))su
m1
=su
m1
+su
m1
be
nd
do
els
e fra
c=-x
do
v=0
,1
00
00
sum
1b
=2
.d0
*fra
c/(k
+(2
.d0
*v+
1.d
0)+
1.d
0)
fra
c=fr
ac*
(x**
2)/
((2
.d0
*v+
2.d
0)*
(2.d
0*v
+3
.d0
))su
m1
=su
m1
+su
m1
be
nd
do
en
dif
bte
mp
=su
m1
els
e bte
mp
=1
.d0
*(1
-(-1
)**(
k+1
))/(
k+1
.d0
)e
nd
if
en
dfu
nct
ion
!!
!!
!!
!!
!!
!
sub
rou
tine
azi
z_lo
cal(r,
azi
z)im
plic
itn
one
!---
Le
nn
ard
Jon
es
as
che
ck!
rea
lr
!re
al
ep
s,si
g!
do
ub
lep
reci
sio
nv_
po
t!
ep
s=
10
.22
!si
g=
2.5
56
!v_
po
t=
4*e
ps
*(s
ig/r
)**6
*((
sig
/r)*
*6-1
.)!-
--tr
ue
azi
zp
ote
ntia
ld
ou
ble
pre
cisi
on
azi
zd
ou
ble
pre
cisi
on
r,x,
ep
s,rm
,d
,pre
fac
inte
ge
ri_
coe
f,n
_co
ef
pa
ram
ete
r(n
_co
ef=
3)
do
ub
lep
reci
sio
na
,a
lph
a,
be
ta,
c(0
:n_
coe
f-1
)e
ps
=1
0.9
48
rm=
2.9
63
d=
1.4
82
6a
=1
.84
43
101
e5
alp
ha
=1
0.4
33
29
5b
eta
=-2
.279
65
1c(
0)
=1
.36
74
45
21
c(1
)=
0.4
212
38
07
c(2
)=
0.1
747
33
18
x=
r/
rma
ziz
=0
.d
oi_
coe
f=
0,
n_
coe
f-1
azi
z=
azi
z+
c(i_
coe
f)/
x**(
2*i
_co
ef+
6)
en
dd
oif
(x.lt
.d)
the
np
refa
c=
exp
(-(d
/x-1
.)**
2)
els
ep
refa
c=
1.
en
dif
azi
z=
-p
refa
c*
azi
za
ziz
=a
ziz
+a
*e
xp(-
alp
ha
*x+
be
ta*x
**2
)a
ziz
=e
ps
*azi
z!
66
6fo
r_sc
a_
mfa
_co
r=
4*p
i*
ep
s*c(
0)
*rm
**6
/3
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
conf_
init
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
inte
ge
rd
i_tr
ot
do
ub
lep
reci
sio
nx_
qu
an
t(2
*n_
tro
t),f_
qu
an
t(2
*n_
tro
t)co
mm
on
/xf_
qu
an
t/x_
qu
an
t,f_
qu
an
t
op
en
(10
,fil
e=
"co
nf.st
a",
sta
tus=
"old
")re
ad
(10
,*)
i_du
mm
yif
(i_
du
mm
y.e
q.0
)th
en
call
con
f_d
efa
ult
els
ere
ad
(10
,*)
i_tr
ot
if(i_
tro
t.eq
.n_
tro
t)th
en
di_
tro
t=
1e
lse
if(i_
tro
t.e
q.2
*n_
tro
t)th
en
di_
tro
t=
1e
lse
if(2
*i_
tro
t.e
q.n
_tr
ot)
the
nd
i_tr
ot
=2
els
ed
i_tr
ot
=1
sto
P"t
rotte
rn
um
be
rin
com
pa
btib
le"
en
dif
rea
d(1
0,1
03
)(s
cal_
0(i_
dim
),i_
dim
=1
,n_
dim
+3
)re
ad
(10
,10
3)
(sca
l_x(
1,i_
dim
),i_
dim
=1
,n_
dim
+3
)d
oi_
tro
t=
0,
n_
tro
t-1
,d
i_tr
ot
do
i_p
art
=1
,n_
pa
rtre
ad
(10
,14
4)
typ
e(i_
pa
rt),
&(p
bc0
(i_
dim
,i_tr
ot,i_
pa
rt),
i_d
im=
1,n
_d
im),
&(r
0(i_
dim
,i_tr
ot,i_
pa
rt),
i_d
im=
1,n
_d
im),
&ch
arg
e(i_
pa
rt)
if(d
i_tr
ot.e
q.2
)th
en
do
i_d
im=
1,
n_
dim
pb
c0(i_
dim
,i_tr
ot+
1,i_
pa
rt)
=p
bc0
(i_d
im,i_
tro
t,i_
pa
rt)
r0(i_
dim
,i_tr
ot+
1,i_
pa
rt)
=r0
(i_
dim
,i_tr
ot,i_
pa
rt)
en
dd
oe
nd
ife
nd
do
en
dd
o!-
--se
tp
bc
ba
ckto
sma
lln
um
be
rsd
oi_
pa
rt=
1,n
_p
art
do
i_d
im=
1,
n_
dim
do
i_tr
ot
=n
_tr
ot-
1,
0,
-1!
pb
c0(i_
dim
,i_tr
ot,i_
pa
rt)
=p
bc0
(i_
dim
,i_tr
ot,i_
pa
rt)
!&
-pb
c0(i_
dim
,0,i_
pa
rt)
!d
on
td
oth
at,
we
like
big
ge
rn
um
be
rse
nd
do
en
dd
oe
nd
do
do
i_d
im=
1,
n_
dim
+e
_d
imsc
al_
x(1
,i_d
im)
=sc
al_
x(1
,i_d
im)*
dt
en
dd
o
100
B.1. Molecular Dynamics Code
if(e
_d
im.e
q.0
)th
en
do
i_d
im=
1,
n_
dim
sca
l_x(
1,n
_d
im+
i_d
im)
=0
.e
nd
do
en
dif
en
dif
!---
-se
tB
KS
cha
rge
sb
ack
tod
efa
ult
if(f
_p
ote
ntia
l.eq
.3)
the
nd
oi_
pa
rt=
1,
n_
pa
rtif
(typ
e(i_
pa
rt).
eq
.1)
the
nch
arg
e(i_
pa
rt)
=2
.4e
lse ch
arg
e(i_
pa
rt)
=-1
.2e
nd
ife
nd
do
en
dif
!---
-se
tS
can
do
loch
arg
es
ba
ckto
de
fau
ltif
(f_
po
ten
tial.e
q.9
)th
en
do
i_p
art
=1
,n
_p
art
if(t
ype
(i_
pa
rt).
eq
.1)
the
nch
arg
e(i_
pa
rt)
=2
.76
51
4e
lse ch
arg
e(i_
pa
rt)
=-1
.38
25
7e
nd
ife
nd
do
en
dif
!---
-ca
lcu
late
de
fau
ltin
tera
ctio
nra
ng
ea
nd
skin
if(f
_p
ress
ure
.eq
.0)
the
nd
oi_
dim
=1
,n
_d
im+
e_
dim
sca
l_x(
1,i_
dim
)=
0.
en
dd
oe
nd
if
n_
ne
igh
_m
ax
=0
!---
de
fine
refe
ren
tp
oin
tsfo
rp
art
icle
sd
oi_
pa
rt=
1,n
_p
art
do
i_d
im=
1,n
_d
imr_
ref(
i_d
im,i_
pa
rt)
=r0
(i_
dim
,0,i_
part
)+&
1.
*p
bc0
(i_
dim
,0,i_
pa
rt)
en
dd
oe
nd
do
!--
initi
aliz
eu
0fie
ldd
oi_
pa
rt=
1,
n_
pa
rtd
oi_
dim
=1
,n
_d
imd
oi_
tro
t=
0,
n_
tro
t-1
x_q
ua
nt(
2*i
_tr
ot+
1)
=r0
(i_
dim
,i_tr
ot,i_
pa
rt)
+&
1.
*p
bc0
(i_
dim
,i_tr
ot,i_
pa
rt)
-r_
ref(
i_d
im,i_
pa
rt)
x_q
ua
nt(
2*i
_tr
ot+
1)
=x_
qu
an
t(2
*i_
tro
t+1
)/
n_
tro
t*
sqrt
px_
qu
an
t(2
*i_
tro
t+2
)=
0.
en
dd
o!
---
tra
nsf
orm
x_q
ua
nt
into
rec.
space
call
fou
r1(x
_q
ua
nt,n
_tr
ot,1
)d
oi_
tro
t=
1,
2*n
_tr
ot
u0
(i_
dim
,i_tr
ot,i_
pa
rt)
=x_
qu
an
t(i_
tro
t)e
nd
do
en
dd
oe
nd
do
!---
-in
itia
lize
volu
me
an
dve
loci
ties
call
sca
l_0
_u
pd
ate
call
vel_
de
fau
lt(i_
du
mm
y)ca
llca
lc_
rv_
rea
l
if(f
_p
ote
ntia
l.ne
.1)
call
pb
_co
nd
itca
lltr
an
s_re
cip
if(f
_p
ote
ntia
l.ne
.1)
call
bin
nin
g
do
i_p
art
=1
,n_
pa
rtd
oi_
tro
t=
0,n
_tr
ot-
1d
oi_
dim
=1,n
_d
imfo
rce
(i_
dim
,i_tr
ot,i_
pa
rt)
=0
.d0
en
dd
oe
nd
do
en
dd
o
if(f_
po
ten
tial.e
q.1
)th
en
call
ha
rm_
osc
els
eca
llsc
al_
0_
up
da
teif
(f_
po
ten
tial.e
q.2
)th
en
call
len
na
rd_jo
ne
se
lse
if(f
_p
ote
ntia
l.eq
.3)
the
nse
lf_e
ne
rgy
=0
.d
oi_
pa
rt=
1,
n_
pa
rtse
lf_e
ne
rgy
=se
lf_e
ne
rgy
+ch
arg
e(i_
pa
rt)*
*2e
nd
do
self_
en
erg
y=
-n_
tro
t*e
lec_
pre
fac*
alp
ha
*se
lf_e
ne
rgy/
sqrt
(pi)
call
bks
_p
ote
ntia
le
lse
if(f
_p
ote
ntia
l.eq
.4)
the
nca
llb
ks_
po
ten
tial
els
eif
((f_
po
ten
tial.g
e.5
).a
nd
.(f_
po
ten
tial.l
e.8
))th
en
!h
ier
ae
nde
rn?
self_
en
erg
y=
0.
do
i_p
art
=1,
n_
pa
rtse
lf_e
ne
rgy
=se
lf_e
ne
rgy
+ch
arg
e(i_
pa
rt)*
*2e
nd
do
self_
en
erg
y=
-n_
tro
t*e
lec_
pre
fac*
alp
ha
*se
lf_e
ne
rgy/
sqrt
(pi)
call
go
dd
ard
_p
ote
ntia
le
nd
ife
nd
ifca
lltr
an
s_re
cip
if(f
_p
ote
ntia
l.ne
.1)
call
bo
x_ch
ain
call
the
rmo
sta
t
!---
-co
nve
rtfo
rce
sin
toa
cce
lera
tion
sd
oi_
dim
=1
,n_
dim
do
i_tr
ot
=0
,n_
tro
t-1
do
i_p
art
=1
,n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
ux(
2,i_
dim
,2*i
_tr
ot+
1,i_
pa
rt)
=&
f0(i_
dim
,2*i
_tr
ot+
1,i_
pa
rt)/
ma
ss(i_
tro
t,i_
typ
e)*
dt_
2u
x(2
,i_d
im,2
*i_tr
ot+
2,i_
pa
rt)
=&
f0(i_
dim
,2*i
_tr
ot+
2,i_
pa
rt)/
ma
ss(i_
tro
t,i_
typ
e)*
dt_
2e
nd
do
en
dd
oe
nd
do
101
B. Programs!-
---
bo
xsh
ap
ed
oi_
dim
=1,n
_d
im+
e_
dim
sca
l_x(
2,i_
dim
)=
forc
e_
sca
l(i_
dim
)/
ma
ss_
bo
x*
dt_
2/
2e
nd
do
call
con
f_sa
veif
(f_
po
ten
tial.e
q.3
)ca
llin
it_b
on
ds
if((
f_p
ote
ntia
l.ge
.5).
an
d.(
f_p
ote
ntia
l.le
.9))
call
init_
bo
nds
!---
-co
un
ta
tom
sp
er
typ
ed
oi_
typ
e=
1,
n_
typ
en
_a
tom
typ
e(i_
typ
e)
=0
en
dd
od
oi_
pa
rt=
1,
n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
n_
ato
mty
pe
(i_
typ
e)
=n
_a
tom
typ
e(i_
typ
e)
+1
en
dd
o
10
3fo
rma
t(3f1
3.5
)1
44
form
at(
4i5
,4f1
4.6
)
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
init_
bo
nd
sim
plic
itn
one
incl
ud
e"p
imd
.co
m.f"
do
ub
lep
reci
sio
nr_
2
r_n
eig
h_
min
=1
.0r_
ne
igh
_m
ax
=2
.3d
oi_
pa
rt=
1,
n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
do
i_d
um
my
=1
,4
i_n
eig
h_
ori(i_
pa
rt,i_
du
mm
y)=
0e
nd
do
i_d
um
my
=0
do
j_p
art
=1
,n
_p
art
j_ty
pe
=ty
pe(j_
pa
rt)
if(i_
typ
e.n
e.j_
typ
e)
the
nca
llca
lc_
dis
tan
ce(r
_2
,0,i_
pa
rt,j_
pa
rt)
r_d
um
my
=sq
rt(r
_2
)if
(r_
du
mm
y.lt.
r_n
eig
h_
ma
x)th
en
!--
--ne
igh
bo
rfo
un
di_
du
mm
y=
i_du
mm
y+
1if
(i_
du
mm
y.le
.4)
the
ni_
ne
igh
_o
ri(i_
pa
rt,i_
du
mm
y)=
j_p
art
els
ew
rite
(*,*
)"m
ore
tha
n4
ne
are
stn
eig
hb
ors
"e
nd
ife
nd
ife
nd
ife
nd
do
en
dd
o
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
sca
l_0
_u
pd
ate
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
do
ub
lep
reci
sio
nve
c_d
um
my(
n_
dim
+3
),m
at_
du
mm
y(n
_d
im,n
_d
im),
&q
_2
_m
ind
ou
ble
pre
cisi
on
r_m
at(
n_
dim
,n_
dim
)
call
tra
ns_
to_te
ns(
sca
l_0
,h_
ma
t)ca
llsq
ua
re_
mat(
h_
ma
t,h
_m
at_
2)
call
tra
ns_
to_vo
igt(
h_
ma
t_2
,me
t_te
n_
voi)
volu
me
=sc
al_
0(1
)*sc
al_
0(2
)*sc
al_
0(3
)if
(e_
dim
.eq
.3)
the
nvo
lum
e=
volu
me
+&
2*s
cal_
0(4
)*sc
al_
0(5
)*sc
al_
0(6
)-
sca
l_0
(4)*
*2*s
cal_
0(3
)&
-sc
al_
0(5
)**2
*sca
l_0
(1)
-sc
al_
0(6
)**2
*sca
l_0
(2)
en
dif
do
i_d
im=
1,
n_
dim
+3
vec_
du
mm
y(i_
dim
)=
sca
l_x(
1,i_
dim
)e
nd
do
call
tra
ns_
to_te
ns(
vec_
du
mm
y,h
_m
at_
do
t)ca
llm
at_
mu
l(h_
ma
t,h
_m
at_
do
t,m
at_
du
mm
y)d
oi_
dim
=1
,n
_d
imd
oj_
dim
=1
,n
_d
imh
_m
at_
2d
(i_
dim
,j_d
im)
=m
at_
du
mm
y(i_
dim
,j_d
im)
en
dd
oe
nd
do
call
ma
t_m
ul(h_
ma
t_d
ot,h
_m
at,m
at_
du
mm
y)d
oi_
dim
=1
,n
_d
imd
oj_
dim
=1
,n
_d
imh
_m
at_
2d
(i_
dim
,j_d
im)
=h
_m
at_
2d
(i_d
im,j_
dim
)+
&m
at_
du
mm
y(i_
dim
,j_d
im)
h_
ma
t_2
d(i_
dim
,j_d
im)
=h
_m
at_
2d
(i_
dim
,j_d
im)
/1
en
dd
oe
nd
do
call
inv_
ma
t(h_
ma
t_2
,h_
ma
t_2
_in
v)ca
llm
at_
mu
l(h_
ma
t_2
_in
v,h
_m
at_
2d
,g_
mat_
do
t)ca
lltr
an
s_to
_vo
igt(
g_
ma
t_d
ot,g
_vo
i_d
ot)
call
inv_
ma
t(h_
ma
t,h
_m
at_
inv)
if(f
_p
ote
ntia
l.eq
.3)
the
n!-
--ch
an
ge:
cuto
ffcr
iterio
nfo
rre
cve
cto
rd
oi_
dim
=1,
n_
dim
do
j_d
im=
1,
n_
dim
dq
(i_
dim
,j_dim
)=
two
pi
*h
_m
at_
inv(
i_d
im,j_
dim
)e
nd
do
en
dd
oca
llja
cob
i(n
_d
im,
dq
,ro
t_m
at,
eig
en
,1
00
)q
_2
_m
in=
eig
en
(1,1
)**2
do
i_d
im=
2,
n_
dim
r_d
um
my
=e
igen
(i_
dim
,i_d
im)*
*2if
(r_
du
mm
y.lt.
q_
2_
min
)q
_2
_m
in=
r_d
um
my
en
dd
od
oi_
dim
=1,
n_
dim
nq
_m
ax(
i_d
im)
=in
t(sq
rt(q
_cu
t_2
/q_
2_
min
))e
nd
do
en
dif
if((
f_p
ote
ntia
l.ge
.5).
an
d.(
f_p
ote
ntia
l.le
.8))
the
n!
hie
ra
en
de
rn?
!---
cha
ng
e:
cuto
ffcr
iterio
nfo
rre
cve
cto
rd
oi_
dim
=1,
n_
dim
102
B.1. Molecular Dynamics Code
do
j_d
im=
1,
n_
dim
dq
(i_
dim
,j_d
im)
=tw
op
i*
h_
ma
t_in
v(i_
dim
,j_d
im)
en
dd
oe
nd
do
call
jaco
bi(n_
dim
,d
q,
rot_
ma
t,e
ige
n,
10
0)
q_
2_
min
=e
ige
n(1
,1)*
*2d
oi_
dim
=2
,n
_d
imr_
du
mm
y=
eig
en
(i_
dim
,i_d
im)*
*2if
(r_
du
mm
y.lt.
q_
2_
min
)q
_2
_m
in=
r_d
um
my
en
dd
od
oi_
dim
=1
,n
_d
imn
q_
ma
x(i_
dim
)=
int(
sqrt
(q_
cut_
2/q
_2
_m
in))
en
dd
oe
nd
if
!---
see
wh
eth
er
min
ima
ge
con
v.h
old
sif
(f_
pre
ssu
re.e
q.1
)th
en
do
i_d
im=
1,
n_
dim
do
j_d
im=
1,
n_
dim
r_m
at(
i_d
im,j_
dim
)=
h_
ma
t(i_
dim
,j_d
im)
en
dd
oe
nd
do
if(f
_p
ote
ntia
l.gt.1
)th
en
call
jaco
bi(n
_d
im,
r_m
at,
rot_
ma
t,e
ige
n,
10
0)
do
i_d
im=
1,
n_
dim
!if(
ab
s(e
ige
n(i_
dim
,i_d
im))
.lt.
2*r
_cu
toff_
ma
x)!
&st
op
"cu
toff
rad
ius
gro
win
gto
ost
ron
gly
"e
nd
do
en
dif
en
dif
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
inv_
ma
t(m
at,m
at_
inv)
imp
licit
no
ne
inte
ge
ri_
dim
,j_
dim
,si
gn
do
ub
lep
reci
sion
ma
t(3
,3),
ma
t_in
v(3
,3),
de
t_m
at
do
ub
lep
reci
sion
de
term
de
t_m
at
=d
ete
rm(m
at)
do
i_d
im=
1,
3d
oj_
dim
=1
,3
ma
t_in
v(i_
dim
,j_d
im)
=0
.d0
en
dd
oe
nd
do
ma
t_in
v(1
,1)
=m
at(
2,2
)*m
at(
3,3
)-
ma
t(2
,3)*
*2m
at_
inv(
2,2
)=
ma
t(3
,3)*
ma
t(1
,1)
-m
at(
3,1
)**2
ma
t_in
v(3
,3)
=m
at(
1,1
)*m
at(
2,2
)-
ma
t(1
,2)*
*2m
at_
inv(
1,2
)=
-(m
at(
2,1
)*m
at(
3,3
)-
ma
t(2
,3)*
ma
t(3
,1))
ma
t_in
v(2
,3)
=-
(ma
t(3
,2)*
ma
t(1
,1)
-m
at(
3,1
)*m
at(
1,2
))m
at_
inv(
1,3
)=
+(m
at(
1,2
)*m
at(
2,3
)-
ma
t(1
,3)*
ma
t(2
,2))
do
i_d
im=
1,
3d
oj_
dim
=i_
dim
,3
ma
t_in
v(i_
dim
,j_d
im)
=m
at_
inv(
i_d
im,j_
dim
)/
de
t_m
at
ma
t_in
v(j_
dim
,i_d
im)
=m
at_
inv(
i_d
im,j_
dim
)e
nd
do
en
dd
o
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
do
ub
lep
reci
sio
nfu
nct
ion
de
term
(ma
t)im
plic
itn
one
do
ub
lep
reci
sio
nm
at(
3,3
)d
ete
rm=
ma
t(1
,1)*
ma
t(2
,2)*
ma
t(3
,3)
+2
*ma
t(1
,2)*
ma
t(2
,3)*
ma
t(3
,1)
&-m
at(
1,1
)*m
at(
2,3
)**2
-ma
t(2
,2)*
ma
t(3,1
)**2
-ma
t(3
,3)*
ma
t(1
,2)*
*2e
nd
fun
ctio
n
!!
!!
!!
!!
!!
sub
rou
tine
ma
t_m
ul(m
at1
,ma
t2,m
at3
)im
plic
itn
one
inte
ge
ri_
dim
,j_
dim
,k_
dim
do
ub
lep
reci
sio
nm
at1
(3,3
),m
at2
(3,3
),m
at3
(3,3
)ca
llze
ro_
mat(
ma
t3)
do
i_d
im=
1,
3d
oj_
dim
=1,
3d
ok_
dim
=1,
3m
at3
(i_
dim
,j_d
im)
=m
at3
(i_
dim
,j_d
im)
+&
ma
t1(i_
dim
,k_
dim
)*
ma
t2(k
_d
im,j_
dim
)e
nd
do
en
dd
oe
nd
do
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
zero
_m
at(
ma
trix
)im
plic
itn
one
inte
ge
ri_
dim
,j_d
imd
ou
ble
pre
cisi
on
ma
trix
(3,3
)
do
i_d
im=
1,3
do
j_d
im=
1,3
ma
trix
(j_
dim
,i_d
im)
=0
.e
nd
do
en
dd
o
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
tra
ns_
to_
ten
s(ve
cto
r,m
atr
ix)
imp
licit
no
ne
do
ub
lep
reci
sio
nm
atr
ix(3
,3),
vect
or(
6)
ma
trix
(1,1
)=
vect
or(
1)
ma
trix
(2,2
)=
vect
or(
2)
ma
trix
(3,3
)=
vect
or(
3)
ma
trix
(1,2
)=
vect
or(
4)
ma
trix
(2,1
)=
vect
or(
4)
ma
trix
(2,3
)=
vect
or(
5)
ma
trix
(3,2
)=
vect
or(
5)
ma
trix
(3,1
)=
vect
or(
6)
ma
trix
(1,3
)=
vect
or(
6)
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
103
B. Programssu
bro
utin
esq
ua
re_
ma
t(m
at,m
at_
2)
imp
licit
no
ne
inte
ge
ri_
dim
,j_
dim
,k_
dim
do
ub
lep
reci
sio
nm
at(
3,3
),m
at_
2(3
,3)
do
i_d
im=
1,
3d
oj_
dim
=1,
3m
at_
2(i_
dim
,j_d
im)
=0
.e
nd
do
en
dd
od
oi_
dim
=1,
3d
oj_
dim
=1,
3d
ok_
dim
=1,
3m
at_
2(i_
dim
,j_d
im)
=m
at_
2(i_
dim
,j_d
im)
+&
ma
t(k_
dim
,i_d
im)
*m
at(
k_d
im,j_
dim
)e
nd
do
en
dd
oe
nd
do
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
tra
ns_
to_
voig
t(m
atr
ix,v
ect
or)
imp
licit
no
ne
do
ub
lep
reci
sio
nm
atr
ix(3
,3),
vect
or(
6)
vect
or(
1)
=m
atr
ix(1
,1)
vect
or(
2)
=m
atr
ix(2
,2)
vect
or(
3)
=m
atr
ix(3
,3)
vect
or(
4)
=2
*m
atr
ix(1
,2)
vect
or(
5)
=2
*m
atr
ix(2
,3)
vect
or(
6)
=2
*m
atr
ix(3
,1)
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
con
f_d
efa
ult
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
do
ub
lep
reci
sio
nr_
2d
ou
ble
pre
cisi
on
r_d
um
my_
1,r
_d
um
my_
2,r
_d
um
my_
3in
teg
er
i_b
in_
x,i_
bin
_y,
i_b
in_
z
do
i_d
im=
1,
n_
dim
+3
if(i_
dim
.le.n
_d
im)
the
nsc
al_
0(i_
dim
)=
1.
els
esc
al_
0(i_
dim
)=
0.
en
dif
do
i_o
rde
r=
1,n
_o
rde
rsc
al_
x(i_
ord
er,
i_d
im)
=0
.e
nd
do
en
dd
o
if(f
_p
ote
ntia
l.eq
.1)
the
n!-
---
ha
rmo
nic
osc
illa
tor
do
i_p
art
=1
,n_
pa
rtty
pe
(i_
pa
rt)
=1
do
i_d
im=
1,n
_d
imr0
(i_
dim
,0,i_
part
)=
0.
en
dd
oe
nd
do
els
eif(
f_sy
mm
etr
y.e
q.1
)th
en
!---
-fc
csy
mm
etr
y
if(f
_p
ote
ntia
l.eq
.2)
the
n!-
---
thre
ep
art
icle
sin
on
eb
ox
at
de
nsi
ty1
.05
(fcc
)r_
du
mm
y=
(4.d
0/1
.05
)**(
1.d
0/3
)!-
---
cla
sica
lg
rou
nd
sta
teif
LJ
ne
xtn
eig
hb
or
inte
ract
ion
!r_
dum
my
=1
.58
74
01
els
eif
(f_
po
ten
tial.e
q.3
)th
en
!---
-a
pp
rop
ria
ted
ista
nce
for
SiO
2"m
elt"
r_d
um
my
=(4
.d0
/0.0
69
)**(
1./3
)e
lse
if(f
_po
ten
tial.e
q.4
)th
en
!---
-H
eliu
m3
at
criti
cal
de
nsi
tyr_
du
mm
y=
(4.d
0*7
.26
)**(
1./3
)*
2.5
56
!---
-H
eliu
m4
at
crit.
de
nsi
tyr_
du
mm
y=
(4.d
0*9
6.1
4)*
*(1
./3
)e
lse
if((
f_p
ote
ntia
l.ge
.5).
an
d.(
f_po
ten
tial.l
e.9
))th
en
!h
ier
ae
nd
ern
?!-
---
ap
pro
pria
ted
ista
nce
for
SiO
2"m
elt"
r_d
um
my
=(4
.d0
/0.0
69
)**(
1./3
)e
nd
ifsc
al_
0(1
)=
n_
bin
_x*
r_d
um
my
sca
l_0
(2)
=n
_b
in_
y*r_
du
mm
ysc
al_
0(3
)=
n_
bin
_z*
r_d
um
my
!---
-sc
ale
bo
xle
ng
tho
nrig
ht
len
gth
sca
leif
(f_
po
ten
tial.e
q.2
)th
en
do
i_d
im=
1,n
_d
imsc
al_
0(i_
dim
)=
sig
ma
(1,1
)*
sca
l_0
(i_
dim
)e
nd
do
en
dif
i_p
art
=0
do
i_b
in_
x=
0,n
_b
in_
x-1
do
i_b
in_
y=
0,n
_b
in_
y-1
do
i_b
in_
z=
0,n
_b
in_
z-1
!---
-se
tfir
sta
tom
on
ed
ge
of
bo
xi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=(r
ea
l(i_
bin
_x)
+0
.0)/
n_b
in_
xr0
(2,0
,i_p
art
)=
(re
al(i_
bin
_y)
+0
.0)/
n_b
in_
yr0
(3,0
,i_p
art
)=
(re
al(i_
bin
_z)
+0
.0)/
n_b
in_
z
!---
-se
tne
xtth
ree
ato
ms
on
face
dia
go
na
li_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=r0
(1,0
,i_p
art
-1)
+0
.5/n
_b
in_
xr0
(2,0
,i_p
art
)=
r0(2
,0,i_
pa
rt-1
)+
0.5
/n_
bin
_y
r0(3
,0,i_
pa
rt)
=r0
(3,0
,i_p
art
-1)
i_p
art
=i_
pa
rt+
1ty
pe
(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=r0
(1,0
,i_p
art
-2)
+0
.5/n
_b
in_
xr0
(2,0
,i_p
art
)=
r0(2
,0,i_
pa
rt-2
)r0
(3,0
,i_p
art
)=
r0(3
,0,i_
pa
rt-2
)+
0.5
/n_
bin
_z
i_p
art
=i_
pa
rt+
1ty
pe
(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=r0
(1,0
,i_p
art
-3)
r0(2
,0,i_
pa
rt)
=r0
(2,0
,i_p
art
-3)
+0
.5/n
_b
in_
yr0
(3,0
,i_p
art
)=
r0(3
,0,i_
pa
rt-3
)+
0.5
/n_
bin
_z
en
dd
oe
nd
do
104
B.1. Molecular Dynamics Code
en
dd
o
!---
-m
ake
eve
ryth
ird
pa
rtic
leS
iif
BK
Sp
ote
ntia
lif
(f_
po
ten
tial.e
q.3
)th
en
do
i_p
art
=1
,n_
pa
rtif(
mo
d(i_
pa
rt,3
).e
q.1
)th
en
typ
e(i_
pa
rt)
=1
els
ety
pe
(i_
pa
rt)
=2
en
dif
en
dd
oe
nd
if
!h
ier
ae
nd
ern
?!-
---
ma
kee
very
third
pa
rtic
leS
iif
BK
Sp
ote
ntia
lif
((f_
po
ten
tial.g
e.5
).a
nd
.(f_
po
ten
tial.l
e.8
))th
en
do
i_p
art
=1
,n_
pa
rtif(
mo
d(i_
pa
rt,3
).e
q.1
)th
en
typ
e(i_
pa
rt)
=1
els
ety
pe
(i_
pa
rt)
=2
en
dif
en
dd
oe
nd
if
els
eif(
(f_
sym
me
try.
eq
.2).
or.
(f_
sym
me
try.
eq
.3))
the
n!-
---
trid
ymite
:f_
sym
me
try
=2
!---
-cr
isto
ba
lit:
f_sy
mm
etr
y=
3r_
du
mm
y=
3.1
4sc
al_
0(1
)=
r_d
um
my*
sqrt
(8./3
)*n
_b
in_x
sca
l_0
(2)
=r_
du
mm
y*sq
rt(8
.)*n
_b
in_
yif(
f_sy
mm
etr
y.e
q.2
)th
en
sca
l_0
(3)
=8
.*r_
du
mm
y/3
*n_
bin
_z
els
esc
al_
0(3
)=
12
.*r_
du
mm
y/3
*n_
bin
_z
en
dif
r_d
um
my_
1=
r_d
um
my/
sca
l_0
(1)
r_d
um
my_
2=
r_d
um
my/
sca
l_0
(2)
r_d
um
my_
3=
r_d
um
my/
sca
l_0
(3)
i_p
art
=0
!---
-se
tu
pS
ia
tom
so
nW
urt
zit
stru
ctu
re
do
i_b
in_
x=
0,n
_b
in_
x-1
do
i_b
in_
y=
0,n
_b
in_
y-1
do
i_b
in_
z=
0,n
_b
in_
z-1
!---
---
Ad
ou
ble
laye
r
i_p
art
=i_
pa
rt+
1ty
pe
(i_
pa
rt)
=1
r0(1
,0,i_
part
)=
i_b
in_
x*1
./n
_b
in_
x+
0.0
01
r0(2
,0,i_
part
)=
i_b
in_
y*1
./n
_b
in_
y+
0.0
01
r0(3
,0,i_
part
)=
i_b
in_
z*1
./n
_b
in_
z+
0.0
01
i_p
art
=i_
pa
rt+
1ty
pe
(i_
pa
rt)
=1
r0(1
,0,i_
part
)=
r0(1
,0,i_
pa
rt-1
)r0
(2,0
,i_p
art
)=
r0(2
,0,i_
pa
rt-1
)r0
(3,0
,i_p
art
)=
r0(3
,0,i_
pa
rt-1
)+r_
du
mm
y/sc
al_
0(3
)
i_p
art
=i_
part
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)=
r0(1
,0,i_
pa
rt-2
)+0
.5*s
qrt
(8./3
)*r_
du
mm
y_1
r0(2
,0,i_
pa
rt)=
r0(2
,0,i_
pa
rt-2
)+sq
rt(3
./4
)*sq
rt(8
./3
)*r_
du
mm
y_2
r0(3
,0,i_
pa
rt)=
r0(3
,0,i_
pa
rt-2
)
i_p
art
=i_
part
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)=
r0(1
,0,i_
pa
rt-2
)+0
.5*s
qrt
(8./3
)*r_
du
mm
y_1
r0(2
,0,i_
pa
rt)=
r0(2
,0,i_
pa
rt-2
)+sq
rt(3
./4
)*sq
rt(8
./3
)*r_
du
mm
y_2
r0(3
,0,i_
pa
rt)=
r0(3
,0,i_
pa
rt-2
)
!---
-B
do
ub
lela
yer
i_p
art
=i_
part
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)=
r0(1
,0,i_
pa
rt-4
)+0
.5*s
qrt
(8./3
)*r_
du
mm
y_1
r0(2
,0,i_
pa
rt)=
r0(2
,0,i_
pa
rt-4
)+sq
rt(1
./1
2)*
sqrt
(8./3
)*r_
du
mm
y_2
r0(3
,0,i_
pa
rt)=
r0(3
,0,i_
pa
rt-4
)+(1
.+1./3
)*r_
du
mm
y_3
i_p
art
=i_
part
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=r0
(1,0
,i_p
art
-1)
r0(2
,0,i_
pa
rt)
=r0
(2,0
,i_p
art
-1)
r0(3
,0,i_
pa
rt)
=r0
(3,0
,i_p
art
-1)+
r_du
mm
y_3
i_p
art
=i_
part
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)=
r0(1
,0,i_
pa
rt-2
)+0
.5*s
qrt
(8./3
)*r_
du
mm
y_1
r0(2
,0,i_
pa
rt)=
r0(2
,0,i_
pa
rt-2
)+sq
rt(3
./4
)*sq
rt(8
./3
)*r_
du
mm
y_2
r0(3
,0,i_
pa
rt)=
r0(3
,0,i_
pa
rt-2
)
i_p
art
=i_
part
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)=
r0(1
,0,i_
pa
rt-2
)+0
.5*s
qrt
(8./3
)*r_
du
mm
y_1
r0(2
,0,i_
pa
rt)=
r0(2
,0,i_
pa
rt-2
)+sq
rt(3
./4
)*sq
rt(8
./3
)*r_
du
mm
y_2
r0(3
,0,i_
pa
rt)=
r0(3
,0,i_
pa
rt-2
)
!---
-C
do
ub
lela
yer
if(f_
sym
me
try.
eq
.3)
the
ni_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)=
r0(1
,0,i_
pa
rt-4
)+0
.5*s
qrt
(8./3
)*r_
du
mm
y_1
r0(2
,0,i_
pa
rt)=
r0(2
,0,i_
pa
rt-4
)+sq
rt(1
./1
2)*
sqrt
(8./3
)*r_
du
mm
y_2
r0(3
,0,i_
pa
rt)=
r0(3
,0,i_
pa
rt-4
)+(1
.+1./3
)*r_
du
mm
y_3
i_p
art
=i_
part
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=r0
(1,0
,i_p
art
-1)
r0(2
,0,i_
pa
rt)
=r0
(2,0
,i_p
art
-1)
r0(3
,0,i_
pa
rt)
=r0
(3,0
,i_p
art
-1)+
r_du
mm
y_3
i_p
art
=i_
part
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)=
r0(1
,0,i_
pa
rt-2
)+0
.5*s
qrt
(8./3
)*r_
du
mm
y_1
r0(2
,0,i_
pa
rt)=
r0(2
,0,i_
pa
rt-2
)+sq
rt(3
./4
)*sq
rt(8
./3
)*r_
du
mm
y_2
r0(3
,0,i_
pa
rt)=
r0(3
,0,i_
pa
rt-2
)
i_p
art
=i_
part
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)=
r0(1
,0,i_
pa
rt-2
)+0
.5*s
qrt
(8./3
)*r_
du
mm
y_1
105
B. Programsr0
(2,0
,i_p
art
)=r0
(2,0
,i_p
art
-2)+
sqrt
(3./4
)*sq
rt(8
./3
)*r_
du
mm
y_2
r0(3
,0,i_
pa
rt)=
r0(3
,0,i_
pa
rt-2
)e
nd
if
en
dd
oe
nd
do
en
dd
o
els
eif(
f_sy
mm
etr
y.e
q.4
)th
en
r_d
um
my
=3
.14
sca
l_0
(1)
=4
*r_
du
mm
y/sq
rt(3
.)*n
_b
in_
xsc
al_
0(2
)=
4*r
_d
um
my/
sqrt
(3.)
*n_
bin
_y
sca
l_0
(3)
=4
*r_
du
mm
y/sq
rt(3
.)*n
_b
in_
z
i_p
art
=0
.d
oi_
bin
_x
=0,n
_b
in_
x-1
do
i_b
in_
y=
0,n
_b
in_
y-1
do
i_b
in_
z=
0,n
_b
in_
z-1
i_p
art
=i_
pa
rt+
1ty
pe
(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
zi_
pa
rt=
i_pa
rt+
1ty
pe
(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=r0
(1,0
,i_p
art
-1)
+0.5
/n_
bin
_x
r0(2
,0,i_
pa
rt)
=r0
(2,0
,i_p
art
-1)
+0.5
/n_
bin
_x
r0(3
,0,i_
pa
rt)
=r0
(3,0
,i_p
art
-1)
i_p
art
=i_
pa
rt+
1ty
pe
(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=r0
(1,0
,i_p
art
-2)
+0.5
/n_
bin
_x
r0(2
,0,i_
pa
rt)
=r0
(2,0
,i_p
art
-2)
r0(3
,0,i_
pa
rt)
=r0
(3,0
,i_p
art
-2)
+0.5
/n_
bin
_x
i_p
art
=i_
pa
rt+
1ty
pe
(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=r0
(1,0
,i_p
art
-3)
r0(2
,0,i_
pa
rt)
=r0
(2,0
,i_p
art
-3)
+0.5
/n_
bin
_x
r0(3
,0,i_
pa
rt)
=r0
(3,0
,i_p
art
-3)
+0.5
/n_
bin
_x
do
j_p
art
=1
,4i_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=r0
(1,0
,i_p
art
-4)
+0
.25
/n_
bin
_x
r0(2
,0,i_
pa
rt)
=r0
(2,0
,i_p
art
-4)
+0
.25
/n_
bin
_y
r0(3
,0,i_
pa
rt)
=r0
(3,0
,i_p
art
-4)
+0
.25
/n_
bin
_z
en
dd
oe
nd
do
en
dd
oe
nd
do
els
eif(
f_sy
mm
etr
y.e
q.6
)th
en
!---
-b
eta
qu
arz
sca
l_0
(1)
=4
.99
77
*n_
bin
_x*
1.0
24
39
sca
l_0
(2)
=8
.65
63
*n_
bin
_y*
1.0
24
39
sca
l_0
(3)
=5
.46
01
*n_
bin
_z*
1.0
24
39
i_p
art
=0
do
i_b
in_
x=
0,n
_b
in_
x-1
do
i_b
in_
y=
0,n
_b
in_
y-1
do
i_b
in_
z=
0,n
_b
in_
z-1
i_p
art
=i_
pa
rt+
1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
(1.*
0)/
(1*n
_b
in_
x)r0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
(1.*
0)/
(1*n
_b
in_
y)r0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
(1.*
0)/
(1*n
_b
in_
z)i_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
(1.*
1)/
(4*n
_b
in_
x)r0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
(1.*
3)/
(4*n
_b
in_
y)r0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
(1.*
1)/
(3*n
_b
in_
z)i_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
(1.*
1)/
(4*n
_b
in_
x)r0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
(1.*
1)/
(4*n
_b
in_
y)r0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
(1.*
2)/
(3*n
_b
in_
z)i_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
(1.*
1)/
(2*n
_b
in_
x)r0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
(1.*
1)/
(2*n
_b
in_
y)r0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
(1.*
0)/
(1*n
_b
in_
z)i_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
(1.*
3)/
(4*n
_b
in_
x)r0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
(1.*
3)/
(4*n
_b
in_
y)r0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
(1.*
2)/
(3*n
_b
in_
z)i_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
(1.*
3)/
(4*n
_b
in_
x)r0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
(1.*
1)/
(4*n
_b
in_
y)r0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
(1.*
1)/
(3*n
_b
in_
z)
i_p
art
=i_
pa
rt+
1ty
pe
(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0./n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
0.7
07
/n_
bin
_y
r0(3
,0,i_
pa
rt)
=i_
bin
_z*
1./n
_b
in_
z+
0.5
/n_
bin
_z
i_p
art
=i_
pa
rt+
1ty
pe
(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0./n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
0.2
92
8/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.5
/n_
bin
_z
i_p
art
=i_
pa
rt+
1ty
pe
(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.1
89
22
65
/n_
bin
_x
r0(2
,0,i_
pa
rt)
=i_
bin
_y*
1./n
_b
in_
y+
0.8
96
4/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.1
66
66
67
/n_
bin
_z
i_p
art
=i_
pa
rt+
1ty
pe
(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.1
89
22
65
/n_
bin
_x
r0(2
,0,i_
pa
rt)
=i_
bin
_y*
1./n
_b
in_
y+
0.1
03
6/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.8
33
33
33
/n_
bin
_z
i_p
art
=i_
pa
rt+
1ty
pe
(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.3
10
84
35
4/n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
0.6
03
6/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.1
66
66
66
7/n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.3
10
84
35
4/n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
0.3
96
4/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.8
33
33
33
3/n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=2
106
B.1. Molecular Dynamics Code
r0(1
,0,i_
part
)=
i_b
in_
x*1
./n
_b
in_
x+
0.5
/n_
bin
_x
r0(2
,0,i_
part
)=
i_b
in_
y*1
./n
_b
in_
y+
0.7
92
8/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.5
/n_
bin
_z
i_p
art
=i_
pa
rt+
1ty
pe
(i_
pa
rt)
=2
r0(1
,0,i_
part
)=
i_b
in_
x*1
./n
_b
in_
x+
0.5
/n_
bin
_x
r0(2
,0,i_
part
)=
i_b
in_
y*1
./n
_b
in_
y+
0.2
07
2/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.5
/n_
bin
_z
i_p
art
=i_
pa
rt+
1ty
pe
(i_
pa
rt)
=2
r0(1
,0,i_
part
)=
i_b
in_
x*1
./n
_b
in_
x+
0.6
89
29
65
5/n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
0.6
03
6/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.8
33
33
33
3/n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=2
r0(1
,0,i_
part
)=
i_b
in_
x*1
./n
_b
in_
x+
0.6
89
29
65
5/n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
0.3
96
4/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.1
66
66
66
7/n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=2
r0(1
,0,i_
part
)=
i_b
in_
x*1
./n
_b
in_
x+
0.8
10
91
35
8/n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
0.8
96
4/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.8
33
33
33
3/n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=2
r0(1
,0,i_
part
)=
i_b
in_
x*1
./n
_b
in_
x+
0.8
10
91
35
8/n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
0.1
03
6/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.1
66
66
66
7/n
_b
in_
z
en
dd
oe
nd
do
en
dd
oe
lse
if(f_
sym
metr
y.e
q.7
)th
en
!---
-a
lph
aq
ua
rz
sca
l_0
(1)
=4.9
14
85
*n_
bin
_x
sca
l_0
(2)
=8.5
12
77
*n_
bin
_y
sca
l_0
(3)
=5.4
06
29
*n_
bin
_z
i_p
art
=0
do
i_b
in_
x=
0,n
_b
in_
x-1
do
i_b
in_
y=
0,n
_b
in_
y-1
do
i_b
in_
z=
0,n
_b
in_
z-1
i_p
art
=i_
pa
rt+
1ty
pe
(i_
pa
rt)
=1
r0(1
,0,i_
part
)=
i_b
in_
x*1
./n
_b
in_
x+
0./n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
0./n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0./n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
part
)=
i_b
in_
x*1
./n
_b
in_
x+
0.2
97
7/n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
0.7
65
9/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.6
66
66
7/n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
part
)=
i_b
in_
x*1
./n
_b
in_
x+
0.2
97
7/n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
0.2
34
1/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.3
33
33
3/n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
part
)=
i_b
in_
x*1
./n
_b
in_
x+
0.5
/n_
bin
_x
r0(2
,0,i_
part
)=
i_b
in_
y*1
./n
_b
in_
y+
0.5
/n_
bin
_y
r0(3
,0,i_
pa
rt)
=i_
bin
_z*
1./n
_b
in_
z+
0./n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.7
97
7/n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
0.7
34
1/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.3
33
33
3/n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=1
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.7
97
7/n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
0.2
65
9/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.6
66
66
67
/n_
bin
_z
i_p
art
=i_
part
+1
typ
e(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.0
91
35
/n_
bin
_x
r0(2
,0,i_
pa
rt)
=i_
bin
_y*
1./n
_b
in_
y+
0.7
06
55
/n_
bin
_y
r0(3
,0,i_
pa
rt)
=i_
bin
_z*
1./n
_b
in_
z+
0.4
53
56
7/n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.0
91
35
/n_
bin
_x
r0(2
,0,i_
pa
rt)
=i_
bin
_y*
1./n
_b
in_
y+
0.2
93
45
/n_
bin
_y
r0(3
,0,i_
pa
rt)
=i_
bin
_z*
1./n
_b
in_
z+
0.5
46
43
36
9/n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.1
92
2/n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
0.9
26
5/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.7
86
9/n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.1
92
2/n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
0.0
73
5/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.2
13
1/n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.3
11
85
/n_
bin
_x
r0(2
,0,i_
pa
rt)
=i_
bin
_y*
1./n
_b
in_
y+
0.3
66
95
/n_
bin
_y
r0(3
,0,i_
pa
rt)
=i_
bin
_z*
1./n
_b
in_
z+
0.1
20
23
36
9/n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.3
11
85
/n_
bin
_x
r0(2
,0,i_
pa
rt)
=i_
bin
_y*
1./n
_b
in_
y+
0.6
33
05
/n_
bin
_y
r0(3
,0,i_
pa
rt)
=i_
bin
_z*
1./n
_b
in_
z+
0.8
79
76
7/n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.5
91
35
/n_
bin
_x
r0(2
,0,i_
pa
rt)
=i_
bin
_y*
1./n
_b
in_
y+
0.2
06
55
/n_
bin
_y
r0(3
,0,i_
pa
rt)
=i_
bin
_z*
1./n
_b
in_
z+
0.4
53
56
7/n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.5
91
35
/n_
bin
_x
r0(2
,0,i_
pa
rt)
=i_
bin
_y*
1./n
_b
in_
y+
0.7
93
45
/n_
bin
_y
r0(3
,0,i_
pa
rt)
=i_
bin
_z*
1./n
_b
in_
z+
0.5
46
43
36
9/n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.6
92
2/n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
0.5
73
5/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.2
13
1/n
_b
in_
zi_
pa
rt=
i_p
art
+1
typ
e(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.6
92
2/n
_b
in_
xr0
(2,0
,i_p
art
)=
i_b
in_
y*1
./n
_b
in_
y+
0.4
26
5/n
_b
in_
yr0
(3,0
,i_p
art
)=
i_b
in_
z*1
./n
_b
in_
z+
0.7
86
9/n
_b
in_
z
107
B. Programsi_
pa
rt=
i_pa
rt+
1ty
pe
(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.8
11
85
/n_
bin
_x
r0(2
,0,i_
pa
rt)
=i_
bin
_y*
1./n
_b
in_
y+
0.8
66
95
/n_
bin
_y
r0(3
,0,i_
pa
rt)
=i_
bin
_z*
1./n
_b
in_
z+
0.1
20
23
36
9/n
_b
in_
zi_
pa
rt=
i_pa
rt+
1ty
pe
(i_
pa
rt)
=2
r0(1
,0,i_
pa
rt)
=i_
bin
_x*
1./n
_b
in_
x+
0.8
11
85
/n_
bin
_x
r0(2
,0,i_
pa
rt)
=i_
bin
_y*
1./n
_b
in_
y+
0.1
33
05
/n_
bin
_y
r0(3
,0,i_
pa
rt)
=i_
bin
_z*
1./n
_b
in_
z+
0.8
79
76
7/n
_b
in_
ze
nd
do
en
dd
oe
nd
do
en
dif
if((f
_sy
mm
etr
y.g
e.2
).a
nd
.(f_
sym
me
try.
lt.6
))th
en
call
sca
l_0
_u
pd
ate
call
pb
_co
nd
it!-
---
pu
to
xyg
en
so
nb
on
ds
i_d
um
my
=i_
part
do
i_p
art
=1
,n_
silic
-1d
oj_
pa
rt=
i_p
art
+1
,n_
silic
call
calc
_d
ista
nce
(r_
2,0
,i_p
art
,j_p
art
)if(
r_2
.le.(
1.0
01
*r_
du
mm
y)**
2)
the
n!-
---
oxy
ge
nfo
un
di_
du
mm
y=
i_d
um
my
+1
typ
e(i_
du
mm
y)=
2d
oi_
dim
=1
,n_d
imr0
(i_
dim
,0,i_
du
mm
y)=
r0(i_
dim
,0,i_
part
)-
&d
elta
_ce
ll(i_
dim
)/
2e
nd
do
en
dif
en
dd
oe
nd
do
en
dif
!---
-g
en
era
teco
llap
sed
po
lym
ers
and
set
pe
rio
dic
bo
un
da
ries
toze
rod
oi_
pa
rt=
1,n
_p
art
do
i_tr
ot
=0
,n_
tro
t-1
do
i_d
im=
1,n
_d
imr0
(i_
dim
,i_tr
ot,i_
pa
rt)
=r0
(i_
dim
,0,i_
pa
rt)
pb
c0(i_
dim
,i_tr
ot,i_
pa
rt)
=0
en
dd
oe
nd
do
en
dd
o
!---
-se
tall
velo
citie
sa
nd
hig
he
rd
eriva
tive
sto
zero
do
i_p
art
=1
,n_
pa
rtd
oi_
tro
t=
1,2
*n_
tro
td
oi_
dim
=1,n
_d
imd
oi_
ord
er
=1
,n_
ord
er
ux(
i_o
rde
r,i_
dim
,i_tr
ot,i_
pa
rt)
=0
.e
nd
do
en
dd
oe
nd
do
en
dd
o
!---
-se
tde
fau
ltch
arg
es
acc
ord
ing
toty
pe
if(f
_p
ote
ntia
l.eq
.3)
the
nd
oi_
pa
rt=
1,n
_p
art
if(ty
pe
(i_
pa
rt).
eq
.1)
the
nch
arg
e(i_
pa
rt)
=2
.4e
lse
if(ty
pe
(i_p
art
).e
q.2
)th
en
cha
rge
(i_
pa
rt)
=-1
.2e
nd
ife
nd
do
els
eif
((f_
pote
ntia
l.ge
.5).
an
d.(
f_p
ote
ntia
l.le
.7))
the
nd
oi_
pa
rt=
1,n
_p
art
if(ty
pe
(i_
pa
rt).
eq
.1)
the
nch
arg
e(i_
pa
rt)
=1
.3e
lse
if(ty
pe
(i_p
art
).e
q.2
)th
en
cha
rge
(i_
pa
rt)
=-1
.3/2
.e
nd
ife
nd
do
els
eif
(f_
pote
ntia
l.eq
.8)
the
nd
oi_
pa
rt=
1,n
_p
art
if(ty
pe
(i_
pa
rt).
eq
.1)
the
nch
arg
e(i_
pa
rt)
=1
.6e
lse
if(ty
pe
(i_
pa
rt).
eq
.2)
the
nch
arg
e(i_
pa
rt)
=-1
.6/2
.e
nd
ife
nd
do
els
e do
i_p
art
=1
,n_
pa
rtif(
typ
e(i_
pa
rt).
eq
.1)
the
nch
arg
e(i_
pa
rt)
=2
.4e
lse
if(ty
pe
(i_
pa
rt).
eq
.2)
the
nch
arg
e(i_
pa
rt)
=-1
.2e
nd
ife
nd
do
en
dif
call
calc
_rv
_re
al
call
con
f_sa
ve
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
pb_
con
dit
imp
licit
no
ne
incl
ud
e"p
imd.c
om
.f"
!---
-m
ove
pa
rtic
les
into
bo
xd
oi_
pa
rt=
1,n
_p
art
do
i_tr
ot
=0
,n_
tro
t-1
do
i_d
im=
1,n
_d
imif(
r0(i_
dim
,i_tr
ot,i_
pa
rt).
gt.1
.)th
en
r0(i_
dim
,i_tr
ot,i_
pa
rt)
=r0
(i_
dim
,i_tr
ot,i_
pa
rt)-
1.
pb
c0(i_
dim
,i_tr
ot,i_
pa
rt)
=p
bc0
(i_
dim
,i_tr
ot,i_
pa
rt)
+1
els
eif(
r0(i_
dim
,i_tr
ot,i_
pa
rt).
lt.(0
.d0
))th
en
r0(i_
dim
,i_tr
ot,i_
pa
rt)
=r0
(i_
dim
,i_tr
ot,i_
pa
rt)+
1.
pb
c0(i_
dim
,i_tr
ot,i_
pa
rt)
=p
bc0
(i_
dim
,i_tr
ot,i_
pa
rt)
-1
en
dif
en
dd
oe
nd
do
en
dd
o
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
108
B.1. Molecular Dynamics Code
sub
rou
tine
vel_
de
fau
lt(i_
du
mm
y)im
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
do
i_p
art
=1
,n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
do
i_tr
ot
=0,n
_tr
ot-
1!-
---
Ga
uss
ian
wid
thr_
du
mm
y=
sqrt
(tkp
/ma
ss(i_
tro
t,i_
typ
e))
*dt
!---
-lin
ear
bo
xd
istr
ibu
tion
r_d
um
my
=sq
rt3
*r_
du
mm
y!-
---
take
twic
eki
ne
tice
ne
rgy
at
t=
0if
(i_
du
mm
y.e
q.0
)r_
du
mm
y=
sqrt
2*r
_d
um
my
if(m
od
(2*i
_tr
ot,n
_tr
ot)
.ne
.0)
r_d
um
my
=r_
du
mm
y/sq
rt2
call
r25
0(m
z,ra
nd
om
,n_
dim
,n_
dim
,kp
tr)
!---
-te
rmin
itve
loci
ties
do
i_d
im=
1,
n_
dim
ux(
1,i_
dim
,2*i
_tr
ot+
1,i_
pa
rt)
=0
.d
oj_
dim
=1
,n
_d
imu
x(1
,i_d
im,2
*i_
tro
t+1
,i_p
art
)=
ux(
1,i_
dim
,2*i
_tr
ot+
1,i_
pa
rt)
&+
h_
ma
t_in
v(i_
dim
,j_d
im)
*(2
*ran
do
m(j_
dim
)-1
.)*
r_d
um
my
en
dd
oe
nd
do
en
dd
o!-
---
sym
me
triz
ed
oi_
tro
t=
1,n
_tr
ot/2
-1d
oi_
dim
=1
,n_
dim
ux(
1,i_
dim
,2*i
_tr
ot+
2,i_
pa
rt)
=&
ux(
1,i_
dim
,2*(
n_
tro
t-i_
tro
t)+
1,i_
pa
rt)
ux(
1,i_
dim
,2*(
n_
tro
t-i_
tro
t)+
1,i_
pa
rt)
=&
ux(
1,i_
dim
,2*i
_tr
ot+
1,i_
pa
rt)
ux(
1,i_
dim
,2*(
n_
tro
t-i_
tro
t)+
2,i_
pa
rt)
=&
-u
x(1
,i_dim
,2*i
_tr
ot+
2,i_
pa
rt)
en
dd
oe
nd
do
en
dd
o
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
con
f_sa
veca
llco
nf_
save
_n
r(-1
)e
nd
sub
rou
tine
!!
!!
!!
!!
!!
!
sub
rou
tine
con
f_sa
ve_
nr(
file
nr)
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
cha
ract
er(
20
)fil
en
am
ein
teg
er
file
nr
if(f
ilen
r.g
e.0
)th
en
file
na
me
="c
onf."
call
ad
dn
um
tost
rin
g(f
ilen
am
e,file
nr)
els
e file
na
me
="c
onf.xm
o"
en
dif
op
en
(10
,file
="c
on
f.e
nd
",st
atu
s="u
nkn
ow
n")
write
(10
,’(i1
)’)
1w
rite
(10
,*)
n_
tro
tw
rite
(10
,10
3)
(sca
l_0
(i_
dim
),i_
dim
=1
,n_
dim
+3
)w
rite
(10
,10
3)
(sca
l_x(
1,i_
dim
)/d
t,i_
dim
=1
,n_
dim
+3
)d
oi_
tro
t=
0,n
_tr
ot-
1d
oi_
pa
rt=
1,n
_p
art
write
(10
,14
4)
typ
e(i_
pa
rt),
&(p
bc0
(i_
dim
,i_tr
ot,i_
pa
rt),
i_d
im=
1,n
_d
im),
&(r
0(i_
dim
,i_tr
ot,i_
pa
rt),
i_d
im=
1,n
_dim
),&
cha
rge
(i_
part
)e
nd
do
en
dd
ow
rite
(10
,*)
n_
ne
igh
_m
ax,
"m
ax.
nu
nb
er
of
ne
igh
bo
rsse
ein
inru
n"
write
(10
,*)
n_
ne
igh
,"d
ime
nsi
on
of
neig
hb
or
field
"cl
ose
(10
)
if(i_
run
.eq
.1)
op
en
(11
,file
=fil
en
am
e,s
tatu
s="u
nkn
ow
n")
write
(11
,’(i5
)’)
n_
pa
rtw
rite
(11
,*)
do
i_p
art
=1
,n_
pa
rtif(
typ
e(i_
pa
rt).
eq
.1)
the
nw
rite
(11
,20
4)
"Si
",(r
_re
al(i_
dim
,0,i_
pa
rt),
i_d
im=
1,n
_d
im),
&ch
arg
e(i_
pa
rt)
els
eif(
typ
e(i_
pa
rt).
eq
.2)
the
nw
rite
(11
,20
4)
"O",
(r_
rea
l(i_
dim
,0,i_
pa
rt),
i_d
im=
1,n
_d
im),
&ch
arg
e(i_
pa
rt)
en
dif
en
dd
oif(
i_ru
n.e
q.n
_ru
n)
clo
se(1
1)
op
en
(35
,file
="c
on
favg
.xm
o",
sta
tus=
"unkn
ow
n")
write
(35
,’(i5
)’)
n_
pa
rtw
rite
(35
,*)
do
i_p
art
=1
,n_
pa
rtif(
typ
e(i_
pa
rt).
eq
.1)
the
nw
rite
(35
,20
4)
"Si
",(r
_re
al_
avg
(i_
dim
,0,i_
pa
rt)/
i_tim
e,
&i_
dim
=1
,n_
dim
),&
cha
rge
(i_
pa
rt)
els
eif(
typ
e(i_
pa
rt).
eq
.2)
the
nw
rite
(35
,20
4)
"O",
(r_
rea
l_a
vg(i_
dim
,0,i_
pa
rt)/
i_tim
e,
&i_
dim
=1
,n_
dim
),&
charg
e(i_
pa
rt)
en
dif
en
dd
ocl
ose
(35
)
op
en
(34
,file
="c
on
favg
.po
l",s
tatu
s="u
nkn
ow
n")
do
i_p
art
=1
,n
_p
art
write
(34
,10
4)
(avg
_d
ipo
le_
pa
rt(i_
dim
,i_p
art
)/i_
time
,&
i_d
im=
0,n
_d
im)
en
dd
ocl
ose
(34
)
op
en
(36
,file
="c
on
f.p
ol"
,sta
tus=
"un
know
n")
do
i_p
art
=1
,n
_p
art
write
(36
,10
4)
(dip
ole
(i_
dim
,i_p
art
),&
i_d
im=
1,n
_d
im)
en
dd
ocl
ose
(36
)
10
3fo
rma
t(3
f13
.5)
109
B. Programs1
04
form
at(
4f1
3.5
)1
44
form
at(
4i5
,4f1
4.6
)
20
4fo
rma
t(a
,3e
13
.4,e
30
.21
)
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
tra
ns_
reci
pim
plic
itn
one
incl
ud
e"p
imd
.co
m.f"
do
ub
lep
reci
sio
nx_
qu
an
t(2
*n_
tro
t),f_q
ua
nt(
2*n
_tr
ot)
com
mo
n/x
f_qu
an
t/x_
qu
an
t,f_
qu
an
t
do
i_p
art
=1
,n_
pa
rtd
oi_
dim
=1,n
_d
im
do
i_tr
ot
=0
,n_
tro
t-1
f_q
ua
nt(
2*i
_tr
ot+
1)
=fo
rce
(i_
dim
,i_tr
ot,i_
pa
rt)/
n_
tro
t*sq
rtp
!---
-a
bove
no
rma
liza
tion
sn
ece
ssary
be
cau
sefo
ur1
inco
rrect
f_q
ua
nt(
2*i
_tr
ot+
2)
=0
.e
nd
do
!---
-tr
ansf
orm
into
reci
pro
cal
space
call
fou
r1(f
_qu
an
t,n
_tr
ot,1
)
do
i_tr
ot
=1
,2*n
_tr
ot
f0(i_
dim
,i_tr
ot,i_
pa
rt)
=f_
qu
an
t(i_
tro
t)e
nd
do
en
dd
oe
nd
do
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
tra
ns_
rea
lim
plic
itn
one
incl
ud
e"p
imd
.co
m.f"
do
ub
lep
reci
sio
nx_
qu
an
t(2
*n_
tro
t),
f_q
ua
nt(
2*n
_tr
ot)
,&
ma
t_d
um
my(
3,3
)d
ou
ble
pre
cisi
on
forc
e_
sca
l_id
ea
l(n
_dim
+3
),&
forc
e_
sca
l_co
nf(
n_
dim
+3
)co
mm
on
/xf_
qu
an
t/x_
qu
an
t,f_
qu
an
t
do
i_p
art
=1
,n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
do
i_d
im=
1,n
_d
im
do
i_tr
ot
=1,2
*n_
tro
tx_
qu
an
t(i_
tro
t)=
u0
(i_
dim
,i_tr
ot,i_
pa
rt)/
sqrt
pe
nd
do
!---
--tr
an
sfo
rmin
tore
al
spa
ceca
llfo
ur1
(x_q
ua
nt,n
_tr
ot,-1
)
do
i_tr
ot
=0,n
_tr
ot-
1r0
(i_
dim
,i_tr
ot,i_
pa
rt)
=x_
qu
an
t(2*i
_tr
ot+
1)
-&
1.
*p
bc0
(i_
dim
,i_tr
ot,i_
pa
rt)
+r_
ref(
i_d
im,i_
pa
rt)
en
dd
o
en
dd
oe
nd
do
call
calc
_rv
_re
al
v_p
ress
=0
.d
oi_
dim
=1
,n
_d
im+
e_
dim
forc
e_
sca
l_co
nf(
i_d
im)
=0
.e
nd
do
!---
-T
ER
Mq
ua
nt
do
i_tr
ot
=0
,n_
tro
t-1
j_tr
ot
=m
od(i_
tro
t+1
,n_
tro
t)d
oi_
pa
rt=
1,n
_p
art
i_ty
pe
=ty
pe
(i_
pa
rt)
do
i_d
im=
1,n
_d
imfo
rce
_sc
al_
con
f(i_
dim
)=
forc
e_
sca
l_co
nf(
i_d
im)
-&
k_q
ua
nt(
i_ty
pe
)*
&(r
0(i_
dim
,i_tr
ot,i_
pa
rt)+
1.*
pb
c0(i_
dim
,i_tr
ot,i_
pa
rt)
&-r
0(i_
dim
,j_tr
ot,i_
pa
rt)-
1.*
pb
c0(i_
dim
,j_tr
ot,i_
pa
rt))
*&
(r_
rea
l(i_
dim
,i_tr
ot,i_
pa
rt)-
r_re
al(i_
dim
,j_tr
ot,i_
pa
rt))
en
dd
oe
nd
do
if(e
_d
im.e
q.3
)th
en
do
i_p
art
=1
,n
_p
art
forc
e_
sca
l_co
nf(
4)
=fo
rce
_sc
al_
con
f(4
)-
&k_
qu
an
t(i_
typ
e)
*(
&(
r0(1
,i_tr
ot,i_
pa
rt)
+1
.*
pb
c0(1
,i_tr
ot,i_
pa
rt)
&-
r0(1
,j_tr
ot,i_
pa
rt)
-1
.*
pb
c0(1
,j_tr
ot,i_
pa
rt)
)*
&(
r_re
al(2
,i_tr
ot,i_
pa
rt)
-r_
rea
l(2
,j_tr
ot,i_
pa
rt)
)+
&(
r0(2
,i_tr
ot,i_
pa
rt)
+1
.*
pb
c0(2
,i_tr
ot,i_
pa
rt)
&-
r0(2
,j_tr
ot,i_
pa
rt)
-1
.*
pb
c0(2
,j_tr
ot,i_
pa
rt)
)*
&(
r_re
al(1
,i_tr
ot,i_
pa
rt)
-r_
rea
l(1
,j_tr
ot,i_
pa
rt)
))
/2
forc
e_
sca
l_co
nf(
5)
=fo
rce
_sc
al_
con
f(5
)-
&k_
qu
an
t(i_
typ
e)
*(
&(
r0(2
,i_tr
ot,i_
pa
rt)
+1
.*
pb
c0(2
,i_tr
ot,i_
pa
rt)
&-
r0(2
,j_tr
ot,i_
pa
rt)
-1
.*
pb
c0(2
,j_tr
ot,i_
pa
rt)
)*
&(
r_re
al(3
,i_tr
ot,i_
pa
rt)
-r_
rea
l(3
,j_tr
ot,i_
pa
rt)
)+
&(
r0(3
,i_tr
ot,i_
pa
rt)
+1
.*
pb
c0(3
,i_tr
ot,i_
pa
rt)
&-
r0(3
,j_tr
ot,i_
pa
rt)
-1
.*
pb
c0(3
,j_tr
ot,i_
pa
rt)
)*
&(
r_re
al(2
,i_tr
ot,i_
pa
rt)
-r_
rea
l(2
,j_tr
ot,i_
pa
rt)
))
/2
forc
e_
sca
l_co
nf(
6)
=fo
rce
_sc
al_
con
f(6
)-
&k_
qu
an
t(i_
typ
e)
*(
&(
r0(3
,i_tr
ot,i_
pa
rt)
+1
.*
pb
c0(3
,i_tr
ot,i_
pa
rt)
&-
r0(3
,j_tr
ot,i_
pa
rt)
-1
.*
pb
c0(3
,j_tr
ot,i_
pa
rt)
)*
&(
r_re
al(1
,i_tr
ot,i_
pa
rt)
-r_
rea
l(1
,j_tr
ot,i_
pa
rt)
)+
&(
r0(1
,i_tr
ot,i_
pa
rt)
+1
.*
pb
c0(1
,i_tr
ot,i_
pa
rt)
&-
r0(1
,j_tr
ot,i_
pa
rt)
-1
.*
pb
c0(1
,j_tr
ot,i_
pa
rt)
)*
&(
r_re
al(3
,i_tr
ot,i_
pa
rt)
-r_
rea
l(3
,j_tr
ot,i_
pa
rt)
))
/2
en
dd
oe
nd
ife
nd
do
!---
term
iiid
oi_
dim
=1
,n
_d
im+
3fo
rce
_sc
al_
ide
al(i_
dim
)=
0.
en
dd
od
oi_
pa
rt=
1,
n_
pa
rti_
typ
e=
type
(i_
pa
rt)
do
i_tr
ot
=0
,n
_tr
ot-
1
110
B.1. Molecular Dynamics Code
!---
-fir
stp
art
do
i_d
im=
1,
n_
dim
forc
e_
sca
l_id
ea
l(i_
dim
)=
forc
e_
sca
l_id
ea
l(i_
dim
)+
&m
ass
(i_
tro
t,i_
typ
e)
*v_
rea
l(i_
dim
,2*i
_tr
ot+
1,i_
pa
rt)
*&
ux(
1,i_
dim
,2*i
_tr
ot+
1,i_
pa
rt)
en
dd
oif
(e_
dim
.eq
.3)
the
n!-
--sy
mm
etr
ize
no
nd
iag
ele
me
nts
forc
e_
sca
l_id
ea
l(4
)=
forc
e_
sca
l_id
ea
l(4
)+
&m
ass
(i_
tro
t,i_
typ
e)
*&
(v_
rea
l(1
,2*i
_tr
ot+
1,i_
pa
rt)
*ux(
1,2
,2*i
_tr
ot+
1,i_
pa
rt)
&+
v_re
al(2
,2*i
_tr
ot+
1,i_
pa
rt)
*ux(
1,1
,2*i
_tr
ot+
1,i_
pa
rt)
)fo
rce
_sc
al_
ide
al(5
)=
forc
e_
sca
l_id
ea
l(5
)+
&m
ass
(i_
tro
t,i_
typ
e)
*&
(v_
rea
l(2
,2*i
_tr
ot+
1,i_
pa
rt)
*ux(
1,3
,2*i
_tr
ot+
1,i_
pa
rt)
&+
v_re
al(3
,2*i
_tr
ot+
1,i_
pa
rt)
*ux(
1,2
,2*i
_tr
ot+
1,i_
pa
rt)
)fo
rce
_sc
al_
ide
al(6
)=
forc
e_
sca
l_id
ea
l(6
)+
&m
ass
(i_
tro
t,i_
typ
e)
*&
(v_
rea
l(3
,2*i
_tr
ot+
1,i_
pa
rt)
*ux(
1,1
,2*i
_tr
ot+
1,i_
pa
rt)
&+
v_re
al(1
,2*i
_tr
ot+
1,i_
pa
rt)
*ux(
1,3
,2*i
_tr
ot+
1,i_
pa
rt)
)e
nd
if!-
---
seco
nd
pa
rtif
(n_
tro
t.g
t.1
)th
en
do
i_d
im=
1,
n_
dim
forc
e_
sca
l_id
ea
l(i_
dim
)=
forc
e_
sca
l_id
ea
l(i_
dim
)+
&m
ass
(i_tr
ot,i_
typ
e)
*v_
rea
l(i_
dim
,2*i
_tr
ot+
2,i_
pa
rt)
&*
ux(
1,i_
dim
,2*i
_tr
ot+
2,i_
pa
rt)
en
dd
oif
(e_
dim
.eq
.3)
the
n!-
--sy
mm
etr
ize
no
nd
iag
ele
me
nts
forc
e_
sca
l_id
ea
l(4
)=
forc
e_
sca
l_id
ea
l(4
)+
&m
ass
(i_tr
ot,i_
typ
e)
*&
(v_
real(1
,2*i
_tr
ot+
2,i_
pa
rt)
*u
x(1
,2,2
*i_
tro
t+2
,i_p
art
)&
+v_
real(2
,2*i
_tr
ot+
2,i_
pa
rt)
*u
x(1
,1,2
*i_
tro
t+2
,i_p
art
))
forc
e_
sca
l_id
ea
l(5
)=
forc
e_
sca
l_id
ea
l(5
)+
&m
ass
(i_tr
ot,i_
typ
e)
*&
(v_
real(2
,2*i
_tr
ot+
2,i_
pa
rt)
*u
x(1
,3,2
*i_
tro
t+2
,i_p
art
)&
+v_
real(3
,2*i
_tr
ot+
2,i_
pa
rt)
*u
x(1
,2,2
*i_
tro
t+2
,i_p
art
))
forc
e_
sca
l_id
ea
l(6
)=
forc
e_
sca
l_id
ea
l(6
)+
&m
ass
(i_
tro
t,i_
typ
e)
*&
(v_
rea
l(3
,2*i
_tr
ot+
2,i_
pa
rt)
*u
x(1
,1,2
*i_
tro
t+2
,i_p
art
)&
+v_
rea
l(1
,2*i
_tr
ot+
2,i_
pa
rt)
*u
x(1
,3,2
*i_
tro
t+2
,i_p
art
))
en
dif
en
dif
en
dd
oe
nd
do
do
i_d
im=
1,
n_
dim
+e
_d
imfo
rce
_sc
al_
ide
al(i_
dim
)=
forc
e_
sca
l_id
ea
l(i_
dim
)/
dt_
2if
(i_
dim
.gt.n
_d
im)
&fo
rce
_sc
al_
ide
al(i_
dim
)=
forc
e_
scal_
ide
al(i_
dim
)/
2e
nd
do
!6
66
take
cuto
ffco
rre
ctio
nin
toca
lcu
latio
no
fe
latic
con
sta
nts
if(f
_p
ote
ntia
l.ne
.1)
the
nd
oi_
dim
=1
,n
_d
im+
e_
dim
forc
e_
sca
l(i_
dim
)=
forc
e_
sca
l_id
ea
l(i_
dim
)&
+fo
rce
_sc
al_
con
f(i_
dim
)e
nd
do
!---
corr
ect
ion
du
eto
cuto
ffo
fr*
*(-6
)p
ote
ntia
lv_
pre
ss=
v_pre
ss&
-n
_tr
ot
*n
_p
art
**2
*fo
r_sc
a_
mfa
_co
r/
volu
me
/2
do
i_d
im=
1,
n_
dim
if(i_
dim
.le.n
_d
im)
the
nr_
du
mm
y=
h_
ma
t_in
v(i_
dim
,i_d
im)
els
eif
(i_
dim
.eq
.4)
the
nr_
du
mm
y=
(h
_m
at_
inv(
1,2
)+
h_
ma
t_in
v(2
,1)
)/
2e
lse
if(i_
dim
.eq
.5)
the
nr_
du
mm
y=
(h
_m
at_
inv(
2,3
)+
h_
ma
t_in
v(3
,2)
)/
2e
lse
r_d
um
my
=(
h_
ma
t_in
v(3
,1)
+h
_m
at_
inv(
1,3
))
/2
en
dif
r_d
um
my
=-
n_
pa
rt**
2*
for_
sca
_m
fa_
cor
*r_
du
mm
y/
volu
me
forc
e_
sca
l(i_
dim
)=
forc
e_
sca
l(i_
dim
)+
r_d
um
my
en
dd
oe
nd
if
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
calc
_rv
_re
al
imp
licit
no
ne
incl
ud
e"p
imd.c
om
.f"
do
i_p
art
=1
,n_
pa
rtd
oi_
tro
t=
0,n
_tr
ot-
1d
oi_
dim
=1
,n_
dim
r_re
al(i_
dim
,i_tr
ot,i_
pa
rt)
=sc
al_
0(i_
dim
)*
&(r
0(i_
dim
,i_tr
ot,i_
pa
rt)
+1
.d0
*pb
c0(i_
dim
,i_tr
ot,i_
pa
rt))
v_re
al(i_
dim
,2*i
_tr
ot+
1,i_
pa
rt)
=&
sca
l_0
(i_
dim
)*
ux(
1,i_
dim
,2*i
_tr
ot+
1,i_
pa
rt)
if(n
_tr
ot.g
t.1
)v_
rea
l(i_
dim
,2*i
_tr
ot+
2,i_
pa
rt)
=&
sca
l_0
(i_
dim
)*
ux(
1,i_
dim
,2*i
_tr
ot+
2,i_
pa
rt)
en
dd
oif
(e_
dim
.eq
.3)
the
nr_
rea
l(1
,i_tr
ot,i_
pa
rt)
=r_
rea
l(1
,i_tr
ot,i_
pa
rt)
+&
sca
l_0
(4)
*(r
0(2
,i_tr
ot,i_
pa
rt)
+1.d
0*p
bc0
(2,i_
tro
t,i_
pa
rt))
+&
sca
l_0
(6)
*(r
0(3
,i_tr
ot,i_
pa
rt)
+1.d
0*p
bc0
(3,i_
tro
t,i_
pa
rt))
r_re
al(2
,i_tr
ot,i_
pa
rt)
=r_
rea
l(2
,i_tr
ot,i_
pa
rt)
+&
sca
l_0
(4)
*(r
0(1
,i_tr
ot,i_
pa
rt)
+1.d
0*p
bc0
(1,i_
tro
t,i_
pa
rt))
+&
sca
l_0
(5)
*(r
0(3
,i_tr
ot,i_
pa
rt)
+1.d
0*p
bc0
(3,i_
tro
t,i_
pa
rt))
r_re
al(3
,i_tr
ot,i_
pa
rt)
=r_
rea
l(3
,i_tr
ot,i_
pa
rt)
+&
sca
l_0
(6)
*(r
0(1
,i_tr
ot,i_
pa
rt)
+1.d
0*p
bc0
(1,i_
tro
t,i_
pa
rt))
+&
sca
l_0
(5)
*(r
0(2
,i_tr
ot,i_
pa
rt)
+1.d
0*p
bc0
(2,i_
tro
t,i_
pa
rt))
v_re
al(1
,2*i
_tr
ot+
1,i_
pa
rt)
=v_
rea
l(1
,2*i
_tr
ot+
1,i_
pa
rt)
+&
sca
l_0
(4)
*u
x(1
,2,2
*i_
tro
t+1
,i_p
art
)+
&sc
al_
0(6
)*
ux(
1,3
,2*i
_tr
ot+
1,i_
pa
rt)
v_re
al(2
,2*i
_tr
ot+
1,i_
pa
rt)
=v_
rea
l(2
,2*i
_tr
ot+
1,i_
pa
rt)
+&
sca
l_0
(4)
*u
x(1
,1,2
*i_
tro
t+1
,i_p
art
)+
&sc
al_
0(5
)*
ux(
1,3
,2*i
_tr
ot+
1,i_
pa
rt)
v_re
al(3
,2*i
_tr
ot+
1,i_
pa
rt)
=v_
rea
l(3
,2*i
_tr
ot+
1,i_
pa
rt)
+&
sca
l_0
(6)
*u
x(1
,1,2
*i_
tro
t+1
,i_p
art
)+
&sc
al_
0(5
)*
ux(
1,2
,2*i
_tr
ot+
1,i_
pa
rt)
if(n
_tr
ot.g
t.1
)th
en
v_re
al(1
,2*i
_tr
ot+
2,i_
pa
rt)
=v_
real(1
,2*i
_tr
ot+
2,i_
pa
rt)
+&
sca
l_0
(4)
*u
x(1
,2,2
*i_
tro
t+2
,i_p
art
)+
&sc
al_
0(6
)*
ux(
1,3
,2*i
_tr
ot+
2,i_
pa
rt)
v_re
al(2
,2*i
_tr
ot+
2,i_
pa
rt)
=v_
real(2
,2*i
_tr
ot+
2,i_
pa
rt)
+&
sca
l_0
(4)
*u
x(1
,1,2
*i_
tro
t+2
,i_p
art
)+
&sc
al_
0(5
)*
ux(
1,3
,2*i
_tr
ot+
2,i_
pa
rt)
v_re
al(3
,2*i
_tr
ot+
2,i_
pa
rt)
=v_
real(3
,2*i
_tr
ot+
2,i_
pa
rt)
+&
sca
l_0
(6)
*u
x(1
,1,2
*i_
tro
t+2
,i_p
art
)+
&sc
al_
0(5
)*
ux(
1,2
,2*i
_tr
ot+
2,i_
pa
rt)
en
dif
111
B. Programse
nd
ife
nd
do
en
dd
o
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
bin
nin
gim
plic
itn
one
incl
ud
e"p
imd
.co
m.f"
inte
ge
ri_
bin
,j_b
in
inte
ge
ri_
bin
_p
art
,ni_
bin
_p
art
inte
ge
rj_
bin
_p
art
,nj_
bin
_p
art
inte
ge
ri_
bin
_x,
i_b
in_
y,i_
bin
_z
inte
ge
rj_
bin
_x,
j_b
in_
y,j_
bin
_z
inte
ge
rd
j_bin
_x,
dj_
bin
_y,
dj_
bin
_z
do
ub
lep
reci
sio
nr_
2
do
i_p
art
=1
,n_
pa
rtn
eig
hb
or(
0,i_
pa
rt)
=0
en
dd
o
do
i_p
art
=1
,n_
pa
rt-1
i_ty
pe
=ty
pe
(i_
pa
rt)
do
j_p
art
=i_
pa
rt+
1,n
_p
art
j_ty
pe
=ty
pe
(j_
pa
rt)
do
i_tr
ot
=0
,n_
tro
t-1
!---
-ca
lcu
late
dis
tan
cew
ithrig
ht
bo
un
da
rie
sca
llca
lc_
dis
tan
ce(r
_2
,i_tr
ot,i_
pa
rt,j_
pa
rt)
if(r_
2.le
.r_
rang
e_
2(i_
typ
e,j_
typ
e))
then
if(d
elta
_r(
1).
lt.0
.)th
en
ne
igh
bo
r(0
,i_p
art
)=
ne
igh
bo
r(0
,i_pa
rt)
+1
i_d
um
my
=ne
igh
bo
r(0
,i_p
art
)n
eig
hb
or(
i_d
um
my,
i_p
art
)=
j_p
art
els
en
eig
hb
or(
0,j_
pa
rt)
=n
eig
hb
or(
0,j_
pa
rt)
+1
if(n
eig
hb
or(
0,j_
pa
rt).
gt.n
_n
eig
h)
sto
p"n
eig
hb
or
field
"i_
du
mm
y=
ne
igh
bo
r(0
,j_p
art
)n
eig
hb
or(
i_d
um
my,
j_p
art
)=
i_p
art
en
dif
n_
ne
igh
_m
ax
=m
ax(
n_
ne
igh
_m
ax,
ne
igh
bor(
0,j_
pa
rt))
n_
ne
igh
_m
ax
=m
ax(
n_
ne
igh
_m
ax,
ne
igh
bor(
0,i_
pa
rt))
go
to1
50
en
dif
en
dd
o1
50
con
tinu
ee
nd
do
en
dd
o
if(n
_n
eig
h_
ma
x.g
t.n
_n
eig
h)
sto
p’m
ake
ne
igh
bo
rfie
ldla
rge
r’
f_sk
in=
0d
oi_
pa
rt=
1,n
_p
art
do
i_tr
ot
=0
,n_
tro
t-1
do
i_d
im=
1,n
_d
imr0
_o
ld(i_
dim
,i_tr
ot,i_
pa
rt)
=r_
rea
l(i_
dim
,i_tr
ot,i_
pa
rt)
en
dd
o
en
dd
oe
nd
do
!6
66
if(f
_p
ote
ntia
l.eq
.3)
call
rec_
bin
nin
gif
(f_
po
ten
tial.e
q.5
)ca
llre
c_b
inn
ing
if(f
_p
ote
ntia
l.eq
.6)
call
rec_
bin
nin
gif
(f_
po
ten
tial.e
q.7
)ca
llre
c_b
inn
ing
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
rec_
bin
nin
gim
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
do
ub
lep
reci
sio
nq
_ve
c(n
_d
im),
q_
2,lo
c_p
refa
c,p
ot_
loc
com
ple
x*1
6f_
of_
k
rec_
po
t_o
ffse
t=
0.
do
i_d
im=
1,
n_
dim
+e
_d
imre
c_fo
rce
_o
ffse
t(i_
dim
)=
0.
en
dd
olo
c_p
refa
c=
ele
c_p
refa
c*tw
op
i/vo
lum
e
n_
rec_
vec
=0
do
k_d
im=
0,
nq
_m
ax(
3)
do
j_d
im=
-nq
_m
ax(
2),
nq
_m
ax(
2)
do
i_d
im=
-nq_
ma
x(1
),n
q_
ma
x(1
)q
_ve
c(1
)=
i_d
im*
dq
(1,1
)+
j_d
im*
dq
(1,2
)+
k_d
im*
dq
(1,3
)q
_ve
c(2
)=
i_d
im*
dq
(2,1
)+
j_d
im*
dq
(2,2
)+
k_d
im*
dq
(2,3
)q
_ve
c(3
)=
i_d
im*
dq
(3,1
)+
j_d
im*
dq
(3,2
)+
k_d
im*
dq
(3,3
)q
_2
=0
.d
ol_
dim
=1,n
_d
imq
_2
=q
_2
+q
_ve
c(l_
dim
)**2
en
dd
oif(
(q_
2.le
.q_
cut_
2).
an
d.(
q_
2.g
t.0
.))
the
n!-
----
calc
ula
teF
To
fch
arg
ed
en
sity
f_o
f_k
=(0
.,0.)
do
i_p
art
=1
,n_
pa
rt!-
--op
t r_d
um
my
=&
i_d
im*(
r_re
f(1
,i_p
art
)+u
0(1
,1,i_
pa
rt)/
sqrt
p)
+&
j_d
im*(
r_re
f(2
,i_p
art
)+u
0(2
,1,i_
pa
rt)/
sqrt
p)
+&
k_d
im*(
r_re
f(3
,i_p
art
)+u
0(3
,1,i_
pa
rt)/
sqrt
p)
r_d
um
my
=d
mod
(r_
du
mm
y,1
.d0
)i_
du
mm
y=
nin
t(r_
du
mm
y*n
_p
ote
ntia
l)f_
of_
k=
f_o
f_k
+ch
arg
e(i_
pa
rt)*
!&
tab
_e
xp_
ima
(i_
du
mm
y)&
exp
(2.*
pi*
(0.,1
.)*r
_d
um
my)
en
dd
or_
du
mm
y=
loc_
pre
fac*
exp
(-q
_2
/(2
*alp
ha
)**2
)/q
_2
po
t_lo
c=
r_d
um
my
*a
bs(
f_o
f_k)
**2
!w
rite
(30
+i_
time
,*)
po
t_lo
c,(q
_ve
c(l_
dim
),l_
dim
=1
,n_d
im)
if(p
ot_
loc.
ge
.v_
cut)
the
nn
_re
c_ve
c=
n_
rec_
vec
+1
if(n
_re
c_ve
c.g
t.n
_re
c_ve
c_m
ax)
sto
p"n
_re
c_ve
cto
ob
ig"
rec_
vec_
list(
n_
rec_
vec,
1)
=i_
dim
rec_
vec_
list(
n_
rec_
vec,
2)
=j_
dim
rec_
vec_
list(
n_
rec_
vec,
3)
=k_
dim
els
eif(
k_d
im.n
e.0
)r_
du
mm
y=
r_d
um
my*
2
112
B.1. Molecular Dynamics Code
po
t_lo
c=
r_du
mm
y*a
bs(
f_o
f_k)
**2
rec_
po
t_o
ffse
t=
rec_
po
t_o
ffse
t+
po
t_lo
cif(
f_p
ress
ure
.eq
.1)
the
nr_
du
mm
y=
(1./(2
*alp
ha
**2
)+2
./q
_2
)*po
t_lo
cd
ol_
dim
=1,n
_d
imre
c_fo
rce
_o
ffse
t(l_
dim
)=
rec_
forc
e_
offse
t(l_
dim
)+
&p
ot_
loc
-r_
du
mm
y*q
_ve
c(l_
dim
)**2
en
dd
oe
nd
ife
nd
ife
nd
ife
nd
do
en
dd
oe
nd
do
!---
-ch
an
ge
do
i_d
im=
1,n
_d
imre
c_fo
rce
_offse
t(i_
dim
)=
n_
tro
t*re
c_fo
rce
_o
ffse
t(i_
dim
)e
nd
do
rec_
po
t_o
ffse
t=
n_
tro
t*re
c_p
ot_
offse
t
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
rec_
ew
ald
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
inte
ge
ri_
q(n
_dim
),tr
ot_
ma
x,k_
tro
td
ou
ble
pre
cisi
on
q_
vec(
n_
dim
),q
_2
,loc_
pre
fac,
rec_
pre
fac
do
ub
lep
reci
sion
two
_re
c_p
refa
c,v_
mo
de
,fo
rce
_sc
al_
rec(
n_
dim
)co
mp
lex*
16
qe
qre
ck(n
_p
art
)co
mp
lex*
16
f_o
f_k
do
ub
lep
reci
sion
f_o
f_k_
rea
l,f_
of_
k_im
ag
do
i_p
art
=1
,n
_p
art
qe
qre
c(i_
pa
rt)=
0.
en
dd
o
v_e
wa
ld=
0.
do
i_d
im=
1,n
_d
imfo
rce
_sc
al_
rec(
i_d
im)
=0
.e
nd
do
loc_
pre
fac
=e
lec_
pre
fac*
two
pi/v
olu
me
j_tr
ot
=m
od
(int(
n_
tro
t*ra
nd
om
(1))
,n_
tro
t)d
oi_
rec_
vec
=1
,n_
rec_
vec
q_
2=
0.
do
i_d
im=
1,n
_d
imq
_ve
c(i_
dim
)=
0.
do
j_d
im=
1,
n_
dim
i_q
(j_
dim
)=
rec_
vec_
list(
i_re
c_ve
c,j_
dim
)q
_ve
c(i_
dim
)=
q_
vec(
i_d
im)
+i_
q(j_
dim
)*d
q(j_
dim
,i_d
im)
en
dd
oq
_2
=q
_2
+q
_ve
c(i_
dim
)**2
en
dd
ore
c_p
refa
c=
loc_
pre
fac*
exp
(-q
_2
/(2
*alp
ha
)**2
)/q
_2
if(re
c_ve
c_lis
t(i_
rec_
vec,
3).
ne
.0)
rec_
pre
fac
=2
*re
c_p
refa
ctw
o_
rec_
pre
fac
=2
*re
c_p
refa
ctr
ot_
ma
x=
n_tr
ot-
1if
(f_
op
t_re
c.e
q.1
)tr
ot_
ma
x=
0d
oi_
tro
t=
0,
tro
t_m
ax
if(f
_o
pt_
rec.
eq
.0)
j_tr
ot
=i_
tro
tf_
of_
k=
(0.,0
.)f_
of_
k_re
al
=0
.d0
f_o
f_k_
ima
g=
0.d
0d
oi_
pa
rt=
1,n
_p
art
r_d
um
my
=0.
if(f
_o
pt_
rec.
eq
.0)
the
nd
oi_
dim
=1
,n_
dim
r_d
um
my
=r_
du
mm
y+
i_q
(i_
dim
)*r0
(i_d
im,j_
tro
t,i_
pa
rt)
en
dd
oe
lse
do
i_d
im=
1,
n_
dim
r_d
um
my
=r_
du
mm
y+
i_q
(i_
dim
)*
&(
r_re
f(i_
dim
,i_p
art
)+
u0
(i_
dim
,1,i_
pa
rt)/
sqrt
p)
en
dd
oe
nd
ifr_
du
mm
y=
dm
od
(r_
du
mm
y,1
.d0
)i_
du
mm
y=
nin
t(r_
du
mm
y*n
_p
ote
ntia
l)f_
of_
k=
f_o
f_k
+ch
arg
e(i_
pa
rt)*
!&
tab
_e
xp_
ima
(i_
du
mm
y)&
exp
(2.*
pi*
(0.,1
.)*r
_d
um
my)
f_o
f_k_
rea
l=
f_o
f_k_
rea
l+ch
arg
e(i_
pa
rt)*
&co
s(2.*
pi*
r_d
um
my)
f_o
f_k_
ima
g=
f_o
f_k_
ima
g+
cha
rge
(i_
part
)*&
sin
(2.*
pi*
r_d
um
my)
en
dd
o
v_m
od
e=
rec_
pre
fac
*a
bs(
f_o
f_k)
**2
if(f
_o
pt_
rec.
eq
.1)
v_m
od
e=
n_
tro
t*
v_m
od
ev_
ew
ald
=v_
ew
ald
+v_
mo
de
!---
-ca
lcu
late
forc
efr
om
mo
de
"i_
rec_
vec"
on
ea
cha
tom
do
i_p
art
=1
,n_
pa
rtr_
du
mm
y=
0.
do
i_d
im=
1,n
_d
imr_
du
mm
y=
r_du
mm
y+
i_q
(i_
dim
)*r0
(i_
dim
,j_tr
ot,i_
pa
rt)
en
dd
or_
du
mm
y=
-dm
od(r
_d
um
my,
1.d
0)
i_d
um
my
=n
int(
r_d
um
my*
n_
po
ten
tial)
!c_
du
mm
y=
tab
_e
xp_
ima
(i_
du
mm
y)c_
du
mm
y=
exp
(2.*
pi*
(0.,1
.)*r
_d
um
my)
!qe
qre
c(i_
pa
rt)
=q
eq
rec(
i_p
art
)+
!&
two
_re
c_p
refa
c*d
ble
(c_
du
mm
y*f_
of_
k)q
eq
rec(
i_p
art
)=
qe
qre
c(i_
pa
rt)
+tw
o_
rec_
pre
fac
*&
(co
s(2
.*p
i*r_
du
mm
y)*f
_o
f_k_
rea
l&
-si
n(2
.*p
i*r_
du
mm
y)*f
_o
f_k_
ima
g)
r_d
um
my
=im
ag
(c_
du
mm
y*f_
of_
k)
if(f
_o
pt_
rec.
eq
.0)
the
nd
oi_
dim
=1
,n_
dim
forc
e(i_
dim
,i_tr
ot,i_
pa
rt)
=fo
rce
(i_
dim
,i_tr
ot,i_
pa
rt)
&-
two
_re
c_p
refa
c*ch
arg
e(i_
pa
rt)*
q_
vec(
i_d
im)*
r_d
um
my
&*
h_
ma
t_in
v(i_
dim
,i_d
im)
en
dd
oe
lse
do
k_tr
ot
=n_
tro
t-1
,0,-
1d
oi_
dim
=1
,n_
dim
forc
e(i_
dim
,k_
tro
t,i_
pa
rt)
=fo
rce
(i_
dim
,k_
tro
t,i_
pa
rt)
&-
two
_re
c_p
refa
c*ch
arg
e(i_
pa
rt)*
q_
vec(
i_d
im)*
r_d
um
my
&*
h_
ma
t_in
v(i_
dim
,i_d
im)
en
dd
o
113
B. Programse
nd
do
en
dif
en
dd
o!-
---
calc
ula
tefo
rce
fro
me
ach
mod
e"i
_re
c_ve
c"o
nb
ox
sha
pe
if(f_
pre
ssu
re.e
q.1
)th
en
r_d
um
my
=(1
./(2
*alp
ha
**2
)+2
./q
_2
)*v_
mod
ed
oi_
dim
=1
,n_d
imfo
rce
_sc
al_
rec(
i_d
im)
=fo
rce
_sc
al_
rec(
i_d
im)
+&
(v_
mo
de
-r_
du
mm
y*q
_ve
c(i_
dim
)**2
)e
nd
do
en
dif
en
dd
o
en
dd
o
v_e
wa
ld=
v_e
wa
ld+
rec_
po
t_o
ffse
t
if(f_
pre
ssu
re.e
q.1
)th
en
do
i_d
im=
1,n
_d
imfo
rce
_sc
al_
rec(
i_d
im)
=fo
rce
_sc
al_
rec(
i_d
im)
+&
rec_
forc
e_
offse
t(i_
dim
)d
oj_
dim
=1,
n_
dim
forc
e_
sca
l(i_
dim
)=
forc
e_
sca
l(i_
dim
)+
&h
_m
at_
inv(
i_d
im,j_
dim
)*
forc
e_
scal_
rec(
j_d
im)
en
dd
oe
nd
do
en
dif
v_in
ter
=v_
inte
r+
v_e
wa
ld
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
calc
_d
ista
nce
(r_
2,i_
tro
t,i_
pa
rt,j_
pa
rt)
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
do
ub
lep
reci
sio
nr_
2
do
i_d
im=
1,n
_d
imd
elta
_ce
ll(i_
dim
)=
&r0
(i_
dim
,i_tr
ot,i_
pa
rt)
-r0
(i_
dim
,i_tr
ot,j_
pa
rt)
if(d
elta
_ce
ll(i_
dim
).g
t.0
.5)
the
nd
elta
_ce
ll(i_
dim
)=
de
lta_
cell(
i_d
im)
-1
.e
lse
if(d
elta
_ce
ll(i_
dim
).lt.
-0.5
)th
en
de
lta_
cell(
i_d
im)
=d
elta
_ce
ll(i_
dim
)+
1.
en
dif
en
dd
o!-
---
term
squ
are
r_2
=0
.d
oi_
dim
=1,
n_
dim
r_2
=r_
2+
met_
ten
_vo
i(i_
dim
)*
de
lta_ce
ll(i_
dim
)**2
en
dd
oif
(e_
dim
.eq.3
)th
en
r_2
=r_
2&
+m
et_
ten
_vo
i(4
)*
de
lta_
cell(
1)
*de
lta_
cell(
2)
&+
me
t_te
n_
voi(5
)*
de
lta_
cell(
2)
*de
lta_
cell(
3)
&+
me
t_te
n_
voi(6
)*
de
lta_
cell(
3)
*de
lta_
cell(
1)
en
dif
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
calc
_d
ist_
pb
c(r_
2,i_
tro
t,i_
pa
rt,j_
pa
rt,
&p
bc_
x,p
bc_
y,p
bc_
z)im
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
do
ub
lep
reci
sio
nr_
2in
teg
er
pb
c_x,
pb
c_y,
pb
c_z,
pb
c(n
_d
im)
pb
c(1
)=p
bc_
xp
bc(
2)=
pb
c_y
pb
c(3
)=p
bc_
z
do
i_d
im=
1,n
_d
imd
elta
_ce
ll(i_
dim
)=
&r0
(i_
dim
,i_tr
ot,i_
pa
rt)
-r0
(i_
dim
,i_tr
ot,j_
pa
rt)
if(d
elta
_ce
ll(i_
dim
).g
t.0
.5)
the
nd
elta
_ce
ll(i_
dim
)=
de
lta_
cell(
i_d
im)
-1
.e
lse
if(d
elta
_ce
ll(i_
dim
).lt.
-0.5
)th
en
de
lta_
cell(
i_dim
)=
de
lta_
cell(
i_d
im)
+1
.e
nd
ife
nd
do
do
i_d
im=
1,n
_d
imd
elta
_ce
ll(i_
dim
)=
de
lta_
cell(
i_d
im)
+&
1.0
*pb
c(i_
dim
)e
nd
do
!---
-te
rmsq
ua
rer_
2=
0.
do
i_d
im=
1,
n_
dim
r_2
=r_
2+
me
t_te
n_
voi(i_
dim
)*
de
lta_
cell(
i_d
im)*
*2e
nd
do
if(e
_d
im.e
q.3
)th
en
r_2
=r_
2&
+m
et_
ten
_vo
i(4
)*
de
lta_
cell(
1)
*d
elta
_ce
ll(2
)&
+m
et_
ten
_vo
i(5
)*
de
lta_
cell(
2)
*d
elta
_ce
ll(3
)&
+m
et_
ten
_vo
i(6
)*
de
lta_
cell(
3)
*d
elta
_ce
ll(1
)e
nd
if
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
calc
_d
ist_
int(
r_2
)im
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
do
ub
lep
reci
sio
nr_
2!-
---
term
squ
are
do
i_d
im=
1,n
_d
imd
elta
_r(
i_d
im)
=sc
al_
0(i_
dim
)*
de
lta_
cell(
i_d
im)
r_2
=r_
2+
me
t_te
n_
voi(i_
dim
)*
de
lta_
cell(
i_d
im)*
*2e
nd
do
if(e
_d
im.e
q.3
)th
en
r_2
=r_
2&
+m
et_
ten
_vo
i(4
)*
de
lta_
cell(
1)*
de
lta_
cell(
2)
&+
me
t_te
n_vo
i(5
)*
de
lta_
cell(
2)*
de
lta_
cell(
3)
&+
me
t_te
n_vo
i(6
)*
de
lta_
cell(
3)*
de
lta_
cell(
1)
en
dif
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
114
B.1. Molecular Dynamics Code
sub
rou
tine
ha
rm_
osc
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
do
ub
lep
reci
sion
v_in
ter_
loc
do
ub
lep
reci
sion
r_1
,r_
2
v_in
ter
=0
.!-
---
ha
rmo
nic
osc
illa
tor
do
i_p
art
=1
,n_
pa
rtv_
inte
r_lo
c=
0.
do
i_d
im=
1,n
_d
imd
oi_
tro
t=
0,n
_tr
ot-
1r_
du
mm
y=
r0(i_
dim
,i_tr
ot,i_
pa
rt)
forc
e(i_
dim
,i_tr
ot,i_
pa
rt)
=fo
rce
(i_
dim
,i_tr
ot,i_
pa
rt)
-&
r_d
um
my
v_in
ter_
loc
=v_
inte
r_lo
c+
r_d
um
my*
*2e
nd
do
en
dd
ov_
inte
r=
v_in
ter
+v_
inte
r_lo
ce
nd
do
v_in
ter
=v_
inte
r/2
viri_
est
=v_
inte
r
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
bo
x_ch
ain
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
!---
term
coup
lh
_d
ot
an
dve
loci
ties
do
i_p
art
=1
,n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
do
j_tr
ot
=0,n
_tr
ot-
1i_
tro
t=
j_tr
ot
+1
if(i_
tro
t.eq
.2)
i_tr
ot
=n
_tr
ot
+1
i_d
um
my
=(i_
tro
t-1
)/2
do
i_d
im=
1,n
_d
imf0
(i_
dim
,i_tr
ot,i_
pa
rt)
=f0
(i_
dim
,i_tr
ot,i_
pa
rt)
-&
g_
voi_
dot(
i_d
im)
*m
ass
(i_
du
mm
y,i_
typ
e)
*&
ux(
1,i_
dim
,i_tr
ot,i_
pa
rt)
/d
t_2
en
dd
oif
(e_
dim
.eq
.3)
the
nf0
(1,i_
tro
t,i_
pa
rt)
=f0
(1,i_
tro
t,i_
part
)-
(&
g_
voi_
dot(
4)*
ma
ss(i_
du
mm
y,i_
typ
e)*
ux(
1,2
,i_tr
ot,i_
pa
rt)
+&
g_
voi_
dot(
6)*
ma
ss(i_
du
mm
y,i_
typ
e)*
ux(
1,3
,i_tr
ot,i_
pa
rt)
)/d
t_2
&/
2f0
(2,i_
tro
t,i_
pa
rt)
=f0
(2,i_
tro
t,i_
part
)-
(&
g_
voi_
dot(
5)*
ma
ss(i_
du
mm
y,i_
typ
e)*
ux(
1,3
,i_tr
ot,i_
pa
rt)
+&
g_
voi_
dot(
4)*
ma
ss(i_
du
mm
y,i_
typ
e)*
ux(
1,1
,i_tr
ot,i_
pa
rt)
)/d
t_2
&/
2f0
(3,i_
tro
t,i_
pa
rt)
=f0
(3,i_
tro
t,i_
part
)-
(&
g_
voi_
dot(
6)*
ma
ss(i_
du
mm
y,i_
typ
e)*
ux(
1,1
,i_tr
ot,i_
pa
rt)
+&
g_
voi_
dot(
5)*
ma
ss(i_
du
mm
y,i_
typ
e)*
ux(
1,2
,i_tr
ot,i_
pa
rt)
)/d
t_2
&/
2e
nd
ife
nd
do
en
dd
o
!---
-sy
mm
etr
ize
do
i_tr
ot
=1
,n_
tro
t/2
-1d
oi_
dim
=1,n
_d
imd
oi_
pa
rt=
1,n
_p
art
f0(i_
dim
,2*(
n_
tro
t-i_
tro
t)+
1,i_
pa
rt)
=&
f0(i_
dim
,2*i
_tr
ot+
1,i_
pa
rt)
en
dd
oe
nd
do
en
dd
o
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
len
na
rd_
jon
es
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
do
ub
lep
reci
sio
nv_
inte
r_lo
cd
ou
ble
pre
cisi
on
r_2
,r_
6,
r_1
2,
po
t_lo
c,r_
4_
inv
do
ub
lep
reci
sio
nd
yn_
ma
t(n
_d
im,n
_d
im),
loc_
dyn
_m
at(
n_
dim
,n_
dim
)
v_in
ter
=0
.d
oi_
dim
=1,
n_
dim
+3
forc
e_
sca
l_in
ter(
i_d
im)
=0
.e
nd
do
if(
(i_
time.g
t.n
_re
lax)
.an
d.
(mo
d(i_
time
,20
).e
q.0
))
the
nd
oi_
dim
=1
,n_
dim
do
j_d
im=
i_d
im,
n_
dim
do
k_d
im=
i_d
im,n
_d
imd
ol_
dim
=k_
dim
,n_
dim
if(i_
dim
+j_
dim
.le.k
_d
im+
l_d
im)
then
ela
_b
orn
(i_
dim
,j_d
im,k
_d
im,l_
dim
)=
0.
en
dif
en
dd
oe
nd
do
en
dd
oe
nd
do
do
i_d
im=
1,
n_
dim
do
j_d
im=
1,
n_
dim
stra
in(i_
dim
,j_d
im)
=0
.e
nd
do
en
dd
oe
nd
if
do
i_p
art
=1
,n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
v_in
ter_
loc
=0.
do
i_n
eig
h=
1,n
eig
hb
or(
0,i_
pa
rt)
j_p
art
=n
eig
hb
or(
i_n
eig
h,i_
pa
rt)
j_ty
pe
=ty
pe(j_
pa
rt)
po
t_lo
c=
0.
do
i_tr
ot
=0,n
_tr
ot-
1
call
calc
_dis
tan
ce(r
_2
,i_tr
ot,i_
pa
rt,j_
pa
rt)
if(r_
2.lt
.r_
cuto
ff_
2(i_
typ
e,j_
typ
e))
the
nr_
6=
(sig
ma
_2
(i_
typ
e,j_
typ
e)/
r_2
)**3
r_1
2=
r_6
**2
po
t_lo
c=
po
t_lo
c+
(r_
12
-r_
6)
-e
_sh
ift(i_
typ
e,j_
typ
e)
!---
-r_
du
mm
y=
{\p
art
ial
V\o
ver
\pa
rtia
lr}
/r
115
B. Programsr_
du
mm
y=
ep
sil(i_
typ
e,j_
typ
e)*
(-1
2*r
_1
2+
6*r
_6
)/r_
2
call
calc
_fo
rce
_lo
c(r_
du
mm
y,i_
tro
t,i_
pa
rt,j_
pa
rt)
if(
(i_
time
.gt.n
_re
lax)
.an
d.
(mo
d(i_
time
,20
).e
q.0
))
the
n!-
---
calc
ula
teb
orn
ela
stic
con
sta
nts
r_4
_in
v=
1.
/r_
2**
2ca
lllo
c_d
ynm
at(
loc_
dyn
_m
at,
de
lta_
r,r_
2,
-12
.d0
)d
oi_
dim
=1
,n
_d
imd
oj_
dim
=1
,n
_d
imd
yn_
ma
t(i_
dim
,j_d
im)
=si
gm
a_
2(i_
typ
e,j_
typ
e)*
*6*
&lo
c_d
yn_
ma
t(i_
dim
,j_d
im)
en
dd
oe
nd
do
call
loc_
dyn
ma
t(lo
c_d
yn_
ma
t,d
elta
_r,
r_2
,-6
.d0
)d
oi_
dim
=1
,n
_d
imd
oj_
dim
=1
,n
_d
imd
yn_
ma
t(i_
dim
,j_d
im)
=e
psi
l(i_
typ
e,j_
typ
e)
*r_
4_
inv
*&
(d
yn_
ma
t(i_
dim
,j_d
im)
-&
sig
ma_
2(i_
typ
e,j_
typ
e)*
*3*
loc_
dyn
_m
at(
i_d
im,j_
dim
))
en
dd
oe
nd
do
do
i_d
im=
1,
n_
dim
do
j_d
im=
i_d
im,
n_
dim
do
k_d
im=
i_d
im,
n_
dim
do
l_d
im=
k_d
im,
n_
dim
if(i_
dim
+j_
dim
.le.k
_d
im+
l_d
im)
the
ne
la_
bo
rn(i_d
im,
j_d
im,
k_d
im,
l_d
im)
=&
ela
_b
orn
(i_
dim
,j_
dim
,k_
dim
,l_
dim
)+
de
lta_
r(i_
dim
)*
&d
yn_
mat(
j_d
im,k
_d
im)
*d
elta
_r(
l_d
im)
en
dif
en
dd
oe
nd
do
en
dd
oe
nd
do
!---
-ca
lcu
late
stra
inte
nso
rd
oi_
dim
=1
,n
_d
imd
oj_
dim
=1
,n
_d
imst
rain
(i_
dim
,j_d
im)
=st
rain
(i_
dim
,j_dim
)+
&r_
du
mm
y*
de
lta_
r(i_
dim
)*
de
lta_
r(j_
dim
)e
nd
do
en
dd
oe
nd
if
en
dif
en
dd
ov_
inte
r_lo
c=
v_in
ter_
loc
+e
psi
l(i_
typ
e,j_
typ
e)*
po
t_lo
ce
nd
do
v_in
ter
=v_
inte
r+
v_in
ter_
loc
en
dd
o
call
forc
e_
on
_sc
al
if(
(i_
time.g
t.n
_re
lax)
.an
d.
(mo
d(i_
time
,20
).e
q.0
))
the
ntim
e_
bo
rn=
time
_b
orn
+d
td
oi_
dim
=1
,n
_d
imd
oj_
dim
=i_
dim
,n
_d
imd
ok_
dim
=i_
dim
,n
_d
imd
ol_
dim
=k_
dim
,n
_d
imif
(i_
dim
+j_
dim
.le.k
_d
im+
l_d
im)
the
n
ela
_b
orn
_1
(i_
dim
,j_
dim
,k_
dim
,l_
dim
)=
&e
la_
born
_1
(i_
dim
,j_
dim
,k_
dim
,l_
dim
)+
dt
*&
ela
_b
orn
(i_
dim
,j_
dim
,k_
dim
,l_
dim
)/
(vo
lum
e*n
_tr
ot)
en
dif
en
dd
oe
nd
do
en
dd
oe
nd
do
do
i_d
im=
1,
n_
dim
do
j_d
im=
1,
n_
dim
stra
in_
1(i_
dim
,j_d
im)
=st
rain
_1
(i_
dim
,j_d
im)
&+
stra
in(i_
dim
,j_d
im)
*d
td
ok_
dim
=i_
dim
,n
_d
imd
ol_
dim
=k_
dim
,n
_d
imst
rain
_2
(i_
dim
,j_
dim
,k_
dim
,l_
dim
)=
&st
rain
_2
(i_
dim
,j_
dim
,k_
dim
,l_
dim
)+
&st
rain
(i_
dim
,j_
dim
)*
stra
in(k
_d
im,
l_d
im)
*d
te
nd
do
en
dd
oe
nd
do
en
dd
oe
nd
if
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
loc_
dyn
ma
t(d
yn_
ma
t,d
r,r_
2,
n)
imp
licit
no
ne
inte
ge
ri_
dim
,j_
dim
,n
_d
imp
ara
me
ter
(n_
dim
=3
)d
ou
ble
pre
cisi
on
dr(
n_
dim
),r_
2,
r_n,
nd
ou
ble
pre
cisi
on
dyn
_m
at(
n_
dim
,n_
dim
),r_
du
mm
y
if(n
.ge
.0.)
the
nr_
n=
r_2
**(0
.5*n
)e
lse
r_n
=1
./
r_2**
(-0
.5*n
)e
nd
if
do
i_d
im=
1,
n_
dim
do
j_d
im=
1,
n_
dim
if(i_
dim
.eq
.j_d
im)
r_d
um
my
=n
*r_
2if(
i_d
im.n
e.j_
dim
)r_
du
mm
y=
0.
dyn
_m
at(
i_d
im,j_
dim
)=
r_d
um
my
&+
n*(
n-2
)*
dr(
i_d
im)
*d
r(j_
dim
)d
yn_
ma
t(i_
dim
,j_d
im)
=d
yn_
ma
t(i_
dim
,j_d
im)
*r_
ne
nd
do
en
dd
o
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
calc
_fo
rce
_lo
c(r_
du
mm
y,i_
tro
t,i_
pa
rt,j_
pa
rt)
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
do
i_d
im=
1,
n_
dim
de
lta_
r(i_
dim
)=
sca
l_0
(i_
dim
)*d
elta
_ce
ll(i_
dim
)e
nd
do
if(e
_d
im.e
q.3
)th
en
116
B.1. Molecular Dynamics Code
de
lta_
r(1
)=
de
lta_
r(1
)&
+sc
al_
0(4
)*d
elta
_ce
ll(2
)+
sca
l_0
(6)*
de
lta_
cell(
3)
de
lta_
r(2
)=
de
lta_
r(2
)&
+sc
al_
0(5
)*d
elta
_ce
ll(3
)+
sca
l_0
(4)*
de
lta_
cell(
1)
de
lta_
r(3
)=
de
lta_
r(3
)&
+sc
al_
0(6
)*d
elta
_ce
ll(1
)+
sca
l_0
(5)*
de
lta_
cell(
2)
en
dif
do
i_d
im=
1,
n_
dim
!---
-te
rmii
forc
e_
loc(
i_dim
)=
r_d
um
my
*d
elta
_ce
ll(i_
dim
)fo
rce
(i_
dim
,i_tr
ot,i_
pa
rt)
=-
forc
e_lo
c(i_
dim
)+
&fo
rce
(i_
dim
,i_tr
ot,i_
pa
rt)
forc
e(i_
dim
,i_tr
ot,j_
pa
rt)
=+
forc
e_lo
c(i_
dim
)+
&fo
rce
(i_
dim
,i_tr
ot,j_
pa
rt)
forc
e_
sca
l_in
ter(
i_d
im)
=fo
rce
_sc
al_
inte
r(i_
dim
)-
&fo
rce
_lo
c(i_
dim
)*
de
lta_
r(i_
dim
)e
nd
do
!---
-te
rmiv
if(e
_d
im.e
q.3
)th
en
!---
sym
me
triz
ed
"str
ess
"fie
ldfo
rce
_sc
al_
inte
r(4
)=
forc
e_
sca
l_in
ter(
4)
-&
(fo
rce
_lo
c(1
)*d
elta
_r(
2)
+fo
rce
_lo
c(2
)*d
elta
_r(
1)
)/
2fo
rce
_sc
al_
inte
r(5
)=
forc
e_
sca
l_in
ter(
5)
-&
(fo
rce
_lo
c(2
)*d
elta
_r(
3)
+fo
rce
_lo
c(3
)*d
elta
_r(
2)
)/
2fo
rce
_sc
al_
inte
r(6
)=
forc
e_
sca
l_in
ter(
6)
-&
(fo
rce
_lo
c(3
)*d
elta
_r(
1)
+fo
rce
_lo
c(1
)*d
elta
_r(
3)
)/
2e
nd
ife
nd
sub
rou
tine
!!
!!
!!
!!
!!
!
sub
rou
tine
forc
e_
on
_sc
al
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
!---
-ch
an
ge
tra
nsf
orm
do
i_d
im=
1,n
_d
im+
e_
dim
forc
e_
sca
l(i_
dim
)=
forc
e_
sca
l(i_
dim
)+
forc
e_
sca
l_in
ter(
i_d
im)
en
dd
o
!---
ad
de
xte
rna
lp
ress
ure
!---
term
pre
ssv_
pre
ss=
v_p
ress
+n
_tr
ot
*p
ress
*vo
lum
ed
oi_
dim
=1
,n
_d
imfo
rce
_sc
al(i_
dim
)=
forc
e_
sca
l(i_
dim
)-
&n
_tr
ot
*pre
ss*v
olu
me
*h
_m
at_
inv(
i_d
im,i_
dim
)e
nd
do
if(e
_d
im.e
q.3
)th
en
forc
e_
sca
l(4
)=
forc
e_
sca
l(4
)-
&n
_tr
ot
*pre
ss*v
olu
me
*h
_m
at_
inv(
1,2
)fo
rce
_sc
al(5
)=
forc
e_
sca
l(5
)-
&n
_tr
ot
*pre
ss*v
olu
me
*h
_m
at_
inv(
2,3
)fo
rce
_sc
al(6
)=
forc
e_
sca
l(6
)-
&n
_tr
ot
*pre
ss*v
olu
me
*h
_m
at_
inv(
3,1
)e
nd
if
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
calc
_3
bo
dy_
forc
e_
loc(
fi,fj,
fk,
&i_
tro
t,i_
pa
rt,j_
pa
rt,k
_p
art
)im
plic
itn
one
incl
ud
e"p
imd
.co
m.f"
do
ub
lep
reci
sio
nfi,
fj,fk
inte
ge
rk_
part
do
i_d
im=
1,
n_
dim
de
lta_
r(i_
dim
)=
sca
l_0
(i_
dim
)*d
elta
_ce
ll(i_
dim
)e
nd
do
if(e
_d
im.e
q.3
)th
en
de
lta_
r(1
)=
de
lta_
r(1
)&
+sc
al_
0(4
)*d
elta
_ce
ll(2
)+
sca
l_0
(6)*
de
lta_
cell(
3)
de
lta_
r(2
)=
de
lta_
r(2
)&
+sc
al_
0(5
)*d
elta
_ce
ll(3
)+
sca
l_0
(4)*
de
lta_
cell(
1)
de
lta_
r(3
)=
de
lta_
r(3
)&
+sc
al_
0(6
)*d
elta
_ce
ll(1
)+
sca
l_0
(5)*
de
lta_
cell(
2)
en
dif
do
i_d
im=
1,
n_
dim
!---
-te
rmii
forc
e(i_
dim
,i_tr
ot,i_
pa
rt)
=+
fi*
de
lta_
cell(
i_d
im)
+&
forc
e(i_
dim
,i_tr
ot,i_
pa
rt)
forc
e(i_
dim
,i_tr
ot,j_
pa
rt)
=+
fj*
de
lta_
cell(
i_d
im)
+&
forc
e(i_
dim
,i_tr
ot,j_
pa
rt)
forc
e(i_
dim
,i_tr
ot,k_
pa
rt)
=+
fk*
de
lta_
cell(
i_d
im)
+&
forc
e(i_
dim
,i_tr
ot,k_
pa
rt)
forc
e_
loc(
i_d
im)
=fj
*d
elta
_ce
ll(i_
dim
)fo
rce
_sc
al_
inte
r(i_
dim
)=
forc
e_
sca
l_in
ter(
i_d
im)
-&
forc
e_lo
c(i_
dim
)*
de
lta_
r(i_
dim
)e
nd
do
!---
-te
rmiv
if(e
_d
im.e
q.3
)th
en
!---
sym
me
triz
ed
"str
ess
"fie
ldfo
rce
_sc
al_
inte
r(4
)=
forc
e_
sca
l_in
ter(
4)
-&
(fo
rce
_lo
c(1
)*d
elta
_r(
2)
+fo
rce
_lo
c(2
)*d
elta
_r(
1)
)/
2fo
rce
_sc
al_
inte
r(5
)=
forc
e_
sca
l_in
ter(
5)
-&
(fo
rce
_lo
c(2
)*d
elta
_r(
3)
+fo
rce
_lo
c(3
)*d
elta
_r(
2)
)/
2fo
rce
_sc
al_
inte
r(6
)=
forc
e_
sca
l_in
ter(
6)
-&
(fo
rce
_lo
c(3
)*d
elta
_r(
1)
+fo
rce
_lo
c(1
)*d
elta
_r(
3)
)/
2e
nd
if
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
go
dd
ard
_p
ote
ntia
lim
plic
itn
one
incl
ud
e"p
imd
.co
m.f"
call
two
bo
dy_
po
ten
tial
call
forc
e_
on
_sc
al
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
vash
ish
ta_
po
ten
tial
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
inte
ge
ri_
ang
,k_
pa
rtd
ou
ble
pre
cisi
on
cosj
ik,
rij,
rik,
fij,
fik,
fjj,
fjk,
fkj,
fkk
do
ub
lep
reci
sio
nfa
cto
r1,
term
1,
term
j,te
rmk,
&r_
ij(n
_d
im),
r_ik
(n_
dim
),&
de
lta_
ij(n
_d
im),
de
lta_
ik(n
_d
im)
117
B. Programsca
lltw
ob
od
y_p
ote
ntia
l!
thre
eb
ody
con
trib
utio
ns:
j-i-k
call
bo
nd
_a
na
lysi
sv_
thre
eb
od
y=0
.d0
do
i_p
art
=1
,n
_p
art
i_ty
pe
=ty
pe
(i_
pa
rt)
do
i_a
ng
=1
,n
_an
g(i_
typ
e)
j_p
art
=tr
iple
_p
art
j(i_
pa
rt,i_
an
g)
k_p
art
=tr
iple
_p
art
k(i_
pa
rt,i_
an
g)
cosj
ik=
trip
le_
cos(
i_p
art
,i_a
ng
)rij=
trip
le_
rij(i_
pa
rt,i_
an
g)
rik=
trip
le_
rik(
i_p
art
,i_a
ng
)
if((
rij.g
e.v
ash
_r0
(i_
typ
e))
.or.
(rik
.ge
.va
sh_
r0(i_
typ
e))
)&
the
n!
v_th
ree
bo
dy=
=0
:a
dd
no
forc
es,
no
en
erg
ies
els
e!
on
lyif
rij
an
drik
<r0
fact
or1
=1
/(rij-va
sh_
r0(i_
typ
e))
+1
/(rik-
vash
_r0
(i_
typ
e))
fact
or1
=e
xp(v
ash
_l(i_
typ
e)*
fact
or1
)fa
cto
r1=
fact
or1
*(co
sjik
-va
sh_
cth
eta
(i_ty
pe
))fa
cto
r1=
vash
_B
(i_
typ
e)*
fact
or1
fact
or1
=fa
ctor1
*ele
c_p
refa
c
term
j=va
sh_
l(i_
typ
e)*
(co
sjik
-va
sh_
cth
eta
(i_
typ
e))
term
k=te
rmj
term
j=te
rmj/(
rij*
(rij-
vash
_r0
(i_
typ
e))
**2
)te
rmj=
2*c
osj
ik/(
rij*
*2)+
term
j
term
k=te
rmk/
(rik
*(rik-
vash
_r0
(i_
typ
e))
**2
)te
rmk=
2*c
osj
ik/(
rik*
*2)+
term
k
term
1=
2/(
rik*
rij)
!w
rite
(*,*
)i_
pa
rt,i_
typ
e,i_
an
g,j_
pa
rt,k
_p
art
,!
&1
80
*aco
s(co
sjik
)/p
i,rij,
rik
!ca
lcu
late
forc
es
inij
dire
ctio
nd
oi_
dim
=1
,n_
dim
de
lta_
ij(i_
dim
)=tr
iple
_d
elta
ij(i_
pa
rt,i_
an
g,i_
dim
)e
nd
do
fij=
-fa
cto
r1*(
term
1-t
erm
j)fjj
=-f
act
or1
*te
rmj
fkj=
+fa
cto
r1*t
erm
1!
call
calc
_3
bo
dy_
forc
e_lo
c(fi,
fj,fk
,0,i_
pa
rt,j_
pa
rt,k
_p
art
)
!ca
lcu
late
forc
es
inik
dire
ctio
nd
oi_
dim
=1
,n_
dim
de
lta_
ik(i_
dim
)=tr
iple
_d
elta
ik(i_
pa
rt,i_
an
g,i_
dim
)e
nd
do
fik=
-fa
cto
r1*(
term
1-t
erm
k)fjk
=+
fact
or1
*te
rm1
fkk=
-fa
cto
r1*t
erm
k!
call
calc
_3
bo
dy_
forc
e_lo
c(fi,
fj,fk
,0,i_
pa
rt,j_
pa
rt,k
_p
art
)
do
i_d
im=
1,
n_
dim
r_ij(
i_d
im)
=sc
al_
0(i_
dim
)*d
elta
_ij(
i_d
im)
en
dd
oif
(e_
dim
.eq.3
)th
en
r_ij(
1)
=r_
ij(1
)&
+sc
al_
0(4
)*d
elta
_ij(
2)
+sc
al_
0(6
)*de
lta_
ij(3
)
r_ij(
2)
=r_
ij(2
)&
+sc
al_
0(5
)*d
elta
_ij(
3)
+sc
al_
0(4
)*d
elta
_ij(
1)
r_ij(
3)
=r_
ij(3
)&
+sc
al_
0(6
)*d
elta
_ij(
1)
+sc
al_
0(5
)*d
elta
_ij(
2)
en
dif
do
i_d
im=
1,
n_
dim
r_ik
(i_
dim
)=
sca
l_0
(i_
dim
)*d
elta
_ik
(i_
dim
)e
nd
do
if(e
_d
im.e
q.3
)th
en
r_ik
(1)
=r_
ik(1
)&
+sc
al_
0(4
)*d
elta
_ik
(2)
+sc
al_
0(6
)*d
elta
_ik
(3)
r_ik
(2)
=r_
ik(2
)&
+sc
al_
0(5
)*d
elta
_ik
(3)
+sc
al_
0(4
)*d
elta
_ik
(1)
r_ik
(3)
=r_
ik(3
)&
+sc
al_
0(6
)*d
elta
_ik
(1)
+sc
al_
0(5
)*d
elta
_ik
(2)
en
dif
i_tr
ot=
0
do
i_d
im=
1,
n_
dim
!---
-te
rmii
forc
e(i_
dim
,i_tr
ot,i_
pa
rt)
=+
fij*
de
lta_
ij(i_
dim
)+
&fik
*d
elta
_ik
(i_
dim
)+
&fo
rce(i_
dim
,i_tr
ot,i_
pa
rt)
forc
e(i_
dim
,i_tr
ot,j_
pa
rt)
=+
fjj*
de
lta_
ij(i_
dim
)+
&fjk
*d
elta
_ik
(i_
dim
)+
&fo
rce(i_
dim
,i_tr
ot,j_
pa
rt)
forc
e(i_
dim
,i_tr
ot,k_
pa
rt)
=+
fkj
*d
elta
_ij(
i_d
im)
+&
fkk
*d
elta
_ik
(i_
dim
)+
&fo
rce(i_
dim
,i_tr
ot,k_
pa
rt)
forc
e_
sca
l_in
ter(
i_d
im)
=fo
rce
_sc
al_
inte
r(i_
dim
)&
-fjj
*d
elta
_ij(
i_d
im)
*r_
ij(i_
dim
)&
-fjk
*d
elta
_ik
(i_
dim
)*
r_ij(
i_d
im)
&-
fkj
*d
elta
_ij(
i_d
im)
*r_
ik(i_
dim
)&
-fk
k*
de
lta_
ik(i_
dim
)*
r_ik
(i_
dim
)e
nd
do
!---
-te
rmiv
if(e
_d
im.e
q.3
)th
en
!---
sym
me
triz
ed
"str
ess
"fie
ldfo
rce
_sc
al_
inte
r(4
)=
forc
e_
sca
l_in
ter(
4)
-&
(fjj
*d
elta
_ij(
1)*
r_ij(
2)
+fjj
*d
elta
_ij(
2)*
r_ij(
1)
)/
2-
&(
fjk*
delta
_ik
(1)*
r_ij(
2)
+fjk
*d
elta
_ik
(2)*
r_ij(
1)
)/
2-
&(
fkj
*d
elta
_ij(
1)*
r_ik
(2)
+fk
j*
de
lta_
ij(2
)*r_
ik(1
))
/2
-&
(fk
k*
delta
_ik
(1)*
r_ik
(2)
+fk
k*
de
lta_
ik(2
)*r_
ik(1
))
/2
forc
e_
sca
l_in
ter(
5)
=fo
rce
_sc
al_
inte
r(5
)-
&(
fjj*
delta
_ij(
2)*
r_ij(
3)
+fjj
*d
elta
_ij(
3)*
r_ij(
2)
)/
2-
&(
fjk*
delta
_ik
(2)*
r_ij(
3)
+fjk
*d
elta
_ik
(3)*
r_ij(
2)
)/
2-
&(
fkj
*d
elta
_ij(
2)*
r_ik
(3)
+fk
j*
de
lta_
ij(3
)*r_
ik(2
))
/2
-&
(fk
k*
delta
_ik
(2)*
r_ik
(3)
+fk
k*
de
lta_
ik(3
)*r_
ik(2
))
/2
forc
e_
sca
l_in
ter(
6)
=fo
rce
_sc
al_
inte
r(6
)-
&(
fjj*
delta
_ij(
3)*
r_ij(
1)
+fjj
*d
elta
_ij(
1)*
r_ij(
3)
)/
2-
&(
fjk*
delta
_ik
(3)*
r_ij(
1)
+fjk
*d
elta
_ik
(1)*
r_ij(
3)
)/
2-
&(
fkj
*d
elta
_ij(
3)*
r_ik
(1)
+fk
j*
de
lta_
ij(1
)*r_
ik(3
))
/2
-&
(fk
k*
delta
_ik
(3)*
r_ik
(1)
+fk
k*
de
lta_
ik(1
)*r_
ik(3
))
/2
en
dif
v_th
ree
bo
dy
=v_
thre
eb
od
y&
+fa
cto
r1*(
cosj
ik-
vash
_ct
he
ta(i_
typ
e))
en
dif
!o
nly
ifrij
an
drik
<r0
118
B.1. Molecular Dynamics Code
en
dd
oe
nd
do
v_in
ter
=v_
inte
r+
v_th
ree
bo
dy
call
forc
e_
on
_sc
al
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!!
!!
sub
rou
tine
sca
nd
olo
_p
ote
ntia
lc
use
me
tric
use
ne
igh
bou
ru
sep
ola
r!
toa
cce
ssd
ipo
les
imp
licit
dou
ble
pre
cisi
on
(a-h
,o-z
)in
clu
de
"pim
d.c
om
2.f"
cch
ara
cte
r*2
5fil
ep
os,
file
cel
rea
l*8
,a
lloca
tab
le::
r(:,:)
rea
l*8
,a
lloca
tab
le::
sfo
rce
(:,:)
rea
l*8
stre
ss(3
,3),
htin
(3,3
)lo
gic
al
rest
art
,tce
lin
teg
er
n_
pa
rt_ty
pe
(n_
typ
e)
inte
ge
ri_
cla
ss
!a
ssig
nth
eva
ria
ble
sn
_re
lax_
sc=
n_re
lax
na
t=n
_p
art
nsp
=n
_ty
pe
A_
ew
=1
.0d
-8rc
ut=
18
.02
70
3n
na
tma
x=n
_n
eig
hie
sr=
n_
pb
c!
sea
rch
cell
an
dn
eig
hb
orin
gim
ag
ece
lls
ca
lloca
te(s
forc
e(3
,na
t))
allo
cate
(r(3
,na
t))
allo
cate
(sp
ind(n
at)
)c
do
i=1
,na
td
oj=
1,
3r(
j,i)
=r_
real(j,0
,i)sp
ind
(i)
=ty
pe
(i)
en
dd
oe
nd
do
call
tra
ns_
to_
ten
s(sc
al_
0,
ht)
cr
=r/
0.5
29
2d0
ht
=h
t/0
.52
92
d0
ca
lloca
te(n
nlis
t(n
at,n
na
tma
x))
allo
cate
(nn
at(
na
t))
allo
cate
(nn
_im
ag
(3,n
at,n
na
tma
x))
cca
llin
v3(h
t,h
tm1
,om
eg
a)
call
nb
rlis
t(r,
nn
atm
ax)
ch
tin=
ht
c !se
tre
start
tru
eif
first
MD
ste
pif
(i_
time
.eq
.1)
the
nre
sta
rt=
.tru
e.
els
e rest
art
=.fals
e.
en
dif
if(f
_p
ress
ure
.eq
.1)
the
ntc
el
=.tru
e.
els
e tce
l=
.fa
lse.
en
dif
cca
llfo
rce
_ft(r
,en
erg
y,sf
orc
e,s
tre
ss,a
_e
w,i_
time
,.fa
lse
.,&
.fa
lse
.,h
tin,r
est
art
,tce
l)c c !
con
vert
en
erg
yfr
om
Ha
rtre
eto
kBK
v_in
ter
=e
nerg
y*3
15
77
3.2
!co
nve
rtst
ress
:!
stre
ss(i,j)
*om
eg
ais
r_i*
F_
j/vo
lum
e*v
olu
me
inh
art
ree
!fo
rce
_sc
al_
inte
r()
isr_
i*
(hˆ-
1*
F)_
jin
kBK
/a
ng
stro
m!
htm
isin
a_
Bo
hr,
soh
tm1
*str
ess
*om
eg
ais
inh
art
ree
/a_
Bo
hr
forc
e_
sca
l_in
ter
=0
.d0
stre
ss=
+st
ress
do
j=1
,3d
oi_
dim
=1
,3fo
rce
_sc
al_
inte
r(i_
dim
)=
forc
e_
sca
l_in
ter(
i_d
im)
+&
htm
1(i_
dim
,j)*s
tre
ss(i_
dim
,j)*o
me
ga
*3
15
77
3.2
/0
.52
92
d0
en
dd
oif
(e_
dim
.eq
.3)
the
n!-
--sy
mm
etr
ize
d"s
tre
ss"
field
forc
e_
sca
l_in
ter(
4)
=fo
rce
_sc
al_
inte
r(4
)+
&(
htm
1(2
,j)*s
tre
ss(1
,j)*o
me
ga
*3
15
77
3.2
/0
.52
92
d0
+&
htm
1(1
,j)*s
tre
ss(2
,j)*o
me
ga
*3
15
77
3.2
/0
.52
92
d0
)*0
.5fo
rce
_sc
al_
inte
r(5
)=
forc
e_
sca
l_in
ter(
5)
+&
(h
tm1
(3,j)
*str
ess
(2,j)
*om
eg
a*
315
77
3.2
/0
.52
92
d0
+&
htm
1(2
,j)*s
tre
ss(3
,j)*o
me
ga
*3
15
77
3.2
/0
.52
92
d0
)*0
.5fo
rce
_sc
al_
inte
r(6
)=
forc
e_
sca
l_in
ter(
6)
+&
(h
tm1
(3,j)
*str
ess
(1,j)
*om
eg
a*
315
77
3.2
/0
.52
92
d0
+&
htm
1(1
,j)*s
tre
ss(3
,j)*o
me
ga
*3
15
77
3.2
/0
.52
92
d0
)*0
.5e
nd
ife
nd
do
!co
nve
rtfo
rce
:!
sfo
rce
()is
Fin
ha
rtre
e/
a_
Bo
hr
!fo
rce
()is
hˆ-
1*
Fin
kBK
/a
ng
stro
mˆ2
!h
tmis
ina
_B
oh
r,so
htm
1*s
forc
eis
inh
art
ree
/a_
Bo
hrˆ
2d
oi_
pa
rt=
1,n
at
do
j=1
,3fo
rce
(j,0
,i_p
art
)=0
do
i=1
,3fo
rce
(j,0
,i_p
art
)=fo
rce
(j,0
,i_p
art
)+
&h
tm1
(j,i)
*sfo
rce
(i,i_
pa
rt)*
&3
15
77
3.2
/(0
.52
92
d0
**2
)e
nd
do
en
dd
oe
nd
do
!co
nve
rtdip
ole
s
119
B. Programsd
oi_
pa
rt=
1,
n_
pa
rtd
oi_
dim
=1
,3
dip
ole
(i_
dim
,i_p
art
)=
dip
(i_
dim
,i_p
art
)*
0.5
29
2d
0e
nd
do
en
dd
oa
vg_
dip
ole
=0
.d0
n_
pa
rt_
typ
e=
0
do
i_p
art
=1
,n
_p
art
i_ty
pe
=ty
pe
(i_
pa
rt)
avg
_d
ipo
le(0
,i_ty
pe
)=
avg
_d
ipo
le(0
,i_ty
pe
)+
&sq
rt(
dip
ole
(1,i_
pa
rt)*
*2&
+d
ipo
le(2
,i_p
art
)**2
+d
ipo
le(3
,i_p
art
)**2
)d
oi_
dim
=1
,n
_d
ima
vg_
dip
ole
(i_d
im,i_
typ
e)
=a
vg_
dip
ole
(i_
dim
,i_ty
pe
)&
+d
ipo
le(i_
dim
,i_p
art
)e
nd
do
n_
pa
rt_
typ
e(i_ty
pe
)=
n_
pa
rt_
typ
e(i_
type
)+
1e
nd
do
do
i_ty
pe
=1
,n
_ty
pe
do
i_d
im=
0,
n_
dim
avg
_d
ipo
le(i_d
im,i_
typ
e)
=a
vg_
dip
ole
(i_
dim
,i_ty
pe
)/
&n_
pa
rt_
typ
e(i_
typ
e)
en
dd
oe
nd
do
if(i_
time
.eq
.1)
the
na
vg_
dip
ole
_p
art
=0
.d0
en
dif
do
i_p
art
=1
,n
_p
art
avg
_d
ipo
le_
pa
rt(0
,i_p
art
)=
avg
_d
ipo
le_p
art
(0,i_
pa
rt)
+&
sqrt
(d
ipo
le(1
,i_p
art
)**2
&+
dip
ole
(2,i_
pa
rt)*
*2+
dip
ole
(3,i_
pa
rt)*
*2)
do
i_d
im=
1,
n_
dim
avg
_d
ipo
le_
part
(i_
dim
,i_p
art
)=
&a
vg_
dip
ole
_p
art
(i_
dim
,i_p
art
)+
dip
ole
(i_
dim
,i_p
art
)e
nd
do
en
dd
o
dip
ole
_cl
ass
=0
.d0
do
i_p
art
=1
,n
_p
art
if(t
ype
(i_
pa
rt).
eq
.2)
the
ni_
cla
ss=
mo
d(i_
pa
rt-1
,18
)-5
dip
ole
_cl
ass
(0,i_
cla
ss)
=&
dip
ole
_cl
ass
(0,i_
cla
ss)
&+
sqrt
(dip
ole
(1,i_
pa
rt)*
*2+
dip
ole
(2,i_
pa
rt)*
*2+
&dip
ole
(3,i_
pa
rt)*
*2)/
(n_
oxy
/12
.)d
oi_
dim
=1
,3d
ipo
le_
cla
ss(i_
dim
,i_cl
ass
)=
&d
ipo
le_
cla
ss(i_
dim
,i_cl
ass
)&
+d
ipo
le(i_
dim
,i_p
art
)/(n
_o
xy/1
2.)
!if
(i_
dim
.eq
.3)
write
(37
,*)
i_p
art
,i_
cla
ss,
!&
dip
ole
(i_
dim
,i_p
art
)e
nd
do
en
dif
en
dd
o!
write
(37
,*)
"==
==
==
==
==
==
==
==
==
==
==
==
==
==
==
==
==
==
==
==
==
==
==
==
"
do
i_cl
ass
=1,1
2d
oi_
dim
=0,3
dip
ole
_cl
ass
1(i_
dim
,i_cl
ass
)=
dip
ole
_cl
ass
1(i_
dim
,i_cl
ass
)&
+d
ipo
le_
cla
ss(i_
dim
,i_cl
ass
)d
ipo
le_
cla
ss2
(i_
dim
,i_cl
ass
)=
dip
ole
_cl
ass
2(i_
dim
,i_cl
ass
)&
+(d
ipo
le_
cla
ss(i_
dim
,i_cl
ass
))**
2d
ipo
le_
cla
ss4
(i_
dim
,i_cl
ass
)=
dip
ole
_cl
ass
4(i_
dim
,i_cl
ass
)&
+(d
ipo
le_
cla
ss(i_
dim
,i_cl
ass
))**
4e
nd
do
en
dd
o
dip
ole
_co
un
t=dip
ole
_co
un
t+
1
if(i_
time
.eq
.1)
op
en
(33
,file
="p
imd
.pol"
,sta
tus=
"un
kno
wn
")
write
(33
,’(1
5f1
5.7
)’)
r_tim
e,
!1
&a
vg_
dip
ole
(0,2
),!
2&
avg
_d
ipo
le(1
,2),
avg
_d
ipo
le(2
,2),
avg
_d
ipo
le(3
,2),
!3
,4,5
&(d
ipole
(i_
dim
,3
3),
i_d
im=
1,3
),!
6,7
,8&
(dip
ole
(i_
dim
,6
4),
i_d
im=
1,3
)!
9,1
0,1
1
de
allo
cate
(sfo
rce
,r,s
pin
d,n
nlis
t,n
na
t,n
n_
ima
g)
call
forc
e_
on
_sc
al
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!su
bro
utin
ea
pplie
d_
field
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
do
ub
lep
reci
sio
ne
_a
pp
lied
(n_
dim
)in
teg
er
i_e
_a
pp
lied
_b
ks
e_
ap
plie
d(1
)=
0.
e_
ap
plie
d(2
)=
0.
e_
ap
plie
d(3
)=
0.
!if
(f_e
_a
pp
lied
.gt.0
)th
en
!if
(i_
time
.ge
.n_
rela
x)th
en
!i_
e_
ap
plie
d_
bks
=f_
e_
app
lied
!i_
e_
ap
plie
d_
bks
exi
sts
just
top
lease
the
com
pile
r!
e_
ap
plie
d(1
)=
0.0
1*(
i_tim
e)/
50
00
0!
end
if!
en
dif
do
i_d
im=
1,
n_
dim
!h
art
ree
/a_b
oh
r/e
->kB
K/a
ng
stro
m/e
e_
ap
plie
d(i_
dim
)=5
96
72
4.9
*e_
ap
plie
d(i_
dim
)e
nd
do
do
i_p
art
=1
,n
_p
art
do
i_d
im=
1,
n_
dim
v_in
ter
=v_
inte
r+
cha
rge
(i_
pa
rt)*
r_re
al(i_
dim
,0,i_
pa
rt)
&*
e_
ap
plie
d(i_
dim
)d
oj_
dim
=1
,n
_d
imfo
rce
(i_
dim
,0,i_
pa
rt)
=fo
rce
(i_
dim
,0,i_
pa
rt)
+&
h_
ma
t_in
v(i_
dim
,j_
dim
)*
cha
rge
(i_
pa
rt)
&*
e_
ap
plie
d(j_
dim
)e
nd
do
120
B.1. Molecular Dynamics Code
en
dd
oe
nd
do
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
bks
_p
ote
ntia
lim
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
call
two
bo
dy_
pote
ntia
l
call
forc
e_
on
_sc
al
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
two
bo
dy_
po
ten
tial
!a
ll2
bo
dy
po
ten
tials
with
sho
rtra
ng
ep
lus
cou
lom
bte
rmim
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
do
ub
lep
reci
sio
nv_
inte
r_lo
cd
ou
ble
pre
cisi
on
r_1
,r_
2,p
ot_
loc
do
ub
lep
reci
sio
nr_
2_
ma
xd
ou
ble
pre
cisi
on
mu
_i(n
_p
art
),la
gra
ng
e_
no
m,
lag
ran
ge
_d
en
om
inte
ge
ri_
dim
_m
ax
v_in
ter
=0
.v_
rea
lco
ulo
mb
=0
.v_
sho
rtra
ng
e=
0.
self_
en
erg
y=
0.
do
i_p
art
=1
,n
_p
art
self_
en
erg
y=
self_
en
erg
y+
cha
rge
(i_p
art
)**2
en
dd
ose
lf_e
ne
rgy
=-n
_tr
ot*
ele
c_p
refa
c*a
lph
a*s
elf_
en
erg
y/sq
rt(p
i)
do
i_d
im=
1,
n_
dim
+3
forc
e_
sca
l_in
ter(
i_d
im)
=0
.e
nd
do
if(f
_p
ote
ntia
l.eq
.3)
call
rec_
ew
ald
if((
f_p
ote
ntia
l.ge
.5).
an
d.(
f_p
ote
ntia
l.le
.8))
call
rec_
ew
ald
if(f
_ch
arg
ea
dju
st.e
q.3
)th
en
do
i_p
art
=1,
n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
mu
_i(i_
pa
rt)
=q
eq
ele
ctro
ne
g(i_
typ
e)
+q
eq
rec(
i_p
art
)&
+(
qe
qh
ard
ne
ss(i_
typ
e)
&-
2*e
lec_
pre
fac*
alp
ha
/sqrt
(pi)
)*ch
arg
e(i_
pa
rt)
en
dd
oe
nd
if
do
i_p
art
=1
,n_
pa
rti_
typ
e=
type
(i_
pa
rt)
v_in
ter_
loc
=0
.
do
i_n
eig
h=
1,n
eig
hb
or(
0,i_
pa
rt)
j_p
art
=n
eig
hbo
r(i_
ne
igh
,i_p
art
)j_
typ
e=
typ
e(j_
pa
rt)
po
t_lo
c=
0.
do
i_tr
ot
=0,n
_tr
ot-
1
do
i_d
im=
1,n
_d
imd
elta
_ce
ll(i_
dim
)=
&r0
(i_
dim
,i_tr
ot,i_
pa
rt)
-r0
(i_
dim
,i_tr
ot,j_
pa
rt)
if(d
elta
_ce
ll(i_
dim
).g
t.0
.5)
the
nd
elta
_ce
ll(i_
dim
)=
de
lta_
cell(
i_d
im)
-1
.e
lse
if(d
elta
_ce
ll(i_
dim
).lt.
-0.5
)th
en
de
lta_
cell(
i_d
im)
=d
elta
_ce
ll(i_
dim
)+
1.
en
dif
en
dd
o
r_2
=0
.ca
llca
lc_
dis
t_in
t(r_
2)
if(r_
2.lt
.r_
cuto
ff_
2(i_
typ
e,j_
typ
e))
the
nr_
1=
sqrt
(r_2
)i_
po
ten
tial
=n
int(
n_
po
ten
tial*
r_1
/r_ra
ng
e(i_
typ
e,j_
typ
e))
po
t_lo
c=
po
t_lo
c+
r_p
ot_
1(i_
typ
e,j_
typ
e,i_
po
ten
tial)
&+
cha
rge
(i_
pa
rt)*
cha
rge
(j_
part
)&
*r_
po
t_2
(i_
typ
e,j_
typ
e,i_
po
ten
tial)
v_re
alc
ou
lom
b=
v_re
alc
ou
lom
b&
+ch
arg
e(i_
pa
rt)*
cha
rge
(j_
part
)&
*r_
po
t_2
(i_
typ
e,j_
typ
e,i_
po
ten
tial)
v_sh
ort
ran
ge
=v_
sho
rtra
ng
e&
+r_
po
t_1
(i_
typ
e,j_
typ
e,i_
pote
ntia
l)
r_d
um
my
=r_
po
t_d
_1
(i_
typ
e,j_
typ
e,i_
po
ten
tial)
&+
cha
rge
(i_
pa
rt)*
cha
rge
(j_
part
)&
*r_
po
t_d
_2
(i_
typ
e,j_
typ
e,i_
po
ten
tial)
call
calc
_fo
rce
_lo
c(r_
du
mm
y,i_
tro
t,i_
pa
rt,j_
pa
rt)
if(f
_ch
arg
ead
just
.eq
.3)
the
nm
u_
i(i_
pa
rt)
=m
u_
i(i_
pa
rt)
&+
r_p
ot_
2(i_
typ
e,j_
typ
e,i_
po
ten
tial)
*ch
arg
e(j_
pa
rt)
mu
_i(j_
pa
rt)
=m
u_
i(j_
pa
rt)
&+
r_p
ot_
2(j_
typ
e,i_
typ
e,i_
po
ten
tial)
*ch
arg
e(i_
pa
rt)
en
dif
en
dif
en
dd
ov_
inte
r_lo
c=
v_in
ter_
loc
+p
ot_
loc
en
dd
o
v_in
ter
=v_
inte
r+
v_in
ter_
loc
en
dd
o
v_in
ter
=v_
inte
r+
self_
en
erg
y
if(f
_ch
arg
ea
dju
st.e
q.3
)th
en
lag
ran
ge
_n
om
=0
.d
oi_
pa
rt=
1,
n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
lag
ran
ge
_n
om
=la
gra
ng
e_
no
m+
&m
u_
i(i_
pa
rt)
/q
eq
ma
ss(i_
typ
e)
en
dd
ola
gra
ng
e_
de
no
m=
0.
do
i_ty
pe
=1
,n
_ty
pe
lag
ran
ge
_d
en
om
=la
gra
ng
e_
de
no
m+
121
B. Programs&
n_
ato
mty
pe
(i_
typ
e)
/q
eq
mass
(i_
typ
e)
en
dd
oe
nd
if
t_d
yna
mic
_ch
arg
e=
0.
v_ch
arg
e=
0.
do
i_p
art
=1
,n
_p
art
i_ty
pe
=ty
pe
(i_
pa
rt)
if(f
_ch
arg
ea
dju
st.e
q.3
)th
en
!---
-ca
lcu
late
forc
eo
nch
arg
es
fQ(i_
pa
rt)
=-m
u_
i(i_
pa
rt)
+la
gra
ng
e_
no
m/
lag
ran
ge
_d
en
om
!---
-ca
lcu
late
en
erg
ies
of
the
ext
en
de
dla
gra
ng
ian
pa
rtt_
dyn
am
ic_
charg
e=
t_d
yna
mic
_ch
arg
e&
+0
.5*
qe
qm
ass
(i_
typ
e)*
(cha
rge
x(1
,i_p
art
)/d
t)**
2e
nd
ifv_
cha
rge
=v_
cha
rge
&+
qeq
ele
ctro
ne
g(i_
typ
e)*
cha
rge
(i_
pa
rt)
&+
0.5
*qe
qh
ard
ne
ss(i_
typ
e)*
charg
e(i_
pa
rt)*
*2e
nd
do
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
ele
ctro
ne
ga
tivity
_sa
veim
plic
itn
one
incl
ud
e"p
imd
.co
m.f"
do
ub
lep
reci
sio
ne
n(n
_p
art
),r_
1,
r_2
do
ub
lep
reci
sio
na
vg_
en
(n_
typ
e),
min
_e
n(n
_ty
pe
),m
ax_
en
(n_
type
)in
teg
er
nu
m_p
art
(n_
typ
e)
do
i_p
art
=1
,n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
en
(i_
pa
rt)=
0
do
j_p
art
=1
,n
_p
art
if(j_
pa
rt.n
e.i_
pa
rt)
the
nj_
typ
e=
typ
e(j_
pa
rt)
do
i_tr
ot
=0
,n_
tro
t-1
do
i_d
im=
1,n
_d
imd
elta
_ce
ll(i_
dim
)=
&r0
(i_
dim
,i_tr
ot,i_
pa
rt)
-r0
(i_d
im,i_
tro
t,j_
pa
rt)
if(d
elta
_ce
ll(i_
dim
).g
t.0
.5)
the
nd
elta
_ce
ll(i_
dim
)=
de
lta_
cell(
i_d
im)
-1
.e
lse
if(d
elta
_ce
ll(i_
dim
).lt.
-0.5
)th
en
de
lta_
cell(
i_d
im)
=d
elta
_ce
ll(i_
dim
)+
1.
en
dif
en
dd
o
r_2
=0
.ca
llca
lc_
dis
t_in
t(r_
2)
if(r_
2.lt
.r_cu
toff_
2(i_
typ
e,j_
typ
e))
the
nr_
1=
sqrt
(r_
2)
i_p
ote
ntia
l=
nin
t(n
_p
ote
ntia
l*r_
1/r
_ra
ng
e(i_
typ
e,j_
typ
e))
en
(i_
pa
rt)=
en
(i_
pa
rt)
&+
r_p
ot_
2(i_
typ
e,j_
typ
e,i_
po
tentia
l)*
cha
rge
(j_
pa
rt)
en
dif
en
dd
o
en
dif
en
dd
oe
n(i_
pa
rt)=
en
(i_
pa
rt)+
qe
qe
lect
ron
eg
(i_
typ
e)
&-2
*ele
c_p
refa
c*a
lph
a/s
qrt
(pi)*c
ha
rge
(i_
pa
rt)
&+
cha
rge
(i_
pa
rt)*
qe
qh
ard
ne
ss(i_ty
pe
)e
nd
do
do
i_p
art
=1
,n_
pa
rtw
rite
(*,*
)i_
pa
rt,
en
(i_
pa
rt)
en
dd
o
!h
ier
ste
hts
!w
rite
(62
,’(1
00
0e
15
.7)’)
(en
(i_p
art
),i_
pa
rt=
1,n
_p
art
)
do
i_ty
pe
=1
,n
_ty
pe
avg
_e
n(i_
typ
e)=
0m
ax_
en
(i_
typ
e)=
-1.e
30
min
_e
n(i_
typ
e)=
1.e
30
nu
m_
pa
rt(i_
typ
e)=
0e
nd
do
do
i_p
art
=1
,n
_p
art
i_ty
pe
=ty
pe
(i_
pa
rt)
nu
m_
pa
rt(i_
typ
e)=
nu
m_
pa
rt(i_
typ
e)+
1e
nd
do
do
i_p
art
=1
,n
_p
art
i_ty
pe
=ty
pe
(i_
pa
rt)
avg
_e
n(i_
typ
e)=
avg
_e
n(i_
typ
e)+
en
(i_
pa
rt)/
nu
m_
pa
rt(i_
typ
e)
if(e
n(i_
pa
rt).
gt.m
ax_
en
(i_
typ
e))
&m
ax_
en
(i_
typ
e)=
en
(i_
pa
rt)
if(e
n(i_
pa
rt).
lt.m
in_
en
(i_
typ
e))
&m
in_
en
(i_
typ
e)=
en
(i_
pa
rt)
en
dd
o
write
(63
,’(2
0e1
5.7
)’)
(avg
_e
n(i_
typ
e),
i_ty
pe
=1
,n_
typ
e),
&(m
in_e
n(i_
typ
e),
i_ty
pe
=1
,n_
type
),&
(ma
x_e
n(i_
typ
e),
i_ty
pe
=1
,n_
type
)
en
dsu
bro
utin
e
!!!!!!!!!!!!!!!!!!!!!
sub
rou
tine
ext
dla
gra
ng
e_
pre
dic
tor
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
!---
-p
red
ict
cha
rge
sd
oi_
pa
rt=
1,
n_
pa
rtd
oi_
ord
er=
1,
n_
ord
er
cha
rge
(i_
part
)=
cha
rge
(i_
pa
rt)
&+
pre
dic
t_co
ef(
0,i_
ord
er)
*ch
arg
ex(
i_o
rde
r,i_
pa
rt)
en
dd
oe
nd
do
!---
-p
red
ict
hig
he
ro
rde
rch
arg
es
do
i_p
art
=1
,n
_p
art
do
i_o
rde
r=
1,
n_
ord
er-
1d
oj_
ord
er
=i_
ord
er+
1,
n_
ord
er
cha
rge
x(i_
ord
er,
i_p
art
)=
&ch
arg
ex(
i_o
rde
r,i_
pa
rt)
+&
pre
dic
t_co
ef(
i_o
rde
r,j_
ord
er)
*ch
arg
ex(
j_o
rde
r,i_
pa
rt)
122
B.1. Molecular Dynamics Code
en
dd
oe
nd
do
en
dd
o
en
dsu
bro
utin
e
!!!!!!!!!!!!!!!!!!!!!
sub
rou
tine
ext
dla
gra
ng
e_
corr
ect
or
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
do
ub
lep
reci
sion
de
ltaQ
2(n
_p
art
)
!---
-su
bra
ctfr
ictio
nd
oi_
pa
rt=
1,n
_p
art
i_ty
pe
=ty
pe(i_
pa
rt)
fQ(i_
pa
rt)
=fQ
(i_
pa
rt)
&-
qe
qm
ass
(i_
typ
e)
*q
eq
fric
tion
*ch
arg
ex(
1,i_
pa
rt)/
dt
en
dd
o
!---
-ca
lcu
late
seco
nd
ord
er
corr
ect
ion
do
i_p
art
=1
,n
_p
art
i_ty
pe
=ty
pe(i_
pa
rt)
de
ltaQ
2(i_
pa
rt)
=(d
t_2
*fQ
(i_
pa
rt)/
qeq
ma
ss(i_
typ
e)
/2
&-c
ha
rge
x(2
,i_p
art
))e
nd
do
!---
-co
rre
ctch
arg
es
do
i_p
art
=1
,n
_p
art
cha
rge
(i_
pa
rt)
=ch
arg
e(i_
pa
rt)
&+
corr
ect
_co
ef(
0)*
de
ltaQ
2(i_p
art
)d
oi_
ord
er
=1
,n
_o
rde
rch
arg
ex(
i_ord
er,
i_p
art
)=
cha
rge
x(i_
ord
er,
i_p
art
)&
+co
rre
ct_
coe
f(i_
ord
er)
*de
ltaQ
2(i_
pa
rt)
en
dd
oe
nd
do
en
dsu
bro
utin
e
!!!!!!!!!!!!!!!!!!!!!
sub
rou
tine
ext
en
de
dla
gra
ng
eim
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
do
ub
lep
reci
sio
nr_
1,
r_2
do
ub
lep
reci
sio
nq
eq
a(n
_p
art
,n_
pa
rt),
qe
qb
(n_
pa
rt)
do
ub
lep
reci
sio
nm
u_
i(n
_p
art
),su
m_
mu
do
ub
lep
reci
sio
nv_
qa
bh
ae
ng
ig_
ete
stco
mm
on
/ext
lage
test
/v_
qa
bh
ae
ng
ig_
ete
std
ou
ble
pre
cisi
on
qe
qre
c2(n
_p
art
,n_
pa
rt)
com
mo
n/q
eq
rect
est
/q
eq
rec2
inte
ge
ri_
test
do
ub
lep
reci
sio
np
mix
com
mo
n/p
mis
ch/
pm
ixd
ou
ble
pre
cisi
on
avg
_ch
arg
e(n
_ty
pe
),m
ax_
cha
rge
(n_
typ
e),
&m
in_
cha
rge
(n_
typ
e)
do
ub
lep
reci
sio
nv_
ew
ald
2d
ou
ble
pre
cisi
on
qe
qa
12
(n_
pa
rt,n
_p
art
)
!(c
an
be
incl
ud
ed
inp
ote
ntia
lro
utin
ela
ter)
do
i_p
art
=1
,n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
do
j_p
art
=1
,n
_p
art
j_ty
pe
=ty
pe(j_
pa
rt)
i_tr
ot
=0
do
i_d
im=
1,n
_d
imd
elta
_ce
ll(i_
dim
)=
&r0
(i_
dim
,i_tr
ot,i_
pa
rt)
-r0
(i_
dim
,i_tr
ot,j_
pa
rt)
if(d
elta
_ce
ll(i_
dim
).g
t.0
.5)
the
nd
elta
_ce
ll(i_
dim
)=
de
lta_
cell(
i_d
im)
-1
.e
lse
if(d
elta
_ce
ll(i_
dim
).lt.
-0.5
)th
en
de
lta_
cell(
i_dim
)=
de
lta_
cell(
i_d
im)
+1
.e
nd
ife
nd
do
r_2
=0
.ca
llca
lc_
dis
t_in
t(r_
2)
if(r_
2.le
.r_
cuto
ff_
2(i_
typ
e,j_
typ
e))
the
nr_
1=
sqrt
(r_
2)
i_p
ote
ntia
l=
nin
t(n
_p
ote
ntia
l*r_
1/r
_ra
ng
e(i_
typ
e,j_
typ
e))
qe
qa
(i_
pa
rt,j_
pa
rt)
=&
+r_
po
t_2
(i_
typ
e,j_
typ
e,i_
po
ten
tial)
qe
qa
12
(i_
pa
rt,j_
pa
rt)
=0
.5*(
&+
r_p
ot_
2(i_
typ
e,j_
typ
e,i_
po
ten
tial)*c
ha
rge
(i_
pa
rt)
&*c
ha
rge
(j_
pa
rt)
+r_
po
t_1(i_
typ
e,j_
typ
e,i_
po
ten
tial))
if(i_
po
ten
tial.g
e.n
_p
ote
ntia
l)w
rite
(68
,*)
"gro
sse
Pa
nn
e"
els
e qe
qa
(i_
pa
rt,j_
pa
rt)=
0.0
qe
qa
12
(i_
pa
rt,j_
pa
rt)=
0.0
en
dif
en
dd
oe
nd
do
!ca
lcula
tea
ux
varia
ble
B_
id
oi_
pa
rt=
1,
n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
qe
qb
(i_
pa
rt)
=q
eq
ha
rdn
ess
(i_
typ
e)
&-
2*e
lec_
pre
fac*
alp
ha
/sq
rt(p
i)e
nd
do
!---
-ca
lcu
late
che
mic
al
po
ten
tial
sum
_m
u=
0.
do
i_p
art
=1
,n
_p
art
i_ty
pe
=ty
pe
(i_
pa
rt)
mu
_i(i_
pa
rt)
=q
eq
ele
ctro
ne
g(i_
typ
e)
+q
eq
rec(
i_p
art
)&
+q
eqb
(i_
pa
rt)*
cha
rge
(i_
pa
rt)
do
j_p
art
=1,
n_
pa
rtm
u_
i(i_
pa
rt)
=m
u_
i(i_
pa
rt)
+q
eq
a(i_
pa
rt,j_
pa
rt)
&*
cha
rge
(j_
pa
rt)
en
dd
osu
m_
mu
=su
m_
mu
+m
u_
i(i_
pa
rt)
en
dd
o
!---
-ca
lcu
late
resu
ltin
gfo
rce
do
i_p
art
=1
,n
_p
art
fQ(i_
pa
rt)
=-m
u_
i(i_
pa
rt)
+su
m_
mu
/n
_p
art
en
dd
o
!---
-ca
lcula
tee
ne
rgie
s
123
B. Programst_
dyn
am
ic_
cha
rge
=0
.v_
cha
rge
=0.
v_q
ab
ha
en
gig
_e
test
=0
.v_
inte
r=
0.
v_e
wa
ld2
=0.
do
i_p
art
=1
,n
_p
art
i_ty
pe
=ty
pe
(i_
pa
rt)
t_d
yna
mic
_ch
arg
e=
t_d
yna
mic
_ch
arg
e&
+0
.5*
qe
qm
ass
(i_
typ
e)*
(ch
arg
ex(
1,i_
pa
rt)/
dt)
**2
v_ch
arg
e=
v_ch
arg
e&
+0
.5*(
mu
_i(i_
pa
rt)+
qe
qe
lect
ron
eg
(i_
typ
e))
*ch
arg
e(i_
part
)&
+q
eqe
lect
ron
eg
(i_
typ
e)*
cha
rge
(i_
pa
rt)
&+
0.5
*qe
qh
ard
ne
ss(i_
typ
e)*
charg
e(i_
pa
rt)*
*2e
nd
do
do
i_p
art
=1
,n
_p
art
i_ty
pe
=ty
pe
(i_
pa
rt)
do
j_p
art
=1
,n
_p
art
if(i_
pa
rt.n
e.j_
pa
rt)
the
nj_
typ
e=
type
(j_
pa
rt)
v_q
ab
ha
en
gig
_e
test
=v_
qa
bh
ae
ng
ig_
ete
st+
&0
.5*
qe
qa
(i_
pa
rt,j_
pa
rt)*
cha
rge
(i_
pa
rt)
&*c
ha
rge
(j_
pa
rt)
v_in
ter
=v_
inte
r+
qe
qa
12
(i_
pa
rt,j_
pa
rt)
en
dif
en
dd
ov_
qa
bh
ae
ng
ig_
ete
st=
v_q
ab
ha
en
gig
_e
test
&+
0.5
*q
eq
b(i_
pa
rt)*
cha
rge
(i_p
art
)**2
&+
qeq
ele
ctro
ne
g(i_
typ
e)*
cha
rge
(i_
pa
rt)
v_in
ter
=v_
inte
r-
ele
c_p
refa
c*a
lph
a/s
qrt
(pi)
&*c
harg
e(i_
pa
rt)*
cha
rge
(i_
pa
rt)
&+
0.5
*qe
qre
c(i_
pa
rt)*
cha
rge
(i_
pa
rt)
v_e
wa
ld2
=v_
ew
ald
2+
0.5
*qe
qre
c(i_
pa
rt)*
cha
rge
(i_
pa
rt)
en
dd
ov_
qa
bh
ae
ng
ig_
ete
st=
v_q
ab
ha
en
gig
_e
test
+v_
ew
ald
do
i_ty
pe
=1
,n
_ty
pe
avg
_ch
arg
e(i_
typ
e)=
0m
ax_
cha
rge
(i_
typ
e)=
-1.e
30
min
_ch
arg
e(i_
typ
e)=
1.e
30
en
dd
od
oi_
pa
rt=
1,
n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
avg
_ch
arg
e(i_
typ
e)=
avg
_ch
arg
e(i_
typ
e)+
cha
rge
(i_
pa
rt)
if(c
ha
rge
(i_
pa
rt).
gt.m
ax_
cha
rge
(i_
typ
e))
&m
ax_
cha
rge
(i_
typ
e)=
cha
rge
(i_
pa
rt)
if(c
ha
rge
(i_
pa
rt).
lt.m
in_
cha
rge
(i_
typ
e))
&m
in_ch
arg
e(i_
typ
e)=
cha
rge
(i_
pa
rt)
en
dd
oa
vg_
cha
rge
(1)=
1.d
0*a
vg_
cha
rge
(1)/
n_
silic
avg
_ch
arg
e(2
)=1
.d0
*avg
_ch
arg
e(2
)/n
_oxy
write
(64
,’(i6
,20
e3
0.2
2)’)
i_te
st,
2a
vg_ch
arg
e(1
),3
min
_ch
arg
e(1
),4
ma
x_ch
arg
e(1
),5
avg
_ch
arg
e(2
),6
min
_ch
arg
e(2
),7
ma
x_ch
arg
e(2
),
8p
mix
,9
t_d
yna
mic
_ch
arg
e/n
_p
art
,&
v_ch
arg
e/n
_p
art
,!1
0&
v_q
ab
ha
en
gig
_e
test
/n_
pa
rt,
!11
&v_
ew
ald
/n_
pa
rt,
!12
&v_
inte
r/n
_p
art
,!1
3&
v_e
wa
ld2
/n_
pa
rt!1
4
en
dsu
bro
utin
e
!!!!!!!!!!!!!!!!!!!!!
sub
rou
tine
ma
trix
inve
rsio
nim
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
inte
ge
rm
,n,n
p,m
pP
AR
AM
ET
ER
(np
=n
_p
art
,mp
=1
)d
ou
ble
pre
cisi
on
a(n
p,n
p),
b(n
p,m
p)
do
ub
lep
reci
sio
nr_
2,
r_1
inte
ge
rk_
pa
rtd
ou
ble
pre
cisi
on
qe
qre
c2(n
_p
art
,n_
pa
rt)
com
mo
n/q
eq
rect
est
/q
eq
rec2
do
ub
lep
reci
sio
nq
eq
a(n
_p
art
,n_
pa
rt),
qe
qb
(n_
pa
rt)
do
ub
lep
reci
sio
ne
nd
ou
ble
pre
cisi
on
row
_d
um
my
inte
ge
rin
dx(
n_
pa
rt)
n=
np
m=
mp
if(f
_p
ote
ntia
l.ne
.1)
the
nca
llch
eck
_sk
inif
(f_
skin
.eq
.1)
the
nca
llb
inn
ing
en
dif
en
dif
call
ma
trix
_re
c(q
eq
rec2
)
b(1
,1)=
0.
!Q
_to
tal
a(1
,1)=
1.
j_ty
pe
=ty
pe
(1)
do
i_p
art
=2
,n
_p
art
!fir
stro
w1
i_ty
pe
=ty
pe
(i_
pa
rt)
a(1
,i_p
art
)=1
.b
(i_
pa
rt,1
)=-(
qe
qe
lect
ron
eg
(i_
typ
e)-
qe
qe
lect
ron
eg
(j_
typ
e))
en
dd
o
i_ty
pe
=ty
pe
(1)
!fir
stco
lum
n-B
1d
oi_
pa
rt=
2,
n_
pa
rta
(i_
pa
rt,1
)=-(
qe
qh
ard
ne
ss(i_
typ
e)-
&2
*ele
c_p
refa
c*a
lph
a/s
qrt
(pi)
+q
eq
rec2
(1,1
))q
eq
b(1
)=-a
(i_
pa
rt,1
)e
nd
do
i_p
art
=1
!i=2
..n
xj=
2..n
-A1
ji_
typ
e=
typ
e(i_
pa
rt)
do
j_p
art
=2
,n
_p
art
124
B.1. Molecular Dynamics Code
j_ty
pe
=ty
pe
(j_
pa
rt)
i_tr
ot
=0
do
i_d
im=
1,n
_d
imd
elta
_ce
ll(i_
dim
)=
&r0
(i_
dim
,i_tr
ot,i_
pa
rt)
-r0
(i_
dim
,i_tr
ot,j_
pa
rt)
if(d
elta
_ce
ll(i_
dim
).g
t.0
.5)
the
nd
elta
_ce
ll(i_
dim
)=
de
lta_
cell(
i_d
im)
-1
.e
lse
if(d
elta
_ce
ll(i_
dim
).lt.
-0.5
)th
en
de
lta_
cell(
i_d
im)
=d
elta
_ce
ll(i_
dim
)+
1.
en
dif
en
dd
o
r_2
=0
.ca
llca
lc_
dis
t_in
t(r_
2)
if(r_
2.le
.r_
cuto
ff_
2(i_
typ
e,j_
typ
e))
the
nr_
1=
sqrt
(r_
2)
i_p
ote
ntia
l=
nin
t(n
_p
ote
ntia
l*r_
1/r
_ra
ng
e(i_
typ
e,j_
typ
e))
do
k_p
art
=2
,n_
pa
rta
(k_
pa
rt,j_
pa
rt)=
-r_
po
t_2
q(i_
typ
e,j_
typ
e,i_
po
ten
tial)
&-q
eq
rec2
(i_
pa
rt,j_
part
)e
nd
do
els
e do
k_p
art
=2
,n_
pa
rta
(k_
pa
rt,j_
pa
rt)=
-qe
qre
c2(i_
pa
rt,j_
part
)e
nd
do
en
dif
qe
qa
(1,j_
part
)=-a
(2,j_
pa
rt)
en
dd
o
do
i_p
art
=2
,n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
do
j_p
art
=1,
n_
pa
rtif
(i_
pa
rt.n
e.j_
pa
rt)
the
n!
with
ou
td
iag
on
al:
Aij
j_ty
pe
=ty
pe
(j_
pa
rt)
i_tr
ot
=0
do
i_d
im=
1,n
_d
imd
elta
_ce
ll(i_
dim
)=
&r0
(i_
dim
,i_tr
ot,i_
part
)-
r0(i_
dim
,i_tr
ot,j_
pa
rt)
if(d
elta
_ce
ll(i_
dim
).g
t.0
.5)
the
nd
elta
_ce
ll(i_
dim
)=
de
lta_
cell(
i_d
im)
-1
.e
lse
if(d
elta
_ce
ll(i_
dim
).lt.
-0.5
)th
en
de
lta_
cell(
i_d
im)
=d
elta
_ce
ll(i_
dim
)+
1.
en
dif
en
dd
o
r_2
=0
.ca
llca
lc_
dis
t_in
t(r_
2)
!w
rite
(*,*
)i_
pa
rt,
j_p
art
,sq
rt(r
_2
)
if(r_
2.le
.r_
cuto
ff_
2(i_
typ
e,j_
typ
e))
the
nr_
1=
sqrt
(r_
2)
i_p
ote
ntia
l=
nin
t(n
_p
ote
ntia
l*r_
1/r
_ra
ng
e(i_
typ
e,j_
typ
e))
a(i_
pa
rt,j_
pa
rt)=
a(i_
pa
rt,j_
pa
rt)
&+
r_p
ot_
2q
(i_
typ
e,j_
type
,i_p
ote
ntia
l)&
+q
eq
rec2
(i_
pa
rt,j_
pa
rt)
qe
qa
(i_
pa
rt,j_
pa
rt)=
r_p
ot_
2q
(i_
typ
e,j_
typ
e,i_
po
ten
tial)
&+
qe
qre
c2(i_
pa
rt,j_
pa
rt)
els
ea
(i_
pa
rt,j_
pa
rt)=
a(i_
pa
rt,j_
pa
rt)
&+
qe
qre
c2(i_
pa
rt,j_
pa
rt)
qe
qa
(i_
pa
rt,j_
pa
rt)=
qe
qre
c2(i_
pa
rt,j_
pa
rt)
en
dif
els
e!
dia
go
na
l:B
ia
(i_
pa
rt,i_
pa
rt)=
a(i_
pa
rt,i_
pa
rt)
+q
eq
ha
rdn
ess
(i_
typ
e)
&-
2*e
lec_
pre
fac*
alp
ha
/sq
rt(p
i)+
qe
qre
c2(i_
pa
rt,i_
pa
rt)
qe
qb
(i_
pa
rt)
=q
eq
ha
rdn
ess
(i_
typ
e)
&-
2*e
lec_
pre
fac*
alp
ha
/sq
rt(p
i)+
qe
qre
c2(i_
pa
rt,i_
pa
rt)
en
dif
en
dd
oe
nd
do
call
lud
cmp
(a,n
,np
,ind
x,ro
w_
du
mm
y)ca
lllu
bks
b(a
,n,n
p,in
dx,
b)
v_q
eq
self=
0.
do
i_p
art
=1
,n
_p
art
i_ty
pe
=ty
pe
(i_
pa
rt)
cha
rge
(i_
pa
rt)=
b(i_
pa
rt,1
)v_
qe
qse
lf=v_
qe
qse
lf&
+ch
arg
e(i_
pa
rt)*
qe
qe
lect
ron
eg
(i_
typ
e)
&+
0.5
*ch
arg
e(i_
pa
rt)*
cha
rge
(i_
pa
rt)*
qe
qh
ard
ne
ss(i_
typ
e)
en
dd
o
en
dsu
bro
utin
e
!!
!!
!!
sub
rou
tine
ma
trix
_re
c(q
eq
rec2
)im
plic
itn
one
incl
ud
e"p
imd
.co
m.f"
inte
ge
ri_
q(n
_d
im),
tro
t_m
ax
do
ub
lep
reci
sio
nq
_ve
c(n
_d
im),
q_
2,lo
c_p
refa
c,re
c_p
refa
cd
ou
ble
pre
cisi
on
two
_re
c_p
refa
cco
mp
lex*
16
plu
s_iq
r(n
_p
art
),m
inu
s_iq
r(n
_p
art
),&
diff
_iq
r(n
_p
art
,n_
pa
rt)
do
ub
lep
reci
sio
nq
eq
rec2
(n_
pa
rt,n
_p
art
)
do
i_p
art
=1
,n
_p
art
do
j_p
art
=1,
n_
pa
rtq
eq
rec2
(i_
pa
rt,j_
pa
rt)=
0.
en
dd
oe
nd
do
loc_
pre
fac
=e
lec_
pre
fac*
two
pi/v
olu
me
j_tr
ot
=m
od(in
t(n
_tr
ot*
ran
do
m(1
)),n
_tr
ot)
do
i_re
c_ve
c=
1,n
_re
c_ve
cq
_2
=0
.d
oi_
dim
=1
,n_d
imi_
q(i_
dim
)=
rec_
vec_
list(
i_re
c_ve
c,i_
dim
)q
_ve
c(i_
dim
)=
i_q
(i_
dim
)*d
q(i_
dim
,i_d
im)
q_
2=
q_
2+
q_
vec(
i_d
im)*
*2e
nd
do
rec_
pre
fac
=lo
c_p
refa
c*e
xp(-
q_
2/(
2*a
lph
a)*
*2)/
q_
2if(
rec_
vec_
list(
i_re
c_ve
c,3
).n
e.0
)re
c_p
refa
c=
2*
rec_
pre
fac
two
_re
c_p
refa
c=
2*r
ec_
pre
fac
tro
t_m
ax
=n
_tr
ot-
1if
(f_
op
t_re
c.eq
.1)
tro
t_m
ax
=0
125
B. Programsd
oi_
tro
t=
0,
tro
t_m
ax
if(f
_o
pt_
rec.
eq
.0)
j_tr
ot
=i_
tro
t
do
i_p
art
=1
,n
_p
art
r_d
um
my
=0
.if
(f_
op
t_re
c.eq
.0)
the
nd
oi_
dim
=1
,n_
dim
r_d
um
my
=r_
du
mm
y+
i_q
(i_
dim
)*r0
(i_
dim
,j_tr
ot,i_
pa
rt)
en
dd
oe
lse
do
i_d
im=
1,
n_
dim
r_d
um
my
=r_
du
mm
y+
i_q
(i_
dim
)*
&(
r_re
f(i_
dim
,i_p
art
)+
u0
(i_
dim
,1,i_
pa
rt)/
sqrt
p)
en
dd
oe
nd
ifr_
du
mm
y=
dm
od
(r_
du
mm
y,1
.d0
)i_
du
mm
y=
nin
t(r_
du
mm
y*n
_p
ote
ntia
l)p
lus_
iqr(
i_p
art
)=!
&ta
b_
exp
_im
a(i_
du
mm
y)&
exp
(2.*
pi*
(0.,1
.)*r
_d
um
my)
i_d
um
my
=n
int(
-r_
du
mm
y*n
_p
ote
ntia
l)m
inu
s_iq
r(i_
pa
rt)=
!&
tab
_e
xp_
ima
(i_
du
mm
y)&
exp
(-2
.*p
i*(0
.,1
.)*r
_d
um
my)
en
dd
o
go
to2
34
do
i_p
art
=1
,n
_p
art
do
j_p
art
=1
,n
_p
art
do
i_d
im=
1,n
_d
imd
elta
_ce
ll(i_
dim
)=
&r0
(i_
dim
,i_tr
ot,i_
pa
rt)
-r0
(i_
dim
,i_tr
ot,j_
part
)if(
de
lta_
cell(
i_d
im).
gt.0
.5)
the
nd
elta
_ce
ll(i_
dim
)=
de
lta_
cell(
i_d
im)
-1
.e
lse
if(d
elta
_ce
ll(i_
dim
).lt.
-0.5
)th
en
de
lta_
cell(
i_dim
)=
de
lta_
cell(
i_d
im)
+1
.e
nd
ife
nd
do
r_d
um
my
=0.
do
i_d
im=
1,n
_d
imr_
du
mm
y=
r_d
um
my
+i_
q(i_
dim
)&
*de
lta_
cell(
i_d
im)
en
dd
o!
r_d
um
my
=d
mo
d(r
_d
um
my,
1.d
0)
!i_
du
mm
y=
nin
t(r_
du
mm
y*n
_p
ote
ntia
l)!
diff
_iq
r(i_
pa
rt,j_
pa
rt)=
!&
tab
_e
xp_
ima
(i_
dum
my)
!&
exp
(2.*
pi*
(0.,1
.)*r
_d
um
my)
diff
_iq
r(i_
pa
rt,j_
pa
rt)=
!&
tab
_e
xp_
ima
(i_
dum
my)
&e
xp(2
.*p
i*(0
.,1
.)*r
_d
um
my)
en
dd
oe
nd
do
23
4co
ntin
ue
do
i_p
art
=1
,n
_p
art
do
j_p
art
=1,
n_
pa
rtq
eq
rec2
(i_
pa
rt,j_
pa
rt)=
qe
qre
c2(i_
pa
rt,j_
pa
rt)
&+
two
_re
c_p
refa
c*d
ble
(plu
s_iq
r(i_
pa
rt)*
&m
inu
s_iq
r(j_
pa
rt))
!q
eq
rec2
(i_
pa
rt,j_
pa
rt)=
qe
qre
c2(i_
pa
rt,j_
pa
rt)
!&
+tw
o_
rec_
pre
fac*
db
le(d
iff_
iqr(
i_p
art
,j_pa
rt))
en
dd
oe
nd
do
en
dd
oe
nd
do
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
therm
ost
at
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
!---
-o
nly
n_tr
ot*
n_
pa
rtin
de
pe
nd
en
t(r
an
do
m)
forc
es
!---
-re
al
part
of
i_tr
ot
=0
,i_
tro
t=
n_
tro
t/2
!---
-b
oth
part
so
f1
.le.
i_tr
ot
.le.
n_
tro
t/2
do
j_tr
ot
=0
,n
_tr
ot-
1i_
tro
t=
j_tr
ot
+1
!---
cho
ose
larg
er
da
mp
ing
for
inte
rna
lm
od
es
if(i_
tro
t.eq
.1)
the
nr_
du
mm
y=
1.
/n
_tim
e_
sca
le
lse
r_d
um
my
=sq
rt(1
.*n
_tim
e_
sca
l)if(
i_tr
ot.e
q.2
)i_
tro
t=
n_
tro
t+
1e
nd
if
i_d
um
my
=(i_
tro
t-1
)/2
do
i_p
art
=1
,n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
call
r25
0(m
z,ra
nd
om
,n_
dim
,n_
dim
,kp
tr)
do
i_d
im=
1,n
_d
imf0
(i_
dim
,i_tr
ot,i_
pa
rt)
=f0
(i_
dim
,i_tr
ot,i_
pa
rt)
&-
ma
ss(i_
du
mm
y,i_
typ
e)
*fr
ictio
n(i_
typ
e)
*r_
du
mm
y**2
&*
(ux(
1,i_
dim
,i_tr
ot,i_
pa
rt)/
dt)
&-
k_e
igen
(i_
du
mm
y,i_
typ
e)
*u
0(i_
dim
,i_tr
ot,i_
pa
rt)
fr(i_
dim
,i_tr
ot,i_
pa
rt)
=r_
du
mm
y&
*(2
*ra
nd
om
(i_
dim
)-1
.)/
ma
ss(i_d
um
my,
i_ty
pe
)!-
---
wid
tho
fra
nd
om
forc
eis
know
nin
pre
dic
tor
en
dd
oe
nd
do
en
dd
o
do
i_d
im=
1,
n_
dim
+e
_d
imfo
rce
_sc
al(i_
dim
)=
forc
e_
sca
l(i_
dim
)&
-m
ass
_b
ox
*fr
ic_
bo
x*
(sca
l_x(
1,i_
dim
)/d
t)e
nd
do
if(f
ric_
bo
x.gt.0
.)ca
llr2
50
(mz,
ran
dom
,n_
dim
,n_
dim
,kp
tr)
do
i_d
im=
1,
n_
dim
fr_
bo
x(i_
dim
)=
(2*r
an
do
m(i_
dim
)-1
.)/
ma
ss_
bo
xe
nd
do
if(e
_d
im.e
q.3
)th
en
call
r25
0(m
z,ra
nd
om
,n_
dim
,n_
dim
,kp
tr)
do
i_d
im=
1,
3fr
_b
ox(
i_d
im+
n_
dim
)=
(2*r
an
do
m(i_
dim
)-1
.)/
ma
ss_
bo
xe
nd
do
en
dif
en
dsu
bro
utin
e
126
B.1. Molecular Dynamics Code
!!
!!
!!
!!
!!
!
sub
rou
tine
ob
se_
init
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
inte
ge
rjs
ee
dco
mm
on
/cjs
ee
d/
jse
ed
t_d
yna
mic
_1
=0.
t_d
yna
mic
_2
=0.
t_d
iag
_1
=0
.t_
nd
iag
_1
=0
.
v_in
ter_
1=
0.
v_in
ter_
2=
0.
viri_
est
_1
=0
.d0
viri_
est
_2
=0
.d0
prim
_e
st_
1=
0.d
0p
rim
_e
st_
2=
0.d
0
do
i_d
im=
1,
n_
dim
+3
sca
l_1
(i_
dim
)=
0.
do
j_d
im=
1,n
_d
im+
3sc
al_
2(j_
dim
,i_d
im)
=0
.e
nd
do
en
dd
ovo
l_1
=0
.vo
l_2
=0
.
do
i_d
im=
1,
n_
dim
do
j_d
im=
1,
n_
dim
stra
in_
1(i_
dim
,j_d
im)
=0
.e
la_
kin
(i_
dim
,j_d
im)
=0
.d
ok_
dim
=1
,n
_d
imd
ol_
dim
=1
,n
_d
ime
la_
bo
rn_
1(i_
dim
,j_
dim
,k_
dim
,l_
dim
)=
0.
stra
in_
2(i_d
im,
j_d
im,
k_d
im,
l_d
im)
=0
.e
nd
do
en
dd
oe
nd
do
en
dd
o
di_
time
=1
ieff_
time
=0
do
i_tr
ot
=0
,n_
tro
t-1
cor_
ifun
c(i_
tro
t)=
0.d
0e
nd
do
do
i_co
r=
0,n
_co
rco
r_o
bs(
i_co
r)=
0.d
0q
do
t_co
r(i_
cor)
=0
.d0
do
i_ty
pe
=1,
n_
typ
eco
r_fu
nc(
i_co
r,i_
typ
e)
=0
.d0
en
dd
oco
r_fu
nc_
A(i_co
r)=
0.d
0co
r_fu
nc_
B(i_co
r)=
0.d
0e
nd
do
do
i_ty
pe
=1
,n_
typ
ed
oj_
typ
e=
1,n
_ty
pe
do
i_g
rid
=0
,n_
grid
+1
g_
r(i_
typ
e,j_
typ
e,i_
grid
)=
0.
en
dd
oe
nd
do
en
dd
o
time
_o
bs
=0.d
0co
un
t_ifu
nc
=0
i_m
ea
sure
=n
_co
r
time
_b
orn
=0
.
ord
_p
ar_
1=
0.d
0o
rd_
pa
r_2
=0
.d0
ord
_p
ar_
4=
0.d
0o
rd_
pa
rB_
1=
0.d
0o
rd_
pa
rB_
2=
0.d
0o
rd_
pa
rB_
4=
0.d
0o
rd_
pa
rC_
1=
0.d
0o
rd_
pa
rC_
2=
0.d
0o
rd_
pa
rC_
4=
0.d
0
!m
ovi
ein
itif
(f_
mo
vie
.eq
.1)
the
no
pe
n(4
6,file
="m
ovi
e.x
yz",
sta
tus=
"new
")o
pe
n(4
7,file
="m
ovi
e.p
ol"
,sta
tus=
"new
")w
rite
(46
,*)
n_
pa
rtw
rite
(46
,*)
en
dif
if(f
_co
nfm
ovi
e.e
q.1
)th
en
op
en
(48
,file
="m
ovi
e.c
on
f",s
tatu
s="n
ew
")e
nd
if
if(i_
run
.eq
.1)
the
no
pe
n(2
0,file
="p
imd
.ou
t",s
tatu
s="u
nkn
ow
n")
write
(20
,21
0)
f_p
ote
ntia
l,"f_
po
ten
tial,
info
rma
tion
ava
ilab
le"
write
(20
,21
0)
f_ch
arg
ea
dju
st,"
f_ch
arg
ea
dju
st"
write
(20
,21
0)
n_
rela
x,"
#o
fre
laxa
tion
ste
ps"
write
(20
,21
0)
n_
ob
ser,
"#
of
ob
serv
atio
nst
ep
s"w
rite
(20
,21
0)
n_
safe
,"#
of
ste
ps
be
twe
en
con
figu
ratio
no
utp
ut"
write
(20
,21
0)
jse
ed
+2
,"ra
nd
om
#in
it"w
rite
(20
,*)
write
(20
,20
1)
dt*
n_
time
_sc
al,"
time
ste
p"
write
(20
,20
1)
tk,"
tem
pe
ratu
re"
write
(20
,*)
write
(20
,20
2)
(ma
ss(0
,i_ty
pe
),i_
typ
e=
1,n
_ty
pe
),"
ma
sse
s"w
rite
(20
,20
2)
(frict
ion
(i_
typ
e),
i_ty
pe
=1
,n_
typ
e),
"fr
ictio
n"
write
(20
,20
2)
ma
ss_
bo
x/n
_tr
ot,
fric
_b
ox,
"m
ass
+fr
.o
fb
ox"
if(f_
po
ten
tial.g
t.1
)th
en
write
(20
,20
1)
write
(20
,20
1)
pre
ss,"
pre
ssu
re"
write
(20
,21
0)
f_p
ress
ure
,"0
=N
VT
;1
=N
pT
"if
(f_
po
ten
tial.e
q.3
.or.
(&
(f_
po
ten
tial.g
e.5
).a
nd
.(f_
po
tentia
l.le
.8))
)&
write
(20
,210
)f_
op
t_re
c,"
1=
op
timiz
ed
Ew
ald
"w
rite
(20
,*)
if(f
_ch
arg
ead
just
.ne
.1)
the
n
127
B. Programsw
rite
(20
,20
2)
(qe
qe
lect
ron
eg
(i_
typ
e),
i_ty
pe
=1
,n_
typ
e),
&"
ele
ctro
ne
ga
tivity
"w
rite
(20
,20
2)
(qe
qh
ard
ne
ss(i_
typ
e),
i_ty
pe
=1
,n_
typ
e),
&"
ha
rdne
sso
fE
N"
en
dif
write
(20
,*)
if(f
_ch
arg
ea
dju
st.e
q.3
)th
en
write
(20
,20
2)
(qe
qm
ass
(i_
typ
e),
i_ty
pe=
1,n
_ty
pe
),&
"fic
titio
us
cha
rge
ma
ss"
write
(20
,20
1)
qe
qfr
ictio
n,
"ch
arg
efr
ictio
n"
en
dif
write
(20
,*)
if(f_
po
ten
tial.e
q.2
)th
en
do
i_ty
pe
=1
,n_
typ
ew
rite
(20
,20
2)
(ep
sil(i_
typ
e,j_
typ
e)/
4,j_
typ
e=
1,n
_ty
pe
),&
"e
ne
rgy
pa
ram
ete
rs"
en
dd
ow
rite
(20
,*)
do
i_ty
pe
=1
,n_
typ
ew
rite
(20
,20
2)
(sig
ma
(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e),
&"
len
gth
sca
lep
ara
me
ters
"e
nd
do
els
eif(
f_p
ote
ntia
l.eq
.3)
the
nd
oi_
typ
e=
1,n
_ty
pe
write
(20
,20
2)
(ep
sil(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e),
&"
exp
.e
ne
rgy
pa
ram
ete
rs"
en
dd
ow
rite
(20
,*)
do
i_ty
pe
=1
,n_
typ
ew
rite
(20
,20
2)
(sig
ma
(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e),
&"
inve
rse
exp
.le
ng
ht
sca
les"
en
dd
ow
rite
(20
,*)
do
i_ty
pe
=1
,n_
typ
ew
rite
(20
,20
2)
(c_
van
dw
aa
ls(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e),
&"
van
de
Wa
als
stre
ng
th"
en
dd
oe
lse
if((f
_po
ten
tial.g
e.5
).a
nd
.(f_
po
ten
tial.l
e.7
))th
en
do
i_ty
pe
=1
,n_
typ
ew
rite
(20
,20
2)
(d0
(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e),
&"
MS
bo
nd
stre
ng
thD
0"
en
dd
ow
rite
(20
,*)
do
i_ty
pe
=1
,n_
typ
ew
rite
(20
,20
2)
(msr
0(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e),
&"
MS
bo
nd
len
gth
R0
"e
nd
do
write
(20
,*)
do
i_ty
pe
=1
,n_
typ
ew
rite
(20
,20
2)
(ga
mm
a(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e),
&"
MS
forc
eco
nst
an
tg
am
ma
"e
nd
do
write
(20
,*)
do
i_ty
pe
=1
,n_
typ
ew
rite
(20
,20
2)
(msz
eta
(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e),
&"
slate
ro
rbita
le
xpo
ne
nt
zeta
"e
nd
do
write
(20
,*)
write
(20
,22
0)
(msn
(i_
typ
e),
i_ty
pe
=1
,n_
typ
e),
&"
prin
cip
al
qu
an
tum
nu
mb
er
n"
els
eif(
f_p
ote
ntia
l.eq
.8)
the
nd
oi_
typ
e=
1,n
_ty
pe
write
(20
,20
2)
(va
sh_
h(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e),
&"
rep
uls
ive
stre
ng
thH
"e
nd
do
write
(20
,*)
do
i_ty
pe
=1
,n_
typ
ew
rite
(20
,20
2)
(va
sh_
eta
(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e),
&"
rep
uls
ive
exp
on
en
tse
ta"
en
dd
ow
rite
(20
,*)
write
(20
,20
2)
(va
sh_
alp
ha
(i_
typ
e),
i_ty
pe
=1
,n_
typ
e),
&"
po
lariza
bili
tya
lph
a"
write
(20
,20
2)
(va
sh_
B(i_
typ
e),
i_ty
pe
=1
,n_
typ
e),
&"
thre
eb
od
yB
"w
rite
(20
,20
2)
(va
sh_
l(i_
typ
e),
i_ty
pe
=1
,n_
typ
e),
&"
thre
eb
od
yl"
write
(20
,20
2)
(va
sh_
cth
eta
(i_
typ
e),
i_ty
pe
=1
,n_
typ
e),
&"
thre
eb
od
yco
sth
eta
"w
rite
(20
,20
2)
(va
sh_
r0(i_
typ
e),
i_ty
pe=
1,n
_ty
pe
),&
"th
ree
bo
dy
r0"
en
dif
write
(20
,*)
if(f_
po
ten
tial.e
q.3
.or.
&((
f_p
ote
ntia
l.ge
.5).
an
d.(
f_po
ten
tial.l
e.9
)))
the
nw
rite
(20
,20
2)
alp
ha
,v_
cut,"
alp
ha
,v_
cut"
en
dif
if(f
_p
ote
ntia
l.le
.2.o
r.f_
po
ten
tial.e
q.4
)th
en
do
i_ty
pe
=1
,n_
typ
ew
rite
(20
,20
2)
(r_
cuto
ff(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e),
&"
cuto
ffra
diu
s"e
nd
do
en
dif
write
(20
,*)
do
i_ty
pe
=1
,n_
typ
ew
rite
(20
,20
2)
(r_
skin
(i_
typ
e,j_
typ
e),
j_ty
pe
=1
,n_
typ
e),
&"
skin
rad
ius"
en
dd
oe
nd
ifw
rite
(20
,*)
write
(20
,21
0)
n_
silic
,"#
of
silic
ium
ato
ms"
write
(20
,21
0)
n_
oxy
,"#
of
oxy
ge
nato
ms"
write
(20
,21
0)
n_
tro
t,"
Tro
tte
r#
"w
rite
(20
,21
0)
n_
ord
er,
"o
rde
ro
fin
teg
rato
r"w
rite
(20
,21
0)
n_
time
_sc
al,"
time
sca
lese
pa
ratio
nin
t/e
xt"
if(f
_p
ote
ntia
l.eq
.3.o
r.&
((f_
po
ten
tial.g
e.5
).a
nd
.(f_
pote
ntia
l.le
.8))
)th
en
write
(20
,*)
write
(20
,20
2)
alp
ha
,sq
rt(q
_cu
t_2
),"
alp
ha
,q_
cut"
write
(20
,20
2)
erf
cc(a
lph
a*r
_cu
toff(1
,1))
&,e
xp(-
q_
cut_
2/(
2*a
lph
a)*
*2),
"m
ax.
ind
.e
rro
rs"
write
(20
,20
1)
r_cu
t_sh
ort
,"r_
cut_
short
"w
rite
(20
,21
0)
f_sy
mm
etr
y,"
sym
me
try"
en
dif
en
dif
if(f
_p
ote
ntia
l.eq
.3.o
r.&
((f_
po
ten
tial.g
e.5
).a
nd
.(f_
pote
ntia
l.le
.8))
)&
call
his
t_a
ng
_in
it
dip
ole
_cl
ass
1=
0.d
0d
ipo
le_
cla
ss2
=0
.d0
dip
ole
_cl
ass
4=
0.d
0
128
B.1. Molecular Dynamics Code
dip
ole
_co
un
t=
0
op
en
(86
,file
=’p
imd
.sio
si’,s
tatu
s=’u
nkn
ow
n’)
op
en
(87
,file
=’p
imd
.osi
o’,s
tatu
s=’u
nkn
ow
n’)
!o
pe
n(6
5,file
=’p
imd
.dip
’,sta
tus=
’un
kno
wn
’)
20
1fo
rma
t(1
e14
.6,a
)2
02
form
at(
2e
14
.6,a
)2
20
form
at(
2i1
4,a
)2
03
form
at(
3e
14
.6,a
)2
10
form
at(
1i1
4,a
)
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
his
t_a
ng
_in
itim
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
do
i_g
rid
=1
,n
_g
rid
do
i_d
um
my
=1
,3
his
t_a
ng
(i_d
um
my,
i_g
rid
)=
0.
en
dd
oe
nd
do
ne
igh
_tim
e=
0.
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
ob
serv
atio
nim
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
inte
ge
rj_
cor,
k_co
r,j_
me
asu
re,
i_cl
ass
do
ub
lep
reci
sion
r_2
,r_
1,
vel(n
_d
im),
pb
c_n
orm
inte
ge
rp
bc_
x,pb
c_y,
pb
c_z
t_d
yna
mic
_1
=t_
dyn
am
ic_
1+
t_d
yna
mic
*dt
t_d
yna
mic
_2
=t_
dyn
am
ic_
2+
t_d
yna
mic
**2
*dt
t_d
iag
_1
=t_
dia
g_
1+
t_d
iag
*dt
t_n
dia
g_
1=
t_nd
iag
_1
+t_
nd
iag
*dt
v_in
ter_
1=
v_in
ter_
1+
(v_
inte
r-v_
ga
uge
)*d
tv_
inte
r_2
=v_
inte
r_2
+(v
_in
ter-
v_g
au
ge
)**2
*dt
if(f
_p
ote
ntia
l.gt.1
)ca
llvi
ri_
est
ima
tor
viri_
est
_1
=vi
ri_
est
_1
+vi
ri_
est
*dt
viri_
est
_2
=vi
ri_
est
_2
+vi
ri_
est
**2
*dt
call
prim
_e
stim
ato
r!
r_d
um
my
=n
_d
im*n
_p
art
*n_
tro
t*tk
p/2
-v_
cha
inr_
du
mm
y=
t_d
yna
mic
-v_
cha
inp
rim
_e
st_
1=
prim
_e
st_
1+
r_d
um
my*
dt
prim
_e
st_
2=
prim
_e
st_
2+
r_d
um
my*
*2*d
t
do
i_d
im=
1,
n_
dim
+3
sca
l_1
(i_
dim
)=
sca
l_1
(i_
dim
)+
sca
l_0
(i_
dim
)*d
td
oj_
dim
=1
,n_
dim
+3
sca
l_2
(j_
dim
,i_d
im)
=sc
al_
2(j_
dim
,i_d
im)
&+
sca
l_0
(j_
dim
)*sc
al_
0(i_
dim
)*d
te
nd
do
en
dd
ovo
l_1
=vo
l_1
+vo
lum
e*d
tvo
l_2
=vo
l_2
+vo
lum
e**
2*d
t
time
_o
bs
=tim
e_
ob
s+
dt
if(m
od
(ie
ff_
time
,ni_
time
).e
q.0
)th
en
!---
-im
agin
ary
time
corr
ela
tion
fun
ctio
n
call
r25
0(m
z,ra
nd
om
,n_
dim
,1,k
ptr
)i_
tro
t=
int(
n_tr
ot*
ran
do
m(1
))if
(i_
tro
t.e
q.n
_tr
ot)
i_tr
ot
=0
cou
nt_
ifun
c=
cou
nt_
ifun
c+
1
!---
-T
ER
Mm
ea
sco
r_ifu
nc
do
i_d
um
my
=0
,n
_tr
ot-
1j_
tro
t=
mo
d(i_tr
ot+
i_d
um
my,
n_
tro
t)d
oi_
pa
rt=
1,n
_p
art
i_ty
pe
=ty
pe(i_
pa
rt)
do
i_d
im=
1,n
_d
imco
r_ifu
nc(
i_d
um
my)
=co
r_ifu
nc(
i_d
um
my)
+m
ass
(0,i_
typ
e)
*(
&r_
rea
l(i_
dim
,i_tr
ot,i_
pa
rt)
-r_
real(i_
dim
,j_tr
ot,i_
pa
rt)
)**
2e
nd
do
en
dd
oe
nd
do
!---
-ce
ntr
oid
time
corr
ela
tion
funct
ion
!---
--T
ER
Mm
ea
sco
nf_
cen
trif(
i_m
ea
sure
.eq.n
_co
r)th
en
do
i_p
art
=1,n
_p
art
i_ty
pe
=ty
pe
(i_
pa
rt)
do
i_d
im=
1,n
_d
imco
nf_
cen
tr(i_d
im,i_
pa
rt)
=0
.q
do
t0(i_
dim
,i_p
art
)=
0.
!Q
’(t=
0)
do
j_d
im=
1,
n_
dim
if(
(e_
dim
.eq
.3)
.or.
(i_
dim
.eq
.j_dim
))
the
nco
nf_
cen
tr(i_
dim
,i_p
art
)=
con
f_ce
ntr
(i_
dim
,i_p
art
)&
+h
_m
at(
i_d
im,j_
dim
)*
ux(
1,j_
dim
,1,i_
pa
rt)
qd
ot0
(i_
dim
,i_p
art
)=
qd
ot0
(i_
dim
,i_p
art
)&
+ch
arg
ex(
1,i_
pa
rt)
en
dif
en
dd
oco
nf_
cen
tr(i_d
im,i_
pa
rt)
=co
nf_
cen
tr(i_
dim
,i_p
art
)/
dt
qd
ot0
(i_
dim
,i_p
art
)=
qd
ot0
(i_
dim
,i_pa
rt)
/d
te
nd
do
en
dd
oi_
me
asu
re=
0co
r_fu
nc(
n_
cor,
1)
=co
r_fu
nc(
n_
cor,
1)
+1
.q
do
t_co
r(n
_co
r)=
qd
ot_
cor(
n_
cor)
+1.
cor_
fun
c_A
(n_co
r)=
cor_
fun
c_A
(n_
cor)
+1
.e
nd
if
do
i_p
art
=1
,n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
do
i_d
im=
1,n
_d
imve
l(i_
dim
)=
0.
do
j_d
im=
1,
n_
dim
if(
(e_
dim
.eq
.3)
.or.
(i_
dim
.eq
.j_d
im)
)&
vel(i_
dim
)=
vel(i_
dim
)&
+h
_m
at(
i_d
im,j_
dim
)*
ux(
1,j_
dim
,1,i_
pa
rt)
129
B. Programse
nd
do
vel(i_
dim
)=
vel(i_
dim
)/
dt
cor_
fun
c(i_
me
asu
re,i_
typ
e)
&=
cor_
fun
c(i_
me
asu
re,i_
typ
e)
+m
ass
(0,i_
typ
e)
*&
con
f_ce
ntr
(i_
dim
,i_p
art
)*
vel(i_
dim
)/
n_
tro
tq
do
t_co
r(i_
me
asu
re)
=q
do
t_co
r(i_
me
asu
re)
+q
eq
ma
ss(i_
typ
e)
*&
qd
ot0
(i_
dim
,i_p
art
)*
cha
rge
x(1
,i_
pa
rt)
/d
tco
r_fu
nc_
A(i_
me
asu
re)
&=
cor_
fun
c_A
(i_
me
asu
re)
+m
ass
(0,i_
typ
e)
*&
con
f_ce
ntr
(i_
dim
,i_p
art
)*
vel(i_
dim
)/
n_
tro
t!-
--m
eth
od
B:
be
tte
rst
atis
tics,
less
ind
ep
en
de
nce
:st
ore
d_
vel(i_
dim
,i_m
ea
sure
,i_p
art
)=ve
l(i_
dim
)if
(i_
time
.gt.(n
_re
lax+
n_
cor)
)th
en
cor_
fun
c_B
(n_
cor)
=co
r_fu
nc_
B(n
_co
r)+
1.
do
j_m
ea
sure
=0
,i_
me
asu
reco
r_fu
nc_
B(j_
me
asu
re)=
cor_
fun
c_B
(j_
me
asu
re)
+&
ma
ss(0
,i_ty
pe
)*ve
l(i_
dim
)&
*sto
red
_ve
l(i_
dim
,i_m
ea
sure
-j_
me
asu
re,i_
pa
rt)
&/
n_
tro
te
nd
do
do
j_m
ea
sure
=i_
me
asu
re+
1,
n_
cor-
1co
r_fu
nc_
B(j_
me
asu
re)=
cor_
fun
c_B
(j_
me
asu
re)
+&
ma
ss(0
,i_ty
pe
)*ve
l(i_
dim
)&
*sto
red
_ve
l(i_
dim
,n_
cor+
i_m
ea
sure
-j_
me
asu
re,i_
part
)&
/n
_tr
ot
en
dd
oe
nd
if
en
dd
oe
nd
do
i_m
ea
sure
=i_
me
asu
re+
1
en
dif
!---
-m
ea
sure
rad
ial
corr
ela
tion
fun
ctio
nif
((f
_p
ote
ntia
l.ge
.2)
.an
d.
(mo
d(i_
time
,5).
eq
.0)
)th
en
!---
-ch
ose
ran
do
mtr
otte
rtim
eca
llr2
50
(mz,
ran
do
m,n
_d
im,1
,kp
tr)
i_tr
ot
=in
t(ra
nd
om
(1)*
n_
tro
t)if(
i_tr
ot.e
q.n
_tr
ot)
i_tr
ot
=0
g_
r(1
,1,n
_g
rid
+1
)=
g_
r(1
,1,n
_g
rid
+1
)+
dt
if(f
_p
ote
ntia
l.eq
.9)
the
n!
Sca
nd
olo
:sm
all
syst
em
size
,co
un
tp
erio
dic
ima
ge
sa
sw
ell
pb
c_n
orm
=2
.0!*
(2.0
*n_
pb
c+1
.0)*
*3d
oi_
pa
rt=
1,n
_p
art
do
j_p
art
=1
,n_
pa
rtd
op
bc_
x=
-n_
pb
c,n
_p
bc
do
pb
c_y
=-n
_p
bc,
n_
pb
cd
op
bc_
z=
-n_
pb
c,n
_p
bc
i_ty
pe
=ty
pe
(i_
pa
rt)
j_ty
pe
=ty
pe
(j_
pa
rt)
call
calc
_d
ist_
pb
c(r_
2,i_
tro
t,i_
pa
rt,j_
pa
rt,
&p
bc_
x,p
bc_
y,p
bc_
z)r_
1=
sqrt
(r_
2)
i_g
rid
=n
int(
n_
grid
*r_
1/r
_cu
toff(i_
type
,j_ty
pe
))if(
i_g
rid
.le.n
_g
rid
)&
g_
r(i_
typ
e,j_
typ
e,i_
grid
)=
&g
_r(
i_ty
pe
,j_ty
pe
,i_g
rid
)&
+d
t/p
bc_
no
rme
nd
do
en
dd
oe
nd
do
en
dd
oe
nd
do
els
e do
i_p
art
=1,n
_p
art
i_ty
pe
=ty
pe
(i_
pa
rt)
do
i_n
eig
h=
1,n
eig
hb
or(
0,i_
pa
rt)
j_p
art
=n
eig
hb
or(
i_n
eig
h,i_
pa
rt)
j_ty
pe
=ty
pe
(j_
pa
rt)
call
calc
_d
ista
nce
(r_
2,i_
tro
t,i_
pa
rt,j_
pa
rt)
r_1
=sq
rt(r
_2)
i_g
rid
=n
int(
n_
grid
*r_
1/r
_cu
toff(i_
typ
e,j_
typ
e))
if(i_
grid
.le.n
_g
rid
)&
g_
r(i_
typ
e,j_
typ
e,i_
grid
)=
&g
_r(
i_ty
pe
,j_ty
pe
,i_g
rid
)+
dt
en
dd
oe
nd
do
en
dif
en
dif
if((
f_p
ote
ntia
l.eq
.3).
or.
(&
(f_
po
ten
tial.g
e.5
).a
nd
.(f_
po
ten
tial.l
e.9
)))
the
nif
(f_
po
ten
tial.n
e.8
)ca
llb
on
d_
an
aly
sis
if((
f_sy
mm
etr
y.e
q.6
).o
r.(f
_sy
mm
etr
y).e
q.7
)th
en
ord
_c
=o
rd_c
+1
.d0
ord
_p
ar
=o
rd_
pa
r-
45
.o
rd_
pa
r_1
=o
rd_
pa
r_1
+o
rd_
pa
ro
rd_
pa
r_2
=o
rd_
pa
r_2
+o
rd_
pa
r**2
ord
_p
ar_
4=
ord
_p
ar_
4+
ord
_p
ar*
*4
ord
_p
arC
_1
=o
rd_
pa
rC_
1+
ord
_p
arC
ord
_p
arC
_2
=o
rd_
pa
rC_
2+
ord
_p
arC
**2
ord
_p
arC
_4
=o
rd_
pa
rC_
4+
ord
_p
arC
**4
en
dif
en
dif
if(f
_p
ote
ntia
l.eq
.9)
the
nif
((f_
sym
metr
y.e
q.6
).o
r.(f
_sy
mm
etr
y).e
q.7
)th
en
ord
_p
arB
=0.d
0d
oi_
pa
rt=
1,
n_
pa
rtif
((ty
pe
(7)=
=2
).a
nd
.(ty
pe
(i_
pa
rt)=
=2
))th
en
i_cl
ass
=m
od
(i_
pa
rt-1
,18
)-5
if((
i_cl
ass
.eq
.2).
or.
(i_
cla
ss.e
q.4
).o
r.(i_
cla
ss.e
q.6
).o
r.&
(i_
cla
ss.e
q.8
).o
r.(i_cl
ass
.eq
.9).
or.
(i_
cla
ss.e
q.1
2))
&th
en
ord
_p
arB
=ord
_p
arB
+d
ipo
le(3
,i_p
art
)!
write
(81
,*)
i_p
art
,i_
cla
ss,
!&
dip
ole
(3,i_
part
)e
lse
if&
((i_
cla
ss.e
q.1
).o
r.(i_
class
.eq
.3).
or.
(i_
cla
ss.e
q.5
).o
r.&
(i_
cla
ss.e
q.7
).o
r.(i_
cla
ss.e
q.1
0).
or.
(i_
cla
ss.e
q.1
1))
&th
en
ord
_p
arB
=ord
_p
arB
-d
ipo
le(3
,i_p
art
)!
write
(82
,*)
i_p
art
,i_
cla
ss,
!&
dip
ole
(3,i_
part
)e
lse st
op
"co
uld
no
ta
ssig
ncl
ass
top
art
icle
"e
nd
ife
nd
if
130
B.1. Molecular Dynamics Code
!if
(typ
e(i_
pa
rt)=
=2
)th
en
!o
rd_
pa
rB=
ord
_p
arB
+a
bs(
dip
ole
(3,i_
pa
rt))
!e
nd
ife
nd
do
ord
_p
arB
=o
rd_
pa
rB/
n_
oxy
ord
B_
c=
ord
B_
c+
1.d
0o
rd_
pa
rB_
1=
ord
_p
arB
_1
+o
rd_
pa
rBo
rd_
pa
rB_
2=
ord
_p
arB
_2
+o
rd_
pa
rB**
2o
rd_
pa
rB_
4=
ord
_p
arB
_4
+o
rd_
pa
rB**
4e
nd
ife
nd
if!
write
mo
vie
if(f
_m
ovi
e.e
q.1
)th
en
do
i_p
art
=1
,n
_p
art
if(ty
pe
(i_
pa
rt).
eq
.1)
the
nw
rite
(46
,20
4)
"Si
",(r
_re
al(i_
dim
,0,i_
pa
rt),
i_d
im=
1,n
_d
im)
els
eif(
typ
e(i_
pa
rt).
eq
.2)
the
nw
rite
(46
,20
4)
"O",
(r_
rea
l(i_
dim
,0,i_
pa
rt),
i_d
im=
1,n
_d
im)
en
dif
write
(47
,10
3)
(dip
ole
(i_
dim
,i_p
art
),i_
dim
=1
,n_
dim
)e
nd
do
write
(46
,*)
"EN
D"
write
(47
,*)
"EN
D"
en
dif
if(f
_co
nfm
ovi
e.e
q.1
)th
en
if(m
od
(i_
time
,10
).e
q.9
)th
en
write
(48
,103
)(s
cal_
0(i_
dim
),i_
dim
=1,n
_d
im+
3)
write
(48
,103
)(s
cal_
x(1
,i_d
im)/
dt,i_
dim
=1
,n_
dim
+3
)d
oi_
tro
t=
0,n
_tr
ot-
1d
oi_
pa
rt=
1,n
_p
art
write
(48
,14
1)
typ
e(i_
pa
rt),
&(r
0(i_
dim
,i_tr
ot,i_
pa
rt),
i_d
im=
1,n
_d
im)
en
dd
oe
nd
do
en
dif
en
dif
10
3fo
rma
t(3
e1
3.4
)2
04
form
at(
a,3
e1
3.4
)1
41
form
at(
i5,3
f14
.6)
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
kiha
ra_
bo
nd
sim
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
inte
ge
rj_
du
mm
y,k_
pa
rtd
ou
ble
pre
cisi
on
r_2
,s_
2,
de
lta_
s(n
_d
im)
do
ub
lep
reci
sio
nr_
avg
2(n
_d
im),
r_a
vg6
(n_
dim
),r_
avg
(n_
pa
rt,n
_d
im),
&r_
avg
_re
al(n
_p
art
,n_
dim
)
inte
ge
ri,j
,k,
cou
nt
!e
qu
iva
len
tnu
mb
er
pim
da
nd
nu
mb
er
kiha
ra:
!si
1o
6o
1o
2o
5!
31
01
31
18
!5
15
71
71
4
!ki
ha
ralis
ted
bo
nd
s!
o1
-si-o
2,
o1
-si-o
6,
o1
-si-o
5,
o2
-si-o
5
!si
1-o
1-s
i3=
3-
13
-6
;5
-7
-2
cou
nt
=0
do
i=
1,
3r_
avg
2(i)=
0.
r_a
vg6
(i)=
0.
en
dd
o
do
i=0
,n_
bin
_x-
1d
oj=
0,n
_b
in_
y-1
do
k=0
,n_
bin
_z-
1r_
avg
2(1
)=r_
avg
2(1
)+(r
0(1
,0,1
8*c
ou
nt+
2)
-i*
1./n
_b
in_
x)r_
avg
2(2
)=r_
avg
2(2
)+(r
0(2
,0,1
8*c
ou
nt+
2)
-j*
1./n
_b
in_
y)r_
avg
2(3
)=r_
avg
2(3
)+(r
0(3
,0,1
8*c
ou
nt+
2)
-k*
1./n
_b
in_
z)
r_a
vg6
(1)=
r_a
vg6
(1)+
(r0
(1,0
,18
*co
un
t+6
)-
i*1
./n
_b
in_
x)r_
avg
6(2
)=r_
avg
6(2
)+(r
0(2
,0,1
8*c
ou
nt+
6)
-j*
1./n
_b
in_
y)r_
avg
6(3
)=r_
avg
6(3
)+(r
0(3
,0,1
8*c
ou
nt+
6)
-k*
1./n
_b
in_
z)
cou
nt
=co
un
t+
1e
nd
do
en
dd
oe
nd
do
r_a
vg2
(1)=
r_avg
2(1
)/
cou
nt
r_a
vg2
(2)=
r_avg
2(2
)/
cou
nt
r_a
vg2
(3)=
r_avg
2(3
)/
cou
nt
r_a
vg6
(1)=
r_avg
6(1
)/
cou
nt
r_a
vg6
(2)=
r_avg
6(2
)/
cou
nt
r_a
vg6
(3)=
r_avg
6(3
)/
cou
nt
cou
nt
=0
do
i=0
,n_
bin
_x-
1d
oj=
0,n
_b
in_y-
1d
ok=
0,n
_b
in_z-
1r_
avg
(18
*cou
nt+
2,1
)=r_
avg
2(1
)+
i*1
./n
_b
in_
xr_
avg
(18
*cou
nt+
2,2
)=r_
avg
2(2
)+
j*1
./n
_b
in_
yr_
avg
(18
*cou
nt+
2,3
)=r_
avg
2(3
)+
k*1
./n
_b
in_
z
r_a
vg(1
8*c
ou
nt+
6,1
)=r_
avg
6(1
)+
i*1
./n
_b
in_
xr_
avg
(18
*cou
nt+
6,2
)=r_
avg
6(2
)+
j*1
./n
_b
in_
yr_
avg
(18
*cou
nt+
6,3
)=r_
avg
6(3
)+
k*1
./n
_b
in_
z
cou
nt
=co
un
t+
1e
nd
do
en
dd
oe
nd
do
do
i_p
art
=1,n
_p
art
do
i_d
im=
1,
n_
dim
r_a
vg_
rea
l(i_
pa
rt,i_
dim
)=
sca
l_0
(i_
dim
)*
&(r
_a
vg(i_
part
,i_d
im)
+1
.d0
*pb
c0(i_
dim
,0,i_
pa
rt))
en
dd
oif
(e_
dim
.eq
.3)
the
nr_
avg
_re
al(i_
pa
rt,1
)=
r_a
vg_
rea
l(i_
pa
rt,1
)+
&sc
al_
0(4
)*
(r_
avg
(i_
pa
rt,2
)+
1.d
0*p
bc0
(2,0
,i_p
art
))+
&sc
al_
0(6
)*
(r_
avg
(i_
pa
rt,3
)+
1.d
0*p
bc0
(3,0
,i_p
art
))
131
B. Programsr_
avg
_re
al(i_
pa
rt,2
)=
r_a
vg_
rea
l(i_
pa
rt,2
)+
&sc
al_
0(4
)*
(r_
avg
(i_
pa
rt,1
)+
1.d
0*p
bc0
(1,0
,i_p
art
))+
&sc
al_
0(5
)*
(r_
avg
(i_
pa
rt,3
)+
1.d
0*p
bc0
(3,0
,i_p
art
))r_
avg
_re
al(i_
pa
rt,3
)=
r_a
vg_
rea
l(i_
pa
rt,3
)+
&sc
al_
0(6
)*
(r_
avg
(i_
pa
rt,1
)+
1.d
0*p
bc0
(1,0
,i_p
art
))+
&sc
al_
0(5
)*
(r_
avg
(i_
pa
rt,2
)+
1.d
0*p
bc0
(2,0
,i_p
art
))e
nd
ife
nd
do
do
i_p
art
=1,
n_
pa
rtif
((m
od
(i_
pa
rt,1
8).
eq
.3).
or.
(mo
d(i_
pa
rt,1
8).
eq
.5))
the
nd
oi_
du
mm
y=
1,
4d
oj_
du
mm
y=
1,
4j_
pa
rt=
i_ne
igh
_o
ri(i_
pa
rt,i_
du
mm
y)k_
pa
rt=
i_ne
igh
_o
ri(i_
pa
rt,j_
du
mm
y)i=
mo
d(i_
pa
rt,1
8)
j=m
od
(j_
pa
rt,1
8)
k=m
od
(k_
pa
rt,1
8)
if(
((i.e
q.3
).a
nd
.(j.e
q.1
3).
an
d.(
k.eq
.11
)).o
r.&
((i.e
q.3
).a
nd
.(j.e
q.1
3).
an
d.(
k.e
q.1
0))
.or.
&((
i.eq
.3).
an
d.(
j.eq
.13
).a
nd
.(k.
eq
.8))
.or.
&((
i.eq
.3).
an
d.(
j.eq
.11
).a
nd
.(k.
eq
.8))
.or.
&((
i.eq
.5).
an
d.(
j.eq
.7).
an
d.(
k.e
q.1
7))
.or.
&((
i.eq
.5).
an
d.(
j.eq
.7).
an
d.(
k.e
q.1
5))
.or.
&((
i.eq
.5).
an
d.(
j.eq
.7).
an
d.(
k.e
q.1
4))
.or.
&((
i.eq
.5).
an
d.(
j.eq
.17
).a
nd
.(k.
eq
.14
)))
the
n
i_ty
pe
=ty
pe
(i_
pa
rt)
call
calc
_d
ista
nce
(s_
2,0
,i_p
art
,j_p
art
)d
oi_
dim
=1
,n
_d
imd
elta
_s(
i_d
im)
=d
elta
_ce
ll(i_
dim
)e
nd
do
call
calc
_d
ista
nce
(r_
2,0
,i_p
art
,k_
pa
rt)
r_d
um
my
=0
.d
oi_
dim
=1
,n
_d
imr_
du
mm
y=
r_du
mm
y+
me
t_te
n_
voi(i_
dim
)*
&d
elta
_s(
i_d
im)
*d
elta
_ce
ll(i_
dim
)e
nd
do
if(e
_d
im.e
q.3
)th
en
r_d
um
my
=r_
du
mm
y&
+m
et_
ten
_vo
i(4
)*
(&
de
lta_
s(1
)*d
elta
_ce
ll(2
)&
+d
elta
_s(
2)
*d
elta
_ce
ll(1
))
/2
&+
me
t_te
n_
voi(5
)*
(&
de
lta_
s(2
)*d
elta
_ce
ll(3
)&
+d
elta
_s(
3)
*d
elta
_ce
ll(2
))
/2
&+
me
t_te
n_
voi(6
)*
(&
de
lta_
s(3
)*d
elta
_ce
ll(1
)&
+d
elta
_s(
1)
*d
elta
_ce
ll(3
))
/2
en
dif
r_d
um
my
=r_
dum
my
/sq
rt(
r_2
*s_
2)
r_d
um
my
=a
cos(
r_d
um
my)
write
(87
,’(3
i,f1
4.5
)’)
i,j,k
,r_
du
mm
y*18
0./p
ie
nd
ife
nd
do
en
dd
oe
nd
ifif
(mo
d(i_
time
,15
).e
q.0
)th
en
if((
mo
d(i_
pa
rt,1
8).
eq
.13
).o
r.(m
od
(i_p
art
,18
).e
q.7
))th
en
do
i_d
um
my
=1
,2
do
j_d
um
my
=1
,2
j_p
art
=i_
ne
igh
_o
ri(i_
pa
rt,i_
du
mm
y)k_
pa
rt=
i_n
eig
h_
ori(i_
pa
rt,j_
du
mm
y)i=
mo
d(i_
pa
rt,1
8)
j=m
od
(j_
pa
rt,1
8)
k=m
od
(k_
pa
rt,1
8)
if(
((i.e
q.1
3).
an
d.(
j.eq
.3).
an
d.(
k.e
q.6
)).o
r.&
((i.e
q.7
).a
nd
.(j.e
q.5
).a
nd
.(k.
eq
.2))
)th
en
write
(88
,’(3e
16
.7)’)
&r_
rea
l(1
,0,i_
part
)-r_
rea
l(1
,0,k
_p
art
),&
r_re
al(2
,0,i_
part
)-r_
rea
l(2
,0,k
_p
art
),&
r_re
al(3
,0,i_
part
)-r_
rea
l(3
,0,k
_p
art
)w
rite
(89
,’(3e
16
.7)’)
&r_
rea
l(1
,0,i_
part
)-r_
avg
_re
al(k_
pa
rt,1
),&
r_re
al(2
,0,i_
part
)-r_
avg
_re
al(k_
pa
rt,2
),&
r_re
al(3
,0,i_
part
)-r_
avg
_re
al(k_
pa
rt,3
)e
nd
ife
nd
do
en
dd
oe
nd
ife
nd
ife
nd
do
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
bo
nd
_a
na
lysi
sim
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
inte
ge
rj_
du
mm
y,k_
pa
rt,
i_a
ng
,iii
,jjj
do
ub
lep
reci
sio
nd
r_n
eig
h,
r_2
,s_
1,
s_2
,d
elta
_s(
n_
dim
)d
ou
ble
pre
cisi
on
rord
_d
um
my
do
ub
lep
reci
sio
nrij(3
),rik(
3)
call
kih
ara
_b
on
ds
ord
_p
ar
=0
.d0
ord
_p
arC
=0
.d0
dr_
ne
igh
=(r
_n
eig
h_
ma
x-r_
ne
igh
_m
in)
/n
_g
rid
ne
igh
_tim
e=
ne
igh
_tim
e+
1.
do
i_p
art
=1
,n
_p
art
i_a
ng
=0
i_ty
pe
=ty
pe
(i_
pa
rt)
if(i_
typ
e.e
q.1
)th
en
!--
-S
i do
i_d
um
my
=1,
4j_
pa
rt=
i_ne
igh
_o
ri(i_
pa
rt,i_
du
mm
y)ca
llca
lc_
dis
tan
ce(s
_2
,0,i_
pa
rt,j_
pa
rt)
do
i_d
im=
1,
n_
dim
de
lta_
s(i_
dim
)=
de
lta_
cell(
i_d
im)
en
dd
os_
1=
sqrt
(s_
2)
r_d
um
my
=s_
1i_
grid
=n
int(
(r_
du
mm
y-r_
ne
igh
_m
in)
/d
r_n
eig
h)
if((i_
grid
.gt.1
).a
nd
.(i_
grid
.lt.n
_g
rid
))
&h
ist_
an
g(1
,i_g
rid
)=
his
t_a
ng
(1,i_
grid
)+
1.d
0d
oj_
du
mm
y=
i_d
um
my
+1
,4
i_a
ng
=i_
an
g+
1
132
B.1. Molecular Dynamics Code
if(i_
an
g.g
t.6
)st
op
"mo
reth
an
6a
ng
les
aro
un
dS
ia
tom
"k_
pa
rt=
i_n
eig
h_
ori(i_
pa
rt,j_
du
mm
y)ca
llca
lc_
dis
tan
ce(r
_2
,0,i_
pa
rt,k
_p
art
)r_
du
mm
y=
0.
do
i_d
im=
1,
n_
dim
r_d
um
my
=r_
dum
my
+m
et_
ten
_vo
i(i_
dim
)*
&d
elta
_s(
i_d
im)
*d
elta
_ce
ll(i_
dim
)e
nd
do
if(e
_d
im.e
q.3
)th
en
r_d
um
my
=r_
dum
my
&+
me
t_te
n_
voi(4
)*
(&
de
lta_s(
1)
*de
lta_
cell(
2)
+d
elta
_s(
2)
*d
elta
_ce
ll(1
))
/2
&+
me
t_te
n_
voi(5
)*
(&
de
lta_s(
2)
*de
lta_
cell(
3)
+d
elta
_s(
3)
*d
elta
_ce
ll(2
))
/2
&+
me
t_te
n_
voi(6
)*
(&
de
lta_s(
3)
*de
lta_
cell(
1)
+d
elta
_s(
1)
*d
elta
_ce
ll(3
))
/2
en
dif
r_d
um
my
=r_
du
mm
y/
sqrt
(r_
2*
s_2
)
!st
ore
variab
les
for
3b
od
yp
ote
ntia
lif
(f_
po
tentia
l.eq
.8)
the
ntr
iple
_co
s(i_
pa
rt,
i_a
ng
)=
r_d
um
my
trip
le_
pa
rtj(i_
pa
rt,
i_a
ng
)=
j_p
art
trip
le_
rij(i_
pa
rt,
i_a
ng
)=
s_1
trip
le_
pa
rtk(
i_p
art
,i_
an
g)
=k_
pa
rttr
iple
_rik(
i_pa
rt,
i_a
ng
)=
sqrt
(r_
2)
do
i_d
im=
1,
n_d
imtr
iple
_d
elta
ij(i_
pa
rt,
i_a
ng
,i_
dim
)=
de
lta_
s(i_
dim
)tr
iple
_d
elta
ik(i_
pa
rt,
i_a
ng
,i_
dim
)=
de
lta_
cell(
i_d
im)
en
dd
oe
nd
if
r_d
um
my
=aco
s(r_
du
mm
y)
i_g
rid
=n
int(
n_
grid
*r_
du
mm
y/p
i)
if((i_
grid.g
e.1
).a
nd
.(i_
grid
.le.n
_grid
))
&h
ist_
ang
(3,i_
grid
)=
his
t_a
ng
(3,i_
grid
)+
1.d
0e
nd
do
en
dd
oe
lse
if(i_
typ
e.e
q.2
)th
en
!--
-O
i_a
ng
=1
j_p
art
=i_
ne
igh
_o
ri(i_
pa
rt,1
)ca
llca
lc_
dis
tan
ce(s
_2
,0,i_
pa
rt,j_
part
)d
oi_
dim
=1
,n
_d
imd
elta
_s(
i_d
im)
=d
elta
_ce
ll(i_
dim
)e
nd
do
!--
--q
ua
rtz
eva
lua
teo
rd_
pa
ram
if((
f_sy
mm
etr
y.e
q.6
).o
r.(f
_sy
mm
etr
y.e
q.7
))th
en
if(
((ty
pe
(7).
eq
.1).
an
d.
!1
/3n
Si,
2/3
nO
Co
nfig
&((
mo
d(j_
pa
rt,6
).e
q.3
).o
r.(m
od
(j_
pa
rt,6
).e
q.4
))).
or.
&((
typ
e(7
).e
q.2
).a
nd
.!
6S
i,1
2O
,6
Si,
12
Oco
nfig
&((
mo
d(j_
pa
rt,1
8).
eq
.1).
or.
(mo
d(j_
pa
rt,1
8).
eq
.4))
))
&th
en
rord
_d
um
my
=d
elta
_ce
ll(2
)/
&sq
rt(
de
lta_
cell(
2)*
*2+
de
lta_
cell(
3)*
*2)
if(d
elta
_ce
ll(2
).g
t.0
.)th
en
if(d
elta
_ce
ll(3
).g
t.0
.)th
en
rord
_d
um
my
=a
cos(
rord
_d
um
my)
els
ero
rd_
du
mm
y=
asi
n(r
ord
_d
um
my)
en
dif
ord
_p
ar
=ord
_p
ar
+ro
rd_
du
mm
yo
rd_
pa
rC=
ord
_p
arC
+a
bs(
rord
_d
um
my*
18
0./p
i-
45
.)!
write
(44
,*)
i_p
art
,ty
pe
(i_
pa
rt),
j_p
art
,ty
pe
(j_
pa
rt),
!&
mo
d(j_
pa
rt,1
8),
18
0*r
ord
_d
um
my/
pi-4
5e
nd
ife
nd
ife
nd
ifk_
pa
rt=
i_n
eig
h_
ori(i_
pa
rt,2
)ca
llca
lc_
dis
tan
ce(r
_2
,0,i_
pa
rt,k
_p
art
)r_
du
mm
y=
0.
do
i_d
im=
1,
n_
dim
r_d
um
my
=r_
du
mm
y+
me
t_te
n_
voi(i_
dim
)*
&d
elta
_s(
i_d
im)
*d
elta
_ce
ll(i_
dim
)e
nd
do
!--
--q
uart
ze
valu
ate
ord
_p
ara
mif
((f_
sym
me
try.
eq
.6).
or.
(f_
sym
me
try.
eq
.7))
the
nif
(((
typ
e(7
).e
q.1
).a
nd
.!
1/3
nS
i,2
/3n
OC
on
fig&
((m
od
(k_
pa
rt,6
).e
q.3
).o
r.(m
od
(k_
pa
rt,6
).e
q.4
))).
or.
&((
type
(7).
eq
.2).
an
d.
!6
Si,
12
O,
6S
i,1
2O
con
fig&
((m
od
(k_
pa
rt,1
8).
eq
.1).
or.
(mo
d(k
_p
art
,18
).e
q.4
)))
)&
then
rord
_d
um
my
=d
elta
_ce
ll(2
)/
&sq
rt(
de
lta_
cell(
2)*
*2+
de
lta_
cell(
3)*
*2)
if(d
elta
_ce
ll(2
).g
t.0
.)th
en
if(d
elta
_ce
ll(3
).g
t.0
.)th
en
rord
_d
um
my
=a
cos(
rord
_d
um
my)
els
ero
rd_
du
mm
y=
asi
n(r
ord
_d
um
my)
en
dif
ord
_p
ar
=ord
_p
ar
+ro
rd_
du
mm
yo
rd_
pa
rC=
ord
_p
arC
+a
bs(
rord
_d
um
my*
18
0./p
i-
45
.)!
write
(44
,*)
i_p
art
,ty
pe(i_
pa
rt),
k_p
art
,ty
pe
(k_p
art
),!
&m
od
(k_
pa
rt,1
8),
18
0*r
ord
_d
um
my/
pi-4
5e
nd
ife
nd
ife
nd
if
if(e
_d
im.e
q.3
)th
en
r_d
um
my
=r_
du
mm
y&
+m
et_
ten
_vo
i(4
)*
(&
de
lta_
s(1
)*d
elta
_ce
ll(2
)+
de
lta_
s(2
)*
de
lta_
cell(
1)
)/
2&
+m
et_
ten
_vo
i(5
)*
(&
de
lta_
s(2
)*d
elta
_ce
ll(3
)+
de
lta_
s(3
)*
de
lta_
cell(
2)
)/
2&
+m
et_
ten
_vo
i(6
)*
(&
de
lta_
s(3
)*d
elta
_ce
ll(1
)+
de
lta_
s(1
)*
de
lta_
cell(
3)
)/
2e
nd
ifr_
du
mm
y=
r_du
mm
y/
sqrt
(r_
2*
s_2
)
!st
ore
varia
ble
sfo
r3
bo
dy
po
ten
tial
if(f
_p
ote
ntia
l.eq
.8)
the
ntr
iple
_co
s(i_
pa
rt,
i_a
ng
)=
r_d
um
my
trip
le_
pa
rtj(i_
pa
rt,
i_a
ng
)=
j_p
art
trip
le_
rij(i_
pa
rt,
i_a
ng
)=
sqrt
(s_
2)
trip
le_
pa
rtk(
i_p
art
,i_
an
g)
=k_
pa
rttr
iple
_rik(
i_p
art
,i_
an
g)
=sq
rt(r
_2)
do
i_d
im=
1,
n_
dim
trip
le_
de
ltaij(
i_p
art
,i_
an
g,
i_d
im)
=d
elta
_s(
i_d
im)
trip
le_
de
ltaik
(i_
pa
rt,
i_a
ng
,i_
dim
)=
de
lta_
cell(
i_d
im)
en
dd
oe
nd
if
r_d
um
my
=a
cos(
r_d
um
my)
133
B. Programs!
write
vect
or
fro
mm
idd
leo
fsi
-si
con
ne
ctio
nlin
eto
o
do
iii=
1,3
rij(iii
)=0
.rik(
iii)=
0.
do
jjj=
1,3
rij(iii
)=rij(iii
)+h
_m
at(
iii,jj
j)*d
elta
_s(
jjj)
rik(
iii)=
rik(
iii)+
h_
ma
t(iii
,jjj)*d
elta
_ce
ll(jjj
)e
nd
do
en
dd
o
if(i_
pa
rt.e
q.1
5)
&w
rite
(86
,’(3
i,3f1
4.5
)’)
i_p
art
,j_p
art
,k_
pa
rt,
&(0
.5*(
rij(iii
)+rik(
iii))
,iii=
1,3
)
i_g
rid
=n
int(
n_
grid
*r_
du
mm
y/p
i)
if((i_
grid
.gt.0
).a
nd
.(i_
grid
.lt.n
_g
rid
))
&h
ist_
an
g(2
,i_g
rid
)=
his
t_a
ng
(2,i_
grid
)+
1.d
0e
nd
ife
nd
do
if((
f_sy
mm
etr
y.e
q.6
).o
r.(f
_sy
mm
etr
y.e
q.7
))th
en
ord
_p
ar
=1
80
*o
rd_
pa
r/
pi
ord
_p
ar
=1
.5*
ord
_p
ar
/n
_si
lico
rd_
pa
rC=
1.5
*o
rd_
pa
rC/
n_
silic
en
dif
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
viri_
est
ima
tor
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
do
ub
lep
reci
sio
nr_
loca
l(n
_d
im),
r_h
elp
(n_
dim
),f_
loca
l(n
_d
im)
!---
-ch
an
ge
tra
nsf
orm
viri_
est
=0.
!---
-te
rmm
ea
svi
ri_
est
do
i_p
art
=1
,n_
pa
rtd
oi_
tro
t=
0,n
_tr
ot-
1d
oi_
dim
=1
,n_d
imr_
loca
l(i_
dim
)=
0.
f_lo
cal(i_
dim
)=
0.
r_h
elp
(i_
dim
)=
r0(i_
dim
,i_tr
ot,i_
pa
rt)
&+
1.
*p
bc0
(i_
dim
,i_tr
ot,i_
pa
rt)
-r_
ref(
i_d
im,i_
pa
rt)
en
dd
od
oi_
dim
=1
,n_
dim
do
j_d
im=
1,n
_d
imr_
loca
l(i_
dim
)=
r_lo
cal(i_
dim
)+
&h
_m
at(
i_d
im,j_
dim
)*
r_h
elp
(j_
dim
)f_
loca
l(i_
dim
)=
f_lo
cal(i_
dim
)+
&h
_m
at(
i_d
im,j_
dim
)*
(fo
rce
(j_
dim
,i_tr
ot,i_
pa
rt)
)!
&0
*m
ass
(i_
du
mm
y,i_
typ
e)
*fr
ictio
n(i_
typ
e)
*r_
du
mm
y**2
!&
*(u
x(1
,j_d
im,i_
tro
t,i_
pa
rt)/
dt)
)e
nd
do
!6
66
line
sa
bo
vee
nd
do
do
i_d
im=
1,
n_
dim
viri_
est
=vi
ri_
est
+r_
loca
l(i_
dim
)*
f_lo
cal(i_
dim
)e
nd
do
en
dd
o
en
dd
ovi
ri_
est
=-v
iri_
est
/2
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
prim
_e
stim
ato
rim
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
v_ch
ain
=0
.d
oi_
tro
t=
0,
n_
tro
t-1
j_tr
ot
=m
od(i_
tro
t+1
,n_
tro
t)d
oi_
pa
rt=
1,
n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
!---
-T
ER
Mm
ea
sp
rim
_e
std
oi_
dim
=1
,n
_d
imv_
cha
in=
v_ch
ain
+k_
qu
an
t(i_
typ
e)
*(
&r_
rea
l(i_
dim
,i_tr
ot,i_
pa
rt)
-r_
rea
l(i_
dim
,j_tr
ot,i_
pa
rt)
)**2
en
dd
oe
nd
do
en
dd
ov_
cha
in=
v_ch
ain
/2
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
ob
ser_
ou
tim
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
inte
ge
rn
um
be
r_sp
ec(
n_
typ
e),
i_cl
ass
do
ub
lep
reci
sio
nn
orm
_sp
ec(
n_
typ
e,n
_ty
pe
)
do
i_ty
pe
=1
,n_
typ
en
um
be
r_sp
ec(
i_ty
pe
)=
0e
nd
do
do
i_p
art
=1
,n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
nu
mb
er_
spe
c(i_
typ
e)
=n
um
be
r_sp
ec(
i_ty
pe
)+
1e
nd
do
write
(20
,*)
write
(20
,20
1)
time
_o
bs,
"tim
eo
bse
rve
d"
t_d
yna
mic
_1
=t_
dyn
am
ic_
1/tim
e_
ob
st_
dyn
am
ic_
2=
t_d
yna
mic
_2
/tim
e_
ob
s-
t_d
yna
mic
_1
**2
t_d
yna
mic
_1
=t_
dyn
am
ic_
1/
(n_
pa
rt*n
_tr
ot)
t_d
yna
mic
_2
=t_
dyn
am
ic_
2/
(n_
pa
rt*n
_tr
ot*
tkp
**2
)w
rite
(20
,*)
write
(20
,20
2)
t_d
yna
mic
_1
,t_
dyn
am
ic_
2,"
dyn
am
icki
n.
en
erg
y"
t_d
iag
_1
=t_
dia
g_
1/tim
e_
ob
st_
nd
iag
_1
=t_
nd
iag
_1
/tim
e_
ob
sw
rite
(20
,20
2)
t_d
iag
_1
,t_
nd
iag
_1
,"d
iag
an
dn
on
_d
iag
T_
kin
"
v_in
ter_
1=
v_in
ter_
1/
time
_o
bs
v_in
ter_
2=
v_in
ter_
2/
time
_o
bs
-v_
inte
r_1
**2
v_in
ter_
1=
v_in
ter_
1/
(n_
pa
rt*n
_tr
ot)
v_in
ter_
2=
v_in
ter_
2/
(n_
pa
rt*n
_tr
ot*
tkp
**2
)w
rite
(20
,*)
134
B.1. Molecular Dynamics Code
write
(20
,20
2)
v_in
ter_
1,
v_in
ter_
2,"
inte
ract
ion
en
erg
y"
viri_
est
_1
=vi
ri_
est
_1
/tim
e_
ob
svi
ri_
est
_2
=vi
ri_
est
_2
/tim
e_
ob
s-
viri_
est
_1
**2
viri_
est
_1
=vi
ri_
est
_1
/(n
_p
art
*n_
trot)
viri_
est
_2
=vi
ri_
est
_2
/(n
_p
art
*n_
trot*
tkp
**2
)w
rite
(20
,*)
write
(20
,20
2)
viri_
est
_1
,vi
ri_
est
_2
,"vi
ria
le
stim
ato
r"
prim
_e
st_
1=
prim
_e
st_
1/
time
_o
bs
prim
_e
st_
2=
prim
_e
st_
2/
time
_o
bs
-p
rim
_e
st_
1**
2p
rim
_e
st_
1=
prim
_e
st_
1/
(n_
pa
rt*n
_tr
ot)
prim
_e
st_
2=
prim
_e
st_
2/
(n_
pa
rt*n
_tr
ot*
tkp
**2
)w
rite
(20
,20
2)
prim
_e
st_
1,
prim
_e
st_
2,"
Prim
itive
en
erg
y"
if((
f_sy
mm
etr
y.e
q.6
).o
r.(f
_sy
mm
etr
y.e
q.7
))th
en
ord
_p
ar_
1=
ord
_p
ar_
1/
ord
_c
ord
_p
ar_
2=
ord
_p
ar_
2/
ord
_c
ord
_p
ar_
4=
ord
_p
ar_
4/
ord
_c
write
(20
,*)
"ord
_p
ar
de
lta_
ph
i",
ord
_p
ar_
1,
ord
_p
ar_
2,
ord
_p
ar_
4o
rd_
pa
r_2
=ord
_p
ar_
2-
ord
_p
ar_
1**
2o
rd_
pa
r_2
=ord
_p
ar_
2/
tkw
rite
(20
,*)
"su
ssz.
",o
rd_
pa
r_2
write
(20
,*)
ord
_p
arB
_1
=o
rd_
pa
rB_
1/
ord
B_
co
rd_
pa
rB_
2=
ord
_p
arB
_2
/o
rdB
_c
ord
_p
arB
_4
=o
rd_
pa
rB_
4/
ord
B_
cw
rite
(20
,*)
"ord
_p
ar
mu
_z"
,o
rd_
pa
rB_1
,o
rd_
pa
rB_
2,
ord
_p
arB
_4
ord
_p
arB
_2
=o
rd_
pa
rB_
2-
ord
_p
arB
_1
**2
ord
_p
arB
_2
=o
rd_
pa
rB_
2/
tkw
rite
(20
,*)
"su
ssz.
",o
rd_
pa
rB_
2w
rite
(20
,*)
ord
_p
arC
_1
=o
rd_
pa
rC_
1/
ord
_c
ord
_p
arC
_2
=o
rd_
pa
rC_
2/
ord
_c
ord
_p
arC
_4
=o
rd_
pa
rC_
4/
ord
_c
write
(20
,*)
"ord
_p
ar
mu
_z"
,o
rd_
pa
rC_1
,o
rd_
pa
rC_
2,
ord
_p
arC
_4
ord
_p
arC
_2
=o
rd_
pa
rC_
2-
ord
_p
arC
_1
**2
ord
_p
arC
_2
=o
rd_
pa
rC_
2/
tkw
rite
(20
,*)
"su
ssz.
",o
rd_
pa
rC_
2e
nd
if
if(f
_p
ote
ntia
l.eq
.9)
the
nd
oi_
dim
=0
,3d
oi_
cla
ss=
1,1
2d
ipo
le_
cla
ss1
(i_
dim
,i_cl
ass
)=&
dip
ole
_cl
ass
1(i_
dim
,i_cl
ass
)/d
ipo
le_
cou
nt
en
dd
oe
nd
do
write
(20
,*)
do
i_cl
ass
=1
,12
write
(20
,209
)(d
ipo
le_
cla
ss1
(i_
dim
,i_cl
ass
),i_
dim
=0
,3),
&"
oxy
ge
nty
pe
",i_
cla
sse
nd
do
en
dif
if(f
_p
ote
ntia
l.gt.1
)th
en
vol_
1=
vol_
1/
time
_o
bs
vol_
2=
vol_
2/
time
_o
bs
vol_
2=
vol_
2-
vol_
1**
2vo
l_2
=(v
ol_
2/v
ol_
1)
/tk
write
(20
,*)
write
(20
,20
2)
vol_
1/n
_p
art
,vo
l_2
,"vo
lum
e"
do
i_d
im=
1,
n_
dim
+3
sca
l_1
(i_
dim
)=
sca
l_1
(i_
dim
)/
time
_o
bs
en
dd
od
oi_
dim
=1
,n
_d
im+
3d
oj_
dim
=1
,n
_d
im+
3sc
al_
2(j_
dim
,i_d
im)
=sc
al_
2(j_
dim
,i_d
im)
/tim
e_
ob
ssc
al_
2(j_
dim
,i_d
im)
=(
sca
l_2
(j_
dim
,i_d
im)
-&
sca
l_1
(j_
dim
)*
sca
l_1
(i_
dim
))
/tk
en
dd
oe
nd
do
r_d
um
my
=sc
al_
1(1
)*sc
al_
1(2
)*sc
al_
1(3
)+
&2
*sca
l_1
(4)*
sca
l_1
(5)*
sca
l_1
(6)
-sc
al_
1(4
)**2
*sca
l_1
(3)
&-
sca
l_1
(5)*
*2*s
cal_
1(1
)-
sca
l_1
(6)*
*2*s
cal_
1(2
)w
rite
(20
,20
2)
r_d
um
my/
n_
pa
rt
write
(20
,*)
if(f
_p
ote
ntia
l.gt.1
)th
en
write
(20
,*)
"sca
l.va
ria
ble
"w
rite
(20
,20
6)
(sca
l_1
(i_
dim
),i_
dim
=1,
n_
dim
+3
)if
(f_
pre
ssu
re.e
q.1
)th
en
write
(20
,*)
do
i_d
im=
1,
n_
dim
+3
write
(20
,20
6)
(sca
l_2
(i_
dim
,j_d
im),
j_d
im=
1,
n_
dim
+3
)e
nd
do
en
dif
en
dif
en
dif
if(
(f_
po
ten
tial.g
t.1
).a
nd
.(f
_p
ress
ure
.eq
.0)
)th
en
write
(20
,*)
write
(20
,*)
"ela
stic
con
sta
nts
"w
rite
(20
,*)
do
i_d
im=
1,
n_
dim
do
j_d
im=
1,
n_
dim
stra
in_
1(i_
dim
,j_d
im)
=st
rain
_1
(i_
dim
,j_d
im)
/tim
e_
bo
rne
nd
do
en
dd
od
oi_
dim
=1
,n
_d
imd
oj_
dim
=i_
dim
,n
_d
imd
ok_
dim
=i_
dim
,n
_d
imd
ol_
dim
=k_
dim
,n
_d
imif
(i_
dim
+j_
dim
.le.k
_d
im+
l_d
im)
the
ne
la_
bo
rn_
1(i_d
im,
j_d
im,
k_d
im,
l_d
im)
=&
ela
_b
orn
_1
(i_
dim
,j_
dim
,k_
dim
,l_
dim
)/
time
_b
orn
stra
in_
2(i_
dim
,j_
dim
,k_
dim
,l_
dim
)=
&st
rain
_2
(i_
dim
,j_
dim
,k_
dim
,l_
dim
)/
time
_b
orn
stra
in_
2(i_
dim
,j_
dim
,k_
dim
,l_
dim
)=
&st
rain
_2
(i_
dim
,j_
dim
,k_
dim
,l_
dim
)-
&st
rain
_1
(i_
dim
,j_
dim
)*
stra
in_
1(k
_d
im,
l_d
im)
stra
in_
2(i_
dim
,j_
dim
,k_
dim
,l_
dim
)=
-be
ta*
&st
rain
_2
(i_
dim
,j_
dim
,k_
dim
,l_
dim
)/
vol_
1w
rite
(20
,’(4
i2,3
e1
4.4
)’)
&i_
dim
,j_
dim
,k_
dim
,l_
dim
,&
ela
_b
orn
_1
(i_
dim
,j_
dim
,k_
dim
,l_
dim
),&
stra
in_
2(i_
dim
,j_
dim
,k_
dim
,l_
dim
),&
ela
_b
orn
_1
(i_
dim
,j_
dim
,k_
dim
,l_
dim
)+
&st
rain
_2
(i_
dim
,j_
dim
,k_
dim
,l_
dim
)e
nd
ife
nd
do
en
dd
o
135
B. Programse
nd
do
en
dd
ow
rite
(20
,*)
write
(20
,*)
"str
ain
"w
rite
(20
,*)
do
i_d
im=
1,
n_
dim
do
j_d
im=
1,
n_
dim
write
(20
,’(2i2
,1f1
0.4
)’)
i_d
im,
j_d
im,
&st
rain
_1
(i_d
im,
j_d
im)/
(n_
pa
rt*n
_tr
ot)
en
dd
oe
nd
do
en
dif
if(i_
run
.eq.n
_ru
n)
clo
se(2
0)
if(n
_ru
n.g
e.2
)w
rite
(71
,*)
tk,
v_in
ter_
1,
viri_
est
_1
,&
prim
_e
st_
1,
vol_
1/n
_p
art
,v_
inte
r_2
,vo
l_2
if(i_
run
.eq
.1)
op
en
(21
,file
=’p
imd
.ima’,s
tatu
s=’u
nkn
ow
n’)
do
i_tr
ot
=0
,n_
tro
t-1
write
(21
,’(2
e15
.5)’)
i_tr
ot*
be
tap
,&
cor_
ifun
c(i_
tro
t)/c
ou
nt_
ifun
c/n
_p
art
en
dd
ow
rite
(21
,’(2e
15
.5)’)
be
ta,c
or_
ifun
c(0
)/co
un
t_ifu
nc/
n_
pa
rtif(
i_ru
n.e
q.n
_ru
n)
clo
se(2
1)
op
en
(22
,file
=’p
imd
.co
r.S
iO’,s
tatu
s=’u
nkn
ow
n’)
op
en
(23
,file
=’p
imd
.co
r.q
’,sta
tus=
’un
kno
wn
’)o
pe
n(2
5,file
=’p
imd
.co
r_B
’,sta
tus=
’un
kno
wn
’)o
pe
n(2
6,file
=’p
imd
.co
r_A
’,sta
tus=
’un
kno
wn
’)
do
i_co
r=
0,i_
me
asu
re-1
do
i_ty
pe
=1
,n_
typ
eco
r_fu
nc(
i_co
r,i_
typ
e)
=2
.*co
r_fu
nc(
i_co
r,i_
typ
e)/
&co
r_fu
nc(
n_
cor,
1)/
nu
mb
er_
spec(
i_ty
pe
)e
nd
do
qd
ot_
cor(
i_co
r)=
2.*
qd
ot_
cor(
i_co
r)/q
do
t_co
r(n
_co
r)/n
_p
art
cor_
fun
c_A
(i_
cor)
=2
.*co
r_fu
nc_
A(i_
cor)
&/c
or_
fun
c_A
(n_
cor)
/n_
pa
rtco
r_fu
nc_
B(i_
cor)
=2
.*co
r_fu
nc_
B(i_
cor)
/n_
pa
rt/c
or_
fun
c_B
(n_
cor)
write
(22
,’(3
e15
.5)’)
ni_
time
*i_
cor*
dt/di_
time
,&
(co
r_fu
nc(
i_co
r,i_
typ
e),
i_ty
pe=
1,n
_ty
pe
)w
rite
(23
,’(2
e15
.5)’)
ni_
time
*i_
cor*
dt/di_
time
,qd
ot_
cor(
i_co
r)w
rite
(25
,’(2
e15
.5)’)
ni_
time
*i_
cor*
dt/di_
time
,co
r_fu
nc_
B(i_
cor)
write
(26
,’(2
e15
.5)’)
ni_
time
*i_
cor*
dt/di_
time
,co
r_fu
nc_
A(i_
cor)
en
dd
oif(
i_m
ea
sure
+1
.lt.n
_co
r)th
en
do
i_co
r=
i_m
ea
sure
,n_
cor-
1d
oi_
typ
e=
1,
n_
typ
eco
r_fu
nc(
i_co
r,i_
typ
e)
=2
.*co
r_fu
nc(
i_co
r,i_
typ
e)/
&(c
or_
fun
c(n
_co
r,1
)-1
.)/n
um
be
r_sp
ec(
i_ty
pe
)e
nd
do
qd
ot_
cor(
i_co
r)=
2.*
qd
ot_
cor(
i_co
r)/(
qd
ot_
cor(
n_
cor)
-1.)
/n_
pa
rtco
r_fu
nc_
A(i_
cor)
=2
.*co
r_fu
nc_
A(i_
cor)
/(co
r_fu
nc_
A(n
_co
r)-1
.)&
/n_
part
cor_
fun
c_B
(i_
cor)
=2
.*co
r_fu
nc_
B(i_
cor)
/n_
pa
rt/c
or_
fun
c_B
(n_
cor)
write
(22
,’(3e
15
.5)’)
ni_
time
*i_
cor*
dt/d
i_tim
e,
&(c
or_
fun
c(i_
cor,
i_ty
pe
),i_
typ
e=
1,n
_ty
pe
)w
rite
(23
,’(2e
15
.5)’)
ni_
time
*i_
cor*
dt/d
i_tim
e,q
do
t_co
r(i_
cor)
write
(25
,’(2e
15
.5)’)
ni_
time
*i_
cor*
dt/d
i_tim
e,c
or_
fun
c_B
(i_
cor)
write
(26
,’(2e
15
.5)’)
ni_
time
*i_
cor*
dt/d
i_tim
e,c
or_
fun
c_A
(i_
cor)
en
dd
o
en
dif
if(i_
run
.eq
.n_ru
n)
clo
se(2
2)
if(i_
run
.eq
.n_ru
n)
clo
se(2
3)
if(f_
po
ten
tial.g
t.1
)th
en
if(i_
run
.eq
.1)
op
en
(24
,file
=’p
imd
.g_r’,s
tatu
s=’u
nkn
ow
n’)
!---
-co
un
tn
um
be
ro
fp
art
icle
sfo
rg
ive
nty
pe
sd
oi_
typ
e=
1,n
_ty
pe
do
j_ty
pe
=1
,n_
typ
e!-
---
de
fine
no
rma
liza
tion
fact
or
if(n
um
be
r_sp
ec(
i_ty
pe
)*n
um
be
r_sp
ec(
j_ty
pe
).n
e.0
)th
en
no
rm_
spe
c(i_
typ
e,j_
typ
e)
=re
al(n
_p
art
)/
&(n
um
be
r_sp
ec(
i_ty
pe
)*n
um
be
r_sp
ec(
j_ty
pe
))e
lse
no
rm_
spe
c(i_
typ
e,j_
typ
e)
=0
.e
nd
ifn
orm
_sp
ec(
i_ty
pe
,j_ty
pe
)=
&2
*(n
orm
_sp
ec(
i_ty
pe
,j_ty
pe
)/(n
_p
art
/vo
l_1
))*
&(r
ea
l(n
_grid
)/r_
ran
ge
(i_
typ
e,j_
typ
e))
/g_
r(1
,1,n
_g
rid
+1
)!-
---
sym
metr
ize
toyi
eld
be
tte
rst
atis
tics
if(i_
typ
e.lt
.j_ty
pe
)th
en
do
i_g
rid
=0
,n_
grid
g_
r(i_
typ
e,j_
typ
e,i_
grid
)=
&(
g_
r(i_
typ
e,j_
typ
e,i_
grid
)+
g_
r(j_
typ
e,i_
typ
e,i_
grid
))
/2
g_
r(j_
typ
e,i_
typ
e,i_
grid
)=
g_
r(i_
typ
e,j_
typ
e,i_
grid
)e
nd
do
en
dif
!---
-a
pp
lyn
orm
aliz
atio
nto
g(r
)d
oi_
grid
=0
,n
_g
rid
g_
r(i_
typ
e,j_
typ
e,i_
grid
)=
g_
r(i_
type
,j_ty
pe
,i_g
rid
)&
*n
orm
_sp
ec(
i_ty
pe
,j_ty
pe
)e
nd
do
en
dd
oe
nd
do
!---
-fo
rma
tr,
g(r
)/4
{\p
i}r*
*2d
oi_
grid
=1
,n
_g
rid
write
(24
,’(6
e12
.4)’)
&i_
grid*r
_cu
toff(1
,1)/
n_
grid
,g_
r(1
,1,i_
grid
)&
/(4
*pi*
(i_
grid
*r_
cuto
ff(1
,1)/
n_
grid
)**2
),
&i_
grid*r
_cu
toff(1
,2)/
n_
grid
,g_
r(1
,2,i_
grid
)&
/(4
*pi*
(i_
grid
*r_
cuto
ff(1
,2)/
n_
grid
)**2
),
&i_
grid*r
_cu
toff(2
,2)/
n_
grid
,g_
r(2
,2,i_
grid
)&
/(4
*pi*
(i_
grid
*r_
cuto
ff(2
,2)/
n_
grid
)**2
)e
nd
do
if(i_
run
.eq
.n_
run
)cl
ose
(24
)e
nd
if
if(f
_p
ote
ntia
l.eq
.3)
call
bo
nd
_o
ut
if(f
_p
ote
ntia
l.eq
.5)
call
bo
nd
_o
ut
if(f
_p
ote
ntia
l.eq
.6)
call
bo
nd
_o
ut
if(f
_p
ote
ntia
l.eq
.7)
call
bo
nd
_o
ut
if(f
_p
ote
ntia
l.eq
.8)
call
bo
nd
_o
ut
if(f
_p
ote
ntia
l.eq
.9)
call
bo
nd
_o
ut
20
1fo
rma
t(1
e1
5.7
,a)
20
2fo
rma
t(2
e1
5.7
,a)
20
3fo
rma
t(3
e1
5.7
,a)
20
4fo
rma
t(4
e1
5.7
,a)
20
6fo
rma
t(6
e1
3.5
,a)
20
9fo
rma
t(4
e1
3.5
,a,i3
)
136
B.1. Molecular Dynamics Code
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
bo
nd_
ou
tim
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
do
ub
lep
reci
sion
dr_
ne
igh
dr_
ne
igh
=(r
_ne
igh
_m
ax-
r_n
eig
h_
min
)/
n_
grid
op
en
(41
,file
=’p
imd
.bo
n’,s
tatu
s=’u
nkn
ow
n’)
do
i_g
rid
=1
,n
_g
rid
r_d
um
my
=r_
ne
igh
_m
in+
i_g
rid
*d
r_ne
igh
write
(41
,’(5
e1
5.6
)’)
r_d
um
my,
&h
ist_
an
g(1
,i_g
rid
)/
(dr_
ne
igh
*n_
silic
*ne
igh
_tim
e)
/r_
du
mm
y**2
,&
i_g
rid
*18
0.
/n
_g
rid
,&
n_
grid
*his
t_a
ng
(2,i_
grid
)/
(18
0.
*n
_o
xy*
ne
igh
_tim
e),
!S
i-O
-Si
&n
_g
rid
*his
t_a
ng
(3,i_
grid
)/
(6*
18
0.
*n
_si
lic*
ne
igh
_tim
e)
!O
-Si-O
en
dd
ocl
ose
(41
)e
nd
sub
rou
tine
!!
!!
!!
!!
!!
!
sub
rou
tine
che
ck_
skin
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
inte
ge
rf_
up
da
te(0
:n_
tro
t-1
,n_
pa
rt)
com
mo
n/c
f_u
pd
ate
/f_
up
da
te
do
i_p
art
=1
,n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
do
i_tr
ot
=0,n
_tr
ot-
1r_
du
mm
y=
0.
f_u
pd
ate
(i_tr
ot,i_
pa
rt)
=0
do
i_d
im=
1,n
_d
imd
elta
_r(
i_d
im)
=r_
rea
l(i_
dim
,i_tr
ot,i_
pa
rt)
&-
r0_
old
(i_
dim
,i_tr
ot,i_
pa
rt)
r_d
um
my
=r_
du
mm
y+
de
lta_
r(i_
dim
)**2
en
dd
oif(
r_d
um
my.
gt.(0
.5*r
_sk
in(i_
typ
e,i_
typ
e))
**2
)th
en
f_sk
in=
1f_
up
da
te(i_
tro
t,i_
pa
rt)
=1
en
dif
en
dd
oe
nd
do
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
pre
dic
tim
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
do
ub
lep
reci
sion
loc_
forc
e(n
_d
im)
!---
-p
rop
ag
ate
on
lyin
de
pe
nd
en
tp
art
s
do
j_tr
ot
=0
,n_
tro
t-1
i_tr
ot
=j_
tro
t+
1if(
i_tr
ot.e
q.2
)i_
tro
t=
n_
tro
t+
1
!---
-fir
stp
osi
tion
sd
oj_
ord
er
=1
,n_
ord
er
do
i_d
im=
1,n
_d
imd
oi_
pa
rt=
1,n
_p
art
u0
(i_
dim
,i_tr
ot,i_
pa
rt)
=u
0(i_
dim
,i_tr
ot,i_
pa
rt)
+&
pre
dic
t_co
ef(
0,j_
ord
er)
*u
x(j_
ord
er,
i_d
im,i_
tro
t,i_
pa
rt)
en
dd
oe
nd
do
en
dd
o
!---
-a
dd
ran
do
mfo
rce
top
osi
tion
sa
nd
velo
citie
si_
du
mm
y=
(i_
tro
t-1
)/2
do
i_p
art
=1
,n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
!---
-te
rmst
och
forc
ed
oi_
dim
=1
,n
_d
imlo
c_fo
rce
(i_
dim
)=
0.
do
j_d
im=
1,
n_
dim
loc_
forc
e(i_
dim
)=
loc_
forc
e(i_
dim
)+
&h
_m
at_
inv(
i_d
im,j_
dim
)*
fr(j_
dim
,i_tr
ot,i_
pa
rt)
en
dd
oe
nd
do
do
i_d
im=
1,n
_d
imu
0(i_
dim
,i_tr
ot,i_
pa
rt)
=u
0(i_
dim
,i_tr
ot,i_
pa
rt)
+&
loc_
forc
e(i_
dim
)*
dt_
2/
2&
*rf
_w
idth
(i_
du
mm
y,i_
typ
e)
ux(
1,i_
dim
,i_tr
ot,i_
pa
rt)
=u
x(1
,i_d
im,i_
tro
t,i_
pa
rt)
+&
loc_
forc
e(i_
dim
)*
dt_
2*
rf_
wid
th(i_
du
mm
y,i_
typ
e)
en
dd
oe
nd
do
!---
-th
en
de
riva
tive
sd
oi_
ord
er
=1,
n_
ord
er-
1d
oj_
ord
er
=i_
ord
er
+1
,n
_o
rde
rd
oi_
dim
=1
,n_
dim
do
i_p
art
=1
,n_
pa
rtu
x(i_
ord
er,
i_d
im,i_
tro
t,i_
pa
rt)
=&
ux(
i_o
rde
r,i_
dim
,i_tr
ot,i_
pa
rt)
+&
pre
dic
t_co
ef(
i_o
rde
r,j_
ord
er)
*u
x(j_
ord
er,
i_d
im,i_
tro
t,i_
part
)e
nd
do
en
dd
oe
nd
do
en
dd
o
en
dd
o
call
sym
me
triz
e
!6
67
con
tinu
e
!---
pre
dic
tb
ox
sha
pe
if(f_
pre
ssu
re.e
q.1
)th
en
do
j_o
rde
r=
1,
n_
ord
er
do
i_d
im=
1,n
_d
im+
e_
dim
sca
l_0
(i_
dim
)=
sca
l_0
(i_
dim
)+
&p
red
ict_
coef(
0,j_
ord
er)
*sc
al_
x(j_
ord
er,
i_d
im)
en
dd
oe
nd
do
do
i_d
im=
1,
n_
dim
+e
_d
imif
(i_
dim
.le.n
_d
im)
the
n
137
B. Programssc
al_
0(i_
dim
)=
sca
l_0
(i_
dim
)&
+rf
b_
wid
th*
fr_
bo
x(i_
dim
)*
dt_
2/
2sc
al_
x(1
,i_d
im)
=sc
al_
x(1
,i_d
im)
&+
rfb
_w
idth
*fr
_b
ox(
i_d
im)
*d
t_2
els
esc
al_
0(i_
dim
)=
sca
l_0
(i_
dim
)&
+rf
b_
wid
th*
fr_
bo
x(i_
dim
)*
dt_
2/
2/
sqrt
2sc
al_
x(1
,i_d
im)
=sc
al_
x(1
,i_d
im)
&+
rfb
_w
idth
*fr
_b
ox(
i_d
im)
*d
t_2
/sq
rt2
en
dif
en
dd
o
do
i_o
rde
r=
1,
n_
ord
er-
1d
oj_
ord
er
=i_
ord
er
+1
,n
_o
rde
rd
oi_
dim
=1
,n
_d
im+
e_
dim
sca
l_x(
i_o
rde
r,i_
dim
)=
sca
l_x(
i_o
rder,
i_d
im)
&+
pre
dic
t_co
ef(
i_o
rde
r,j_
ord
er)
*sc
al_
x(j_
ord
er,
i_d
im)
en
dd
oe
nd
do
en
dd
o
call
sca
l_0
_u
pd
ate
en
dif
if(i_
time
.lt.4
00
0)
the
ni_
typ
e=
typ
e(1
)j_
typ
e=
typ
e(n
_p
art
)w
rite
(51
,’(1
0e1
6.7
)’)
r_tim
e,
&u
x(1
,1,1
,1)
/d
t/
v_th
erm
(0,i_
typ
e),
&u
x(1
,1,2
*n_
tro
t-1
,1)
/d
t/
v_th
erm
(n_
tro
t-1
,i_ty
pe
),&
ux(
1,1
,1,n
_pa
rt)
/d
t/
v_th
erm
(0,j_
typ
e),
&u
x(1
,1,2
*n_
tro
t-1
,n_
pa
rt)
/d
t/
v_th
erm
(n_
tro
t-1
,j_ty
pe
),&
volu
me
/n
_pa
rt,
1.*
i_ty
pe
,1
.*j_
type
els
eif
(i_
time
.eq
.40
00
)th
en
clo
se(5
1)
en
dif
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
corr
ect
imp
licit
no
ne
incl
ud
e"p
imd
.co
m.f"
do
ub
lep
reci
sio
nco
r_m
ax,
cor_
ma
x_m
in,c
or_
ma
x_m
ax
inte
ge
rn
um
_p
art
(n_
typ
e)
do
ub
lep
reci
sio
na
vg_
cha
rge
(n_
typ
e),
ma
x_ch
arg
e(n
_ty
pe
),&
min
_ch
arg
e(n
_ty
pe
)d
ou
ble
pre
cisi
on
fstr
ess
(3,3
)in
teg
er
ki_
dim
!---
cha
nge
!p
ara
me
ter
(co
r_m
ax_
min
=2
.e-0
9,c
or_
ma
x_m
ax=
1.e
-06
)p
ara
me
ter
(co
r_m
ax_
min
=1
.e-0
9,c
or_
ma
x_m
ax=
0.5
e-0
6)
inte
ge
rco
r_m
ax_
cou
nt
com
mo
n/c
cor_
ma
x_co
un
t/co
r_m
ax_
cou
nt
inte
ge
rfa
ilure
(3)
t_d
yna
mic
=0
.d0
if(i_
time
.le.1
)co
r_m
ax_
cou
nt
=0
!---
he
re,
f0h
as
me
an
ing
of
diff
ere
nce
be
twe
en
pre
dic
ted
!a
cce
lera
tion
an
dm
ea
sure
da
cce
lera
tion
cor_
ma
x=
0.
do
i_p
art
=1
,n_
pa
rti_
typ
e=
type
(i_
pa
rt)
do
j_tr
ot
=0
,n_
tro
t-1
i_tr
ot
=j_
trot
+1
if(i_
tro
t.e
q.2
)i_
tro
t=
n_
tro
t+
1i_
du
mm
y=
(i_
tro
t-1
)/2
do
i_d
im=
1,n
_d
imf0
(i_
dim
,i_tr
ot,i_
pa
rt)
=-u
x(2
,i_d
im,i_
tro
t,i_
pa
rt)
&+
f0(i_d
im,i_
tro
t,i_
pa
rt)/
ma
ss(i_
du
mm
y,i_
typ
e)*
dt_
2/
2r_
du
mm
y=
(f0
(i_
dim
,i_tr
ot,i_
pa
rt)*
corr
ect
_co
ef(
1)*
dt/
&v_
the
rm(i_
du
mm
y,i_
typ
e))
**2
!---
cha
ng
eif(
r_d
um
my.
gt.co
r_m
ax)
the
nco
r_m
ax
=r_
du
mm
yfa
ilure
(1)
=i_
pa
rtfa
ilure
(2)
=i_
tro
tfa
ilure
(3)
=i_
dim
en
dif
cor_
ma
x=
max(
cor_
ma
x,r_
du
mm
y)e
nd
do
en
dd
oe
nd
do
if(c
or_
ma
x.g
t.co
r_m
ax_
ma
x)th
en
writE
(*,’(
1e1
2.4
,3i5
)’)
cor_
ma
x,fa
ilure
sto
P"m
on
om
er
mo
ve"
en
dif
!---
-ch
an
ge
!g
oto
667
do
j_tr
ot
=0
,n_
tro
t-1
i_tr
ot
=j_
tro
t+
1if(
i_tr
ot.e
q.2
)i_
tro
t=
n_
tro
t+
1d
oi_
pa
rt=
1,n
_p
art
do
i_d
im=
1,n
_d
imu
0(i_
dim
,i_tr
ot,i_
pa
rt)
=u
0(i_
dim
,i_tr
ot,i_
pa
rt)
&+
corr
ect
_co
ef(
0)
*f0
(i_
dim
,i_tr
ot,i_
pa
rt)
en
dd
oe
nd
do
do
i_o
rde
r=
1,n
_o
rde
rd
oi_
pa
rt=
1,n
_p
art
do
i_d
im=
1,n
_d
imu
x(i_
ord
er,
i_dim
,i_tr
ot,i_
pa
rt)
=u
x(i_
ord
er,
i_d
im,i_
tro
t,i_
pa
rt)
&+
corr
ect
_co
ef(
i_o
rde
r)*
f0(i_
dim
,i_tr
ot,i_
pa
rt)
en
dd
oe
nd
do
en
dd
oe
nd
do
call
sym
me
triz
e
!6
67
con
tinu
e
t_d
yna
mic
=0
.d0
!---
-te
rmm
ea
sd
yna
mic
do
i_p
art
=1
,n_
pa
rt
138
B.1. Molecular Dynamics Code
i_ty
pe
=ty
pe(i_
pa
rt)
do
i_tr
ot
=0,n
_tr
ot-
1d
oi_
dim
=1
,n_
dim
forc
e(i_
dim
,i_tr
ot,i_
pa
rt)
=0
.d0
t_d
yna
mic
=t_
dyn
am
ic+
&m
ass
(i_
tro
t,i_
typ
e)
*m
et_
ten
_vo
i(i_
dim
)*
&(u
x(1
,i_d
im,2
*i_
tro
t+1
,i_p
art
)**2
+&
ux(
1,i_
dim
,2*i
_tr
ot+
2,i_
pa
rt)*
*2)
en
dd
oif
(e_
dim
.eq
.3)
the
nt_
dyn
am
ic=
t_d
yna
mic
&+
ma
ss(i_
tro
t,i_
typ
e)
*m
et_
ten
_vo
i(4
)*
&(
ux(
1,1
,2*i
_tr
ot+
1,i_
pa
rt)
*u
x(1
,2,2
*i_
tro
t+1
,i_p
art
)&
+u
x(1
,1,2
*i_
tro
t+2
,i_p
art
)*
ux(
1,2
,2*i
_tr
ot+
2,i_
pa
rt)
)&
+m
ass
(i_
tro
t,i_
typ
e)
*m
et_
ten
_vo
i(5
)*
&(
ux(
1,2
,2*i
_tr
ot+
1,i_
pa
rt)
*u
x(1
,3,2
*i_
tro
t+1
,i_p
art
)&
+u
x(1
,2,2
*i_
tro
t+2
,i_p
art
)*
ux(
1,3
,2*i
_tr
ot+
2,i_
pa
rt)
)&
+m
ass
(i_
tro
t,i_
typ
e)
*m
et_
ten
_vo
i(6
)*
&(
ux(
1,3
,2*i
_tr
ot+
1,i_
pa
rt)
*u
x(1
,1,2
*i_
tro
t+1
,i_p
art
)&
+u
x(1
,3,2
*i_
tro
t+2
,i_p
art
)*
ux(
1,1
,2*i
_tr
ot+
2,i_
pa
rt)
)e
nd
ife
nd
do
en
dd
ot_
dyn
am
ic=
t_d
yna
mic
/(2
*dt_
2)
if(f
_p
ress
ure
.eq
.1)
the
n!-
---
corr
ect
bo
xsh
ap
ed
oi_
dim
=1
,n
_d
im+
e_
dim
forc
e_
sca
l(i_
dim
)=
-sc
al_
x(2
,i_d
im)
&+
forc
e_
sca
l(i_
dim
)/
ma
ss_
bo
x*
dt_
2/
2r_
du
mm
y=
(fo
rce
_sc
al(i_
dim
)*co
rre
ct_
coe
f(1
)*d
t/
w_
the
rm)*
*2if
(r_
du
mm
y.g
t.1
00
*co
r_m
ax_
ma
x)th
en
writE
(*,*
)r_
du
mm
yst
oP
"vo
lum
em
ove
"e
nd
ife
nd
do
do
i_d
im=
1,
n_
dim
+e
_d
imsc
al_
0(i_
dim
)=
sca
l_0
(i_
dim
)+
&co
rre
ct_
coe
f(0
)*
forc
e_
sca
l(i_
dim
)e
nd
do
do
i_o
rde
r=
1,n
_o
rde
rd
oi_
dim
=1
,n_
dim
+e
_d
imsc
al_
x(i_
ord
er,
i_d
im)
=sc
al_
x(i_
ord
er,
i_d
im)
&+
corr
ect
_co
ef(
i_o
rde
r)*
forc
e_
sca
l(i_
dim
)e
nd
do
en
dd
o
t_d
iag
=0
.t_
nd
iag
=0
.!-
---
term
mea
sb
ox
dyn
do
i_d
im=
1,
n_
dim
+e
_d
imif
(i_
dim
.le.n
_d
im)
t_d
iag
=t_
dia
g&
+m
ass
_b
ox
*sc
al_
x(1
,i_d
im)*
*2if
(i_
dim
.gt.n
_d
im)
t_n
dia
g=
t_n
dia
g&
+2
*m
ass
_b
ox
*sc
al_
x(1
,i_d
im)*
*2e
nd
do
t_d
iag
=t_
dia
g/
(2*d
t_2
)t_
nd
iag
=t_
nd
iag
/(2
*dt_
2)
t_d
yna
mic
=t_
dyn
am
ic+
t_d
iag
+t_
ndia
ge
nd
if
do
i_ty
pe
=1
,n
_ty
pe
avg
_ch
arg
e(i_
typ
e)=
0n
um
_p
art
(i_ty
pe
)=0
en
dd
od
oi_
pa
rt=
1,
n_
pa
rti_
typ
e=
typ
e(i_
pa
rt)
avg
_ch
arg
e(i_
typ
e)=
avg
_ch
arg
e(i_
type
)+ch
arg
e(i_
pa
rt)
nu
m_
pa
rt(i_ty
pe
)=n
um
_p
art
(i_
typ
e)+
1e
nd
do
do
i_ty
pe
=1
,n
_ty
pe
avg
_ch
arg
e(i_
typ
e)=
avg
_ch
arg
e(i_
typ
e)/
nu
m_
pa
rt(i_
typ
e)
en
dd
o
po
l_to
tal
=0
.d0
po
l_d
ipo
les
=0
.d0
do
i_p
art
=1
,n
_p
art
do
i_d
im=
1,
n_
dim
po
l_to
tal(i_
dim
)=
po
l_to
tal(i_
dim
)+
r_re
al(i_
dim
,0,i_
pa
rt)
&*
charg
e(i_
pa
rt)
po
l_d
ipo
les(
i_d
im)
=p
ol_
dip
ole
s(i_
dim
)+
dip
ole
(i_
dim
,i_p
art
)e
nd
do
en
dd
op
ol_
tota
l=
po
l_to
tal
+p
ol_
dip
ole
s
do
i_d
im=
1,
3d
oj_
dim
=1
,3fs
tre
ss(i_
dim
,j_d
im)=
0.d
0d
ok_
dim
=1
,3if
(i_
dim
.eq.k
_d
im)
the
nki
_d
im=
i_d
ime
lse
if(i_
dim
*k_
dim
.eq
.2)
the
nki
_d
im=
4e
lse
if(i_
dim
*k_
dim
.eq
.6)
the
nki
_d
im=
5e
lse
if(i_
dim
*k_
dim
.eq
.3)
the
nki
_d
im=
6e
nd
iffs
tre
ss(i_
dim
,j_d
im)=
fstr
ess
(i_
dim
,j_d
im)
+&
h_
ma
t(j_
dim
,k_
dim
)*fo
rce
_sc
al_
inte
r(ki
_d
im)
&/v
olu
me
en
dd
oe
nd
do
en
dd
o
!g
oto
10
1if
(mo
d(i_
time
,1).
eq
.0)
the
nca
llp
rim
_est
ima
tor
write
(60
,’(3
6e
15
.7)’)
r_tim
e,
!if
(mo
d(i_
time
,10
).e
q.9
)w
rite
(60
,’(3
0e
15
.7)’)
r_tim
e,
2(t
_d
yna
mic
+v_
cha
in+
v_in
ter+
t_d
yna
mic
_ch
arg
e+
v_ch
arg
e+
&v_
pre
ss-v
_g
au
ge
)/n
_p
art
/n_
tro
t,3
t_d
yna
mic
/n_
pa
rt/n
_tr
ot,
4v_
cha
in/n
_p
art
/n_
tro
t,5
(v_
inte
r-v_
gau
ge
)/n
_p
art
/n_
tro
t,6
v_p
ress
/n_
pa
rt/n
_tr
ot,
7v_
ew
ald
/n_
pa
rt/n
_tr
ot,
8vo
lum
e/n
_p
art
,9
(sca
l_0
(i_
dim
),i_
dim
=1
,n_
dim
+e
_d
im),
!co
l9
-14
&v_
rea
lco
ulo
mb/n
_p
art
,v_
sho
rtra
ng
e/n
_p
art
,!
col
15
+1
6&
v_th
ree
bo
dy/
n_
pa
rt,
0.,
!co
l1
7+
18
&se
lf_e
ne
rgy/
n_
pa
rt,
v_q
eq
self/
n_
pa
rt,
!co
l1
9+
20
&(a
vg_
cha
rge
(i_
typ
e),
i_ty
pe
=1
,n_
typ
e),
!co
l2
1+
22
139
B. Programs&
t_d
yna
mic
_ch
arg
e/n
_p
art
/n_
tro
t,!
col
23
&v_
cha
rge
/n_
pa
rt/n
_tr
ot,
!co
l2
4&
(po
l_to
tal(i_
dim
),i_
dim
=1
,3),
!co
l2
5-2
7&
(po
l_d
ipo
les(
i_d
im),
i_d
im=
1,3
),!
col
28
-30
&fs
tre
ss(1
,1),
fstr
ess
(2,2
),fs
tre
ss(3
,3),
!co
l3
1-3
3&
0.5
*(fs
tre
ss(1
,2)+
fstr
ess
(2,1
)),
!co
l3
4&
0.5
*(fs
tre
ss(2
,3)+
fstr
ess
(3,2
)),
!co
l3
5&
0.5
*(fs
tre
ss(1
,3)+
fstr
ess
(3,1
))!
col
36
els
eif(
i_tim
e.e
q.n
_tim
e_
sca
l*4
00
0)
the
ncl
ose
(60
)e
nd
if
if((m
od
(i_
time
,10
).e
q.9
).a
nd
.&
((f_
sym
me
try.
eq
.6).
or.
(f_
sym
me
try.
eq
.7))
)&
write
(61
,’(4
f12
.6)’)
r_tim
e,
ord
_p
ar,
ord
_p
arB
,o
rd_
pa
rC
if(m
od
(i_
time
,10
).e
q.9
)th
en
do
i_ty
pe
=1
,n
_ty
pe
avg
_ch
arg
e(i_ty
pe
)=0
ma
x_ch
arg
e(i_ty
pe
)=-1
.e3
0m
in_
cha
rge
(i_ty
pe
)=1
.e3
0e
nd
do
do
i_p
art
=1
,n
_p
art
i_ty
pe
=ty
pe(i_
pa
rt)
avg
_ch
arg
e(i_ty
pe
)=a
vg_
cha
rge
(i_
typ
e)+
cha
rge
(i_
pa
rt)
if(c
ha
rge
(i_p
art
).g
t.m
ax_
cha
rge
(i_
typ
e))
&m
ax_
cha
rge
(i_
typ
e)=
cha
rge
(i_
pa
rt)
if(c
ha
rge
(i_p
art
).lt.
min
_ch
arg
e(i_
typ
e))
&m
in_ch
arg
e(i_
typ
e)=
cha
rge
(i_
pa
rt)
en
dd
oa
vg_
cha
rge
(1)=
avg
_ch
arg
e(1
)/n
_si
lica
vg_
cha
rge
(2)=
avg
_ch
arg
e(2
)/n
_o
xy
write
(62
,’(2
0e1
5.7
)’)
r_tim
e,
2a
vg_ch
arg
e(1
),3
min
_ch
arg
e(1
),4
ma
x_ch
arg
e(1
),5
avg
_ch
arg
e(2
),6
min
_ch
arg
e(2
),7
ma
x_ch
arg
e(2
)e
nd
if
!1
01
con
tinu
e
ieff_
time
=ie
ff_
time
+d
i_tim
e
!---
-in
cre
ase
time
ste
po
nly
ifo
nm
ulti
ple
inte
ge
rso
fn
i_tim
eif(
cor_
ma
x.lt.
cor_
ma
x_m
in)
the
nif(
mo
d(ie
ff_
time
,ni_
time
).n
e.0
)co
r_m
ax
=2
*co
r_m
ax_
min
en
dif
!---
-ch
an
ge
go
to1
00
!---
-m
ake
sure
tha
ttim
est
ep
do
esn
’tb
eco
me
too
larg
e/s
ma
llif(
(co
r_m
ax.
lt.co
r_m
ax_
min
).a
nd
.(d
i_tim
e.e
q.n
i_tim
e))
the
nco
r_m
ax
=2
*cor_
ma
x_m
ine
lse
if((c
or_
ma
x.g
t.co
r_m
ax_
ma
x).a
nd.(
di_
time
.eq
.1))
the
nst
op
"Tim
eco
rre
lca
nn
ot
be
me
asu
red
an
ylo
ng
er.
"e
nd
if
!---
-m
ake
sure
ieff_
time
isn
ot
too
big
if(ie
ff_
time
.le.0
)st
op
"ie
ff_
time
isin
fty"
!---
cha
ng
e!
write
(61
,*)
r_tim
e,d
t,co
r_m
ax,
ieff_
time
,fa
ilure
!---
-ch
an
ge
!in
clu
de
wid
tho
fb
ox
de
fom
ove
sif(
cor_
ma
x.g
t.co
r_m
ax_
ma
x)th
en
!---
-d
ecr
ease
time
ste
pco
r_m
ax_
cou
nt
=1
!---
-ch
an
ge
!if(
i_tim
e.lt
.10
00
0)
write
(61
,*)
r_tim
e,d
t,co
r_m
ax,
ieff_tim
ed
t=
dt/2
di_
time
=d
i_tim
e/2
!---
-ch
an
ge
!if(
i_tim
e.lt
.10
00
0)
write
(61
,*)
r_tim
e,d
t,co
r_m
ax,
ieff_tim
ed
t_2
=d
t**2
do
i_ty
pe
=1
,n_
typ
ed
oi_
tro
t=
0,n
_tr
ot-
1rf
_w
idth
(i_
trot,i_
typ
e)
=rf
_w
idth
(i_
tro
t,i_
typ
e)
*2
.d0
**0
.5d
0e
nd
do
en
dd
od
oi_
ord
er
=1
,n_
ord
er
r_d
um
my
=1
./2**
i_o
rde
r!
if(i_
ord
er.
gt.2
)r_
du
mm
y=
0.
do
i_p
art
=1
,n_
pa
rtd
oi_
tro
t=
0,n
_tr
ot-
1d
oi_
dim
=1
,n_
dim
ux(
i_o
rde
r,i_
dim
,2*i
_tr
ot+
1,i_
pa
rt)
=&
ux(
i_o
rde
r,i_
dim
,2*i
_tr
ot+
1,i_
part
)*
r_d
um
my
ux(
i_o
rde
r,i_
dim
,2*i
_tr
ot+
2,i_
pa
rt)
=&
ux(
i_o
rde
r,i_
dim
,2*i
_tr
ot+
2,i_
part
)*
r_d
um
my
en
dd
oe
nd
do
en
dd
od
oi_
dim
=1
,n_
dim
sca
l_x(
i_o
rde
r,i_
dim
)=
sca
l_x(
i_o
rder,
i_d
im)
*r_
du
mm
ye
nd
do
en
dd
oe
lse
if(co
r_m
ax.
lt.co
r_m
ax_
min
)th
en
!---
-in
cre
ase
time
ste
pco
r_m
ax_
cou
nt
=1
!---
-ch
an
ge
!if(
i_tim
e.lt
.10
00
0)
write
(61
,*)
r_tim
e,d
t,co
r_m
ax,
ieff_tim
ed
t=
dt*
2d
i_tim
e=
di_
time
*2!-
---
cha
ng
e!
if(i_
time
.lt.1
00
00
)w
rite
(61
,*)
r_tim
e,d
t,co
r_m
ax,
ieff_tim
ed
t_2
=d
t**2
do
i_ty
pe
=1
,n_
typ
ed
oi_
tro
t=
0,n
_tr
ot-
1rf
_w
idth
(i_
trot,i_
typ
e)
=rf
_w
idth
(i_
tro
t,i_
typ
e)
/2
.d0
**0
.5d
0e
nd
do
en
dd
od
oi_
ord
er
=1
,n_
ord
er
r_d
um
my
=2
**i_
ord
er
!if(
i_o
rde
r.g
t.2
)r_
du
mm
y=
0.
do
i_p
art
=1
,n_
pa
rtd
oi_
tro
t=
0,n
_tr
ot-
1d
oi_
dim
=1
,n_
dim
ux(
i_o
rde
r,i_
dim
,2*i
_tr
ot+
1,i_
pa
rt)
=
140
B.1. Molecular Dynamics Code
&u
x(i_
ord
er,
i_d
im,2
*i_
tro
t+1
,i_p
art
)*
r_d
um
my
ux(
i_o
rde
r,i_
dim
,2*i
_tr
ot+
2,i_
pa
rt)
=&
ux(
i_o
rde
r,i_
dim
,2*i
_tr
ot+
2,i_
pa
rt)
*r_
du
mm
ye
nd
do
en
dd
oe
nd
do
do
i_d
im=
1,n
_d
imsc
al_
x(i_
ord
er,
i_d
im)
=sc
al_
x(i_
ord
er,
i_d
im)
*r_
du
mm
ye
nd
do
en
dd
oe
nd
if!
if(i_
time
.eq
.10
00
)cl
ose
(61
)
10
0co
ntin
ue
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
sym
me
triz
eim
plic
itn
on
ein
clu
de
"pim
d.c
om
.f"
do
i_tr
ot
=1
,n_
tro
t/2
-1d
oi_
dim
=1
,n_d
im!-
---
first
po
sitio
ns
do
i_p
art
=1,n
_p
art
u0
(i_
dim
,2*(
n_
tro
t-i_
tro
t)+
1,i_
pa
rt)
=&
u0
(i_
dim
,2*i
_tr
ot+
1,i_
pa
rt)
u0
(i_
dim
,2*(
n_
tro
t-i_
tro
t)+
2,i_
pa
rt)
=&
-u0
(i_
dim
,2*i
_tr
ot+
2,i_
pa
rt)
en
dd
o!-
---
the
nd
eriva
tive
sd
oi_
ord
er
=1
,n_
ord
er
do
i_p
art
=1,n
_p
art
ux(
i_o
rde
r,i_
dim
,2*(
n_
tro
t-i_
tro
t)+
1,i_
pa
rt)
=&
ux(
i_o
rder,
i_d
im,2
*i_
tro
t+1
,i_p
art
)u
x(i_
ord
er,
i_d
im,2
*(n
_tr
ot-
i_tr
ot)
+2,i_
pa
rt)
=&
-ux(
i_o
rde
r,i_
dim
,2*i
_tr
ot+
2,i_
pa
rt)
en
dd
oe
nd
do
en
dd
oe
nd
do
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
SU
BR
OU
TIN
EIN
R25
0(M
Z,IS
EE
D,K
PT
R)
C CIN
ITIA
LIZ
AT
ION
RO
UT
INE
FO
RR
25
0R
AN
DO
MN
UM
BE
RG
EN
ER
AT
OR
CF
OR
32
BIT
CO
MP
UT
ER
SO
NL
Y!
CU
SE
SS
UN
FO
RS
TA
RT
UP
CIN
TE
GE
RM
Z(2
50
)IN
TE
GE
RIS
EE
D,
KP
TR
CIN
TE
GE
RIU
F(3
1),
IGF
(31
)IN
TE
GE
RIA
DD
R1
(10
00
),IA
DD
R2
(10
00
)D
OU
BL
EP
RE
CIS
ION
RR
AN
F(2
00
0),
rco
mm
on
/cin
r25
0/
r
C CK
PT
R=
1C
DO
10
0I
=1,3
0IG
F(I
)=
2**
(I-
1)
IUF
(I)
=2
**I
-1
10
0C
ON
TIN
UE
CIG
F(3
1)
=2
**3
0IU
F(3
1)
=2
**3
0+
(2**
30
-1
)C
CA
LL
SU
N(I
SE
ED
,RR
AN
F,2
50
)C C
MA
PR
EA
LS
TO
PO
SIT
IVE
INT
EG
ER
SC
DO
20
0I
=1
,25
0M
Z(I
)=
IDN
INT
(DB
LE
(RR
AN
F(I
))*D
BL
E(F
LO
AT
(IU
F(3
1))
))2
00
CO
NT
INU
EC C
SP
EC
IAL
TR
EA
TM
EN
TO
FF
IRS
T3
1N
UM
BE
RS
CD
O3
00
I=
1,3
1M
Z(I
)=
IOR
(MZ
(I),
IGF
(I))
30
0C
ON
TIN
UE
CD
O4
00
I=
1,3
1M
Z(I
)=
IAN
D(M
Z(I
),IU
F(I
))4
00
CO
NT
INU
EC C
MIX
ING
CC
AL
LS
UN
(IS
EE
D,R
RA
NF
,20
00
)C
DO
50
0I
=1
,10
00
IAD
DR
1(I
)=
1.
+2
50
.*
RR
AN
F(I
)IA
DD
R2
(I)
=1.
+2
50
.*
RR
AN
F(I
+1
000
)5
00
CO
NT
INU
EC
DO
60
0I
=1
,10
00
NT
EM
P=
MZ
(IA
DD
R1
(I))
MZ
(IA
DD
R1
(I))
=M
Z(I
AD
DR
2(I
))M
Z(I
AD
DR
2(I
))=
NT
EM
P6
00
CO
NT
INU
EC C
WA
RM
ING
UP
CD
O8
00
I=
1,8
CD
O7
10
K=
1,1
47
MZ
(K)
=IE
OR
(MZ
(K),
MZ
(K+
10
3))
71
0C
ON
TIN
UE
CD
O7
20
K=
148
,25
0M
Z(K
)=
IEO
R(M
Z(K
),M
Z(K
-1
47
))7
20
CO
NT
INU
EC
80
0C
ON
TIN
UE
CE
ND
C CC
CC
C
141
B. ProgramsC
SU
BR
OU
TIN
ES
UN
(IS
EE
D,R
AN
F,N
)C C
ST
OR
ES
NR
EA
LR
AN
DO
MN
UM
BE
RS
INR
AN
FC
ISE
ED
ISA
ST
AR
TU
PV
AL
UE
CIM
PL
ICIT
DO
UB
LE
PR
EC
ISIO
N(A
-H,
O-Z
)C
INT
EG
ER
ISE
ED
DO
UB
LE
PR
EC
ISIO
NR
AN
F(N
),r
com
mo
n/c
inr2
50
/r
C C CD
AT
AF
AC
TO
R/4
14
75
55
7.0
D0
/,T
WO
28
/268
43
54
56
.0D
0/
C C CIF
(IS
EE
D.G
E.
0)
TH
EN
R=
DB
LE
(IS
EE
D)/
TW
O2
8R
=D
MO
D(R
*FA
CT
OR
,1.0
D0
)IS
EE
D=
-1E
ND
IFC
DO
10
0I
=1
,NR
=D
MO
D(R
*FA
CT
OR
,1.0
D0
)R
AN
F(I
)=
SN
GL
(R)
10
0C
ON
TIN
UE
CE
ND
C C CC
CC
CC
SU
BR
OU
TIN
ER
25
0(M
Z,R
AN
,n_
dim
,N,K
PT
R)
C CS
TO
RE
SN
RE
AL
RA
ND
OM
NU
MB
ER
SIN
RA
NU
SIN
GIN
TE
GE
RS
INM
ZC
RA
ND
OM
NU
MB
ER
SH
AV
EU
NIF
OR
MD
IST
RIB
UT
ION
ININ
TE
RV
AL
(0,1
)C
PA
RA
ME
TE
R(R
INV
=1
./2
14
74
83
64
7.)
INT
EG
ER
MZ
(250
)IN
TE
GE
RN
,KP
TR
DO
UB
LE
PR
EC
ISIO
NR
AN
(n_
dim
)IN
TE
GE
RI,L
C CI
=0
L=
N+
KP
TR
-1
C1
0C
ON
TIN
UE
CK
MIN
=K
PT
RK
MA
X=
MIN
(L,1
47
)D
O1
00
K=
KM
IN,K
MA
XM
Z(K
)=
IEO
R(M
Z(K
),M
Z(K
+1
03
))I
=I
+1
RA
N(I
)=
MZ
(K)
*R
INV
10
0C
ON
TIN
UE
CK
MIN
=M
AX
(KM
IN,K
MA
X+
1)
KM
AX
=M
IN(L
,25
0)
*VO
CL
LO
OP
,NO
VR
EC
DO
20
0K
=K
MIN
,KM
AX
MZ
(K)
=IE
OR
(MZ
(K),
MZ
(K-
14
7))
I=
I+
1R
AN
(I)
=M
Z(K
)*
RIN
V2
00
CO
NT
INU
EC
IF(K
MA
X.E
Q.
25
0)
TH
EN
KP
TR
=1
L=
L-
25
0G
OT
O1
0E
ND
IFC
KP
TR
=K
MA
X+
1C
EN
DC !
!!
!!
!!
!!
sub
rou
tine
jaco
bi(d
im,
ma
trix
,ro
t_m
at,
eig
en
,ite
r_m
ax)
!d
iag
ona
lize
ssy
mm
etr
icm
atr
ixm
atr
ixw
ithg
ive
nd
ime
nsi
on
!u
sin
gite
ratio
nsc
he
me
of
jaco
bi
! !ro
t_m
at
ism
atr
ixco
inta
inin
geig
en
vect
ors
of
ma
trix
!m
atr
ixth
us
tra
nsf
orm
sfr
om
"ort
ho
go
na
l"sp
ace
tog
ive
nsp
ace
! !e
ige
nis
ma
trix
inn
ew
coo
rdin
ate
syst
em
inte
ge
rd
im,
dim
_m
ax,
i_d
im,
j_d
im,
k_d
im,
l_d
imp
ara
me
ter
(dim
_m
ax=
3)
do
ub
lep
reci
sio
nm
atr
ix(d
im_
ma
x,d
im_
max)
do
ub
lep
reci
sio
nro
t_m
at(
dim
_m
ax,
dim
_m
ax)
,e
ige
n(d
im_
ma
x,d
im_
max)
do
ub
lep
reci
sio
nh
_m
at(
dim
_m
ax,
dim
_m
ax)
,lo
c_ro
(dim
_m
ax,
dim
_m
ax)
inte
ge
rite
rat,
iter_
ma
xin
teg
er
i_d
_m
ax,
i_o
_m
ax,
j_o
_m
ax
do
ub
lep
reci
sio
nm
ax_
dia
g,
ma
x_o
ff,
tole
ran
cep
ara
me
ter
(to
lera
nce
=1
.d-1
3)
do
ub
lep
reci
sio
np
hi
if(d
im.n
e.d
im_
ma
x)st
oP
"Allo
catio
npro
ble
min
jaco
bi"
do
i_d
im=
1,
dim
_m
ax
do
j_d
im=
1,
dim
_m
ax
h_
ma
t(i_
dim
,j_d
im)
=0
.ro
t_m
at(
i_d
im,j_
dim
)=
0.
eig
en
(i_
dim
,j_d
im)
=m
atr
ix(i_
dim
,j_d
im)
en
dd
oro
t_m
at(
i_d
im,i_
dim
)=
1.
en
dd
o
if(ite
r_m
ax.
eq
.0)
iter_
ma
x=
4*d
im_
max*
dim
_m
ax
do
10
0ite
rat
=1
,ite
r_m
ax
c---
-g
et
big
ge
std
iag
on
al
an
do
ff-d
iag
on
al
ele
me
nt
ma
x_d
iag
=ab
s(e
ige
n(1
,1))
i_d
_m
ax
=1
ma
x_o
ff=
abs(
eig
en
(1,2
))i_
o_
ma
x=
1j_
o_
ma
x=
2d
oi_
dim
=1,
dim
_m
ax-
1if
(ab
s(e
ige
n(i_
dim
,i_d
im))
.gt.m
ax_
dia
g)
the
nm
ax_
dia
g=
ab
s(e
ige
n(i_
dim
,i_d
im))
142
B.1. Molecular Dynamics Code
i_d
_m
ax
=i_
dim
en
dif
do
j_d
im=
i_d
im+
1,
dim
_m
ax
if(a
bs(
eig
en(i_
dim
,j_d
im))
.gt.m
ax_
off)
the
nm
ax_
off
=ab
s(e
ige
n(i_
dim
,j_d
im))
i_o
_m
ax
=i_
dim
j_o
_m
ax
=j_
dim
en
dif
en
dd
oe
nd
do
if(a
bs(
eig
en(d
im_
ma
x,d
im_
ma
x)).
gt.m
ax_
dia
g)
the
nm
ax_
dia
g=
eig
en
(dim
_m
ax,
dim
_m
ax)
i_d
_m
ax
=dim
_m
ax
en
dif
if(a
bs(
ma
x_off/m
ax_
dia
g).
lt.to
lera
nce
)re
turn
!d
efin
elo
cal
rota
tion
ma
trix
,!
set
h_m
at
=0
-ma
trix
,lo
c_ro
=1
-ma
trix
do
j_d
im=
1,
dim
_m
ax
do
i_d
im=
1,
dim
_m
ax
loc_
ro(i_
dim
,j_d
im)
=0
.d0
h_
ma
t(i_
dim
,j_d
im)
=0
.d0
en
dd
olo
c_ro
(j_
dim
,j_d
im)
=1
.d0
en
dd
op
hi
=0
.5*
ata
n(
2*e
ige
n(i_
o_
ma
x,j_
o_
ma
x)/
&(e
ige
n(i_
o_
ma
x,i_
o_
ma
x)-e
ige
n(j_
o_
ma
x,j_
o_
ma
x))
)lo
c_ro
(i_
o_
max,
i_o
_m
ax)
=d
cos(
ph
i)lo
c_ro
(j_
o_
max,
j_o
_m
ax)
=lo
c_ro
(i_
o_m
ax,
i_o
_m
ax)
loc_
ro(i_
o_
max,
j_o
_m
ax)
=-s
in(p
hi)
loc_
ro(j_
o_
max,
i_o
_m
ax)
=-lo
c_ro
(i_
o_
ma
x,j_
o_
ma
x)!
rota
tem
atr
ixe
ige
nd
oj_
dim
=1
,d
im_
ma
xd
ol_
dim
=1
,d
im_
ma
xif
(lo
c_ro
(l_d
im,j_
dim
).n
e.0
.d0
)th
en
do
k_d
im=
1,
dim
_m
ax
if(e
ige
n(l_
dim
,k_
dim
).n
e.0
.d0
)th
en
do
i_d
im=
1,
dim
_m
ax
h_
ma
t(i_
dim
,j_d
im)
=h
_m
at(
i_d
im,j_
dim
)&
+lo
c_ro
(k_
dim
,i_d
im)*
eig
en
(k_
dim
,l_d
im)*
loc_
ro(l_
dim
,j_d
im)
en
dd
oe
nd
ife
nd
do
en
dif
en
dd
oe
nd
do
do
j_d
im=
1,
dim
_m
ax
do
i_d
im=
1,
dim
_m
ax
eig
en
(i_
dim
,j_d
im)
=h
_m
at(
i_d
im,j_
dim
)h
_m
at(
i_d
im,j_
dim
)=
0.d
0e
nd
do
en
dd
o
do
j_d
im=
1,
dim
_m
ax
do
k_d
im=
1,
dim
_m
ax
if(lo
c_ro
(k_d
im,j_
dim
).n
e.0
.d0
)th
en
do
i_d
im=
1,
dim
_m
ax
h_
ma
t(i_
dim
,j_d
im)
=h
_m
at(
i_d
im,j_
dim
)&
+ro
t_m
at(
i_d
im,k
_d
im)
*lo
c_ro
(k_
dim
,j_d
im)
en
dd
oe
nd
ife
nd
do
en
dd
o
do
i_d
im=
1,
dim
_m
ax
do
j_d
im=
1,
dim
_m
ax
rot_
ma
t(i_
dim
,j_d
im)
=h
_m
at(
i_d
im,j_
dim
)e
nd
do
en
dd
o
10
0co
ntin
ue
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!su
bro
utin
ead
dn
um
tost
rin
g(s
trin
g,n
um
be
r)im
plic
itn
one
inte
ge
r*4
i,str
len
,nu
mb
er,
no
dig
,nu
m,s
nu
mch
ara
cte
r(*)
strin
g
snu
m=
nu
mb
er
do
i=le
n(s
trin
g),
1,-
1if(
strin
g(i:i)
/=’
’)g
oto
10
en
dd
o1
0st
rle
n=
i
no
dig
=in
t(lo
g1
0(1
.0*s
nu
m+
0.1
))+
1d
oi=
no
dig
,1,-
1n
um
=sn
um
/10
**(i-1
)st
rin
g(s
trle
n+
1:s
trle
n+
1)=
cha
r(4
8+
nu
m)
strle
n=
strle
n+
1sn
um
=sn
um
-nu
m*1
0**
(i-1
)e
nd
do
retu
rne
nd
!!!!!!!!!!!!
pim
d.co
m.f
!---
-w
he
reto
pa
ya
tte
ntio
nw
he
nn
ew
po
ten
tial
ge
tsb
uild
in!-
---
!---
-lo
ok
for
pla
ces
wh
ere
f_p
ote
ntia
l.eq
.2o
ccu
rs! !-
---
initi
aliz
ed
efa
ult:
ma
ss,in
tera
ctio
np
ara
me
ters
,cu
t_o
ff,s
kin
!te
mp
era
ture
,tim
est
ep
,p
ress
ure
inp
ara
_in
it!
--->
cho
sere
aso
na
ble
dyn
am
icm
od
em
ass
es
for
each
pa
rtic
lety
pe
!--
->ca
lcu
late
shift
sin
en
erg
y!-
---
initi
aliz
ed
efa
ult
stru
ctu
rean
dd
efa
ult
che
mic
al
com
po
sitio
n!-
---
ma
keo
utp
ut
file
an
din
pu
tfil
eco
mp
atib
le!-
---
write
ne
wfo
rce
/en
erg
yro
utin
e
rea
lp
i,tw
opi,s
qrt
2,s
qrt
3p
ara
me
ter
(pi=
3.1
41
59
26
5,tw
op
i=2
*pi,s
qrt
2=
1.4
14
21
35
6,
&sq
rt3
=1
.73
20
50
81
)
do
ub
lep
reci
sio
nm
ass
_a
mu
,jou
le,e
v,e
lec_
pre
fac
pa
ram
ete
r(m
ass
_a
mu
=0
.02
06
1,jo
ule
=7
.24
32
e2
2,e
V=
1.1
60
5e
4,
&e
lec_
pre
fac=
1.6
70
9e
5)
143
B. Programsin
teg
er
i_d
um
my
do
ub
lep
reci
sio
nr_
du
mm
yco
mp
lex
c_d
um
my
cha
ract
er(
64)
cha
r_d
um
my
inte
ge
rf_
sym
me
try
inte
ge
rn
_b
in_
x,n
_b
in_
y,n
_b
in_
zin
teg
er
i_si
lic,n
_si
lic,i_
oxy
,n_
oxy
!---
-f_
sym
me
try
=1
:fc
csy
mm
etr
y!
pa
ram
ete
r(f
_sy
mm
etr
y=1
)!
pa
ram
ete
r(n
_b
in_
x=5
,n_
bin
_y=
5,n
_b
in_
z=5
)!
pa
ram
ete
r(n
_si
lic=
n_
bin
_x*
n_b
in_
y*n
_b
in_
z,n
_o
xy=
3*n
_si
lic)
!---
-tr
idym
it!
pa
ram
ete
r(f
_sy
mm
etr
y=2
)!
pa
ram
ete
r(n
_b
in_
x=4
,n_
bin
_y=
3,n
_b
in_
z=3
)!
pa
ram
ete
r(n
_si
lic=
8*n
_b
in_
x*n
_b
in_
y*n
_b
in_
z,n
_o
xy=
2*n
_si
lic)
!---
-cr
isto
ba
lita
lon
gc-
axi
s:so
metim
es
con
vert
sto
kre
atin
e!
pa
ram
ete
r(f
_sy
mm
etr
y=3
)!
pa
ram
ete
r(n
_b
in_
x=4
,n_
bin
_y=
3,n
_b
in_
z=2
)!
pa
ram
ete
r(n
_si
lic=
12
*n_
bin
_x*
n_
bin
_y*
n_
bin
_z,
n_
oxy
=2*n
_si
lic)
!---
-cr
isto
ba
litin
cub
icfo
rm!
pa
ram
ete
r(f
_sy
mm
etr
y=4
)!
pa
ram
ete
r(n
_b
in_
x=3
,n_
bin
_y=
n_
bin
_x,
n_
bin
_z=
n_
bin
_x)
!p
ara
me
ter
(n_
silic
=8
*n_
bin
_x*
n_
bin
_y*
n_
bin
_z,
n_
oxy
=2
*n_
silic
)!-
---
be
taq
ua
rz!
pa
ram
ete
r(f
_sy
mm
etr
y=6
)!
pa
ram
ete
r(n
_b
in_
x=5
,n_
bin
_y=
3,n
_b
in_
z=4
)!
pa
ram
ete
r(n
_b
in_
x=6
,n_
bin
_y=
4,n
_b
in_
z=5
)!
pa
ram
ete
r(n
_si
lic=
6*n
_b
in_
x*n
_b
in_
y*n
_b
in_
z,n
_o
xy=
2*n
_si
lic)
!---
-a
lph
aq
ua
rzp
ara
me
ter
(f_
sym
me
try=
7)
pa
ram
ete
r(n
_b
in_
x=4
,n_
bin
_y=
3,n
_b
in_z=
4)
!p
ara
me
ter
(n_
bin
_x=
5,n
_b
in_
y=3
,n_
bin
_z=
4)
!p
ara
me
ter
(n_
bin
_x=
6,n
_b
in_
y=4
,n_
bin
_z=
5)
pa
ram
ete
r(n
_si
lic=
6*n
_b
in_
x*n
_b
in_
y*n
_b
in_
z,n
_o
xy=
2*n
_si
lic)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
inte
ge
ri_
part
,j_p
art
,n_
pa
rt!
pa
ram
ete
r(n
_si
lic=
1,n
_o
xy=
2)
pa
ram
ete
r(n
_p
art
=n
_si
lic+
n_
oxy
)
inte
ge
ri_
neig
h,n
_n
eig
hp
ara
me
ter
(n_
ne
igh
=1
00
0)
inte
ge
rn
eig
hb
or(
0:n
_n
eig
h,n
_p
art
)co
mm
on
/cn
eig
hb
or/
ne
igh
bo
rin
teg
er
n_
bin
_m
ax,
n_
ne
igh
_m
ax
com
mo
n/c
n_
bin
ne
igh
/n
_b
in_
ma
x,n
_n
eig
h_
ma
x
inte
ge
ri_
tro
t,j_
tro
t,n
_tr
ot,n
_tim
e_
sca
lp
ara
me
ter
(n_
tro
t=1
,n_
time
_sc
al=
1)
do
ub
lep
reci
sio
nsq
rtp
com
mo
n/c
sqrt
p/
sqrt
p
inte
ge
ri_
dim
,j_d
im,k
_d
im,l_
dim
,n_
dim
,e_
dim
pa
ram
ete
r(n
_d
im=
3,e
_d
im=
3)
do
ub
lep
reci
sio
nd
elta
_r(
n_
dim
),d
elta
_ce
ll(n
_d
im)
com
mo
n/c
de
lta_
rc/
de
lta_
r,d
elta
_ce
ll
do
ub
lep
reci
sio
nr0
(n_
dim
,0:n
_tr
ot-
1,n
_p
art
),&
r0_
old
(n_
dim
,0:n
_tr
ot-
1,n
_p
art
),r_
rea
l(n
_d
im,0
:n_
tro
t-1
,n_
part
),&
forc
e(n
_d
im,0
:n_
tro
t-1
,n_
pa
rt)
do
ub
lep
reci
sio
nu
0(n
_d
im,2
*n_
tro
t,n
_pa
rt),
forc
e_
loc(
n_
dim
)co
mm
on
/cr0
u0
forc
e/
r0,r
0_
old
,r_
rea
l,u0
,fo
rce
,fo
rce
_lo
cin
teg
er
pb
c0(n
_d
im,0
:n_
tro
t-1
,n_
pa
rt),
f_sk
inco
mm
on
/cp
bc0
/p
bc0
,f_
skin
do
ub
lep
reci
sio
nv_
rea
l(n
_d
im,2
*n_
tro
t,n
_p
art
)co
mm
on
/cvr
ea
l/v_
rea
ld
ou
ble
pre
cisi
on
r_re
al_
avg
(n_
dim
,0:n
_tr
ot-
1,n
_p
art
)co
mm
on
/cre
ala
vg/
r_re
al_
avg
inte
ge
ri_
ord
er,
j_o
rde
r,n
_o
rde
rp
ara
me
ter
(n_
ord
er=
2)
do
ub
lep
reci
sio
nu
x(n
_o
rde
r,n
_d
im,2
*n_tr
ot,n
_p
art
),&
fr_
bo
x(n
_d
im+
3),
&f0
(n_
dim
,2*n
_tr
ot,n
_p
art
),fr
(n_
dim
,2*n
_tr
ot,n
_p
art
)co
mm
on
/cu
f0/
ux,
f0,fr,
fr_
bo
x
inte
ge
ri_
time,n
_re
lax,
n_
ob
ser,
n_
safe
com
mo
n/c
itim
e/
i_tim
e,n
_re
lax,
n_
ob
ser,
n_
safe
do
ub
lep
reci
sio
nd
t,d
t_2
,r_
time
com
mo
n/c
dtim
e/
dt,d
t_2
,r_
time
do
ub
lep
reci
sio
ntk
,tkp
,be
ta,b
eta
pco
mm
on
/cth
erm
/tk
,tkp
,be
ta,b
eta
p
inte
ge
ri_
typ
e,j_
typ
e,n
_ty
pe
,typ
e(n
_p
art
)p
ara
me
ter
(n_
typ
e=
2)
do
ub
lep
reci
sio
nrf
_w
idth
(0:n
_tr
ot-
1,n
_ty
pe
),rf
b_
wid
thco
mm
on
/cty
pe
/ty
pe
,rf_
wid
th,r
fb_
wid
th
do
ub
lep
reci
sio
nm
ass
(0:n
_tr
ot-
1,n
_ty
pe
),fr
ictio
n(n
_ty
pe
),&
ep
sil(n
_ty
pe
,n_
typ
e),
sig
ma
(n_
typ
e,n
_ty
pe
),k_
qu
an
t(n
_ty
pe
),&
k_e
ige
n(0
:n_
tro
t-1
,n_
typ
e),
sig
ma
_2
(n_
typ
e,n
_ty
pe
),&
e_
shift
(n_
typ
e,n
_ty
pe
),v_
the
rm(0
:n_tr
ot-
1,n
_ty
pe
),&
c_va
nd
wa
als
(n_
typ
e,n
_ty
pe
),w
_th
erm
,&
cha
rge
np
(n_p
art
),ch
arg
en
m(n
_p
art
)d
ou
ble
pre
cisi
on
cha
rge
(n_
pa
rt),
cha
rge
x(n
_o
rde
r,n
_p
art
),&
fQ(n
_p
art
)co
mm
on
/cp
rop
ert
ies/
ma
ss,frict
ion
,ep
sil,s
igm
a,k
_q
ua
nt,
&k_
eig
en
,sig
ma
_2
,e_
shift
,v_
the
rm,c
_va
nd
wa
als
,w_
the
rm,
&ch
arg
e,c
ha
rge
x,&
cha
rge
np
,cha
rge
nm
,&
fQ do
ub
lep
reci
sio
nva
sh_
h(n
_ty
pe
,n_
typ
e),
vash
_e
ta(n
_ty
pe
,n_
typ
e),
&va
sh_
alp
ha
(n_
typ
e),
vash
_B
(n_
typ
e),
vash
_l(n
_ty
pe
),&
vash
_ct
he
ta(n
_ty
pe
),va
sh_
r0(n
_ty
pe
)co
mm
on
/va
shis
hta
/va
sh_
h,v
ash
_e
ta,v
ash
_a
lph
a,v
ash
_B
,&
vash
_l,
vash
_ct
he
ta,
vash
_r0
inte
ge
rn
_a
ng
ula
r,n
_a
ng
(n_
typ
e)
pa
ram
ete
r(n
_an
gu
lar=
6)
do
ub
lep
reci
sio
ntr
iple
_co
s(n
_p
art
,n_
an
gu
lar)
,&
trip
le_
rij(n
_p
art
,n_
an
gu
lar)
,&
trip
le_
rik(
n_
pa
rt,n
_a
ng
ula
r),
&tr
iple
_d
elta
ij(n
_p
art
,n_
an
gu
lar,
n_
dim
),&
trip
le_
de
ltaik
(n_p
art
,n_
an
gu
lar,
n_
dim
)in
teg
er
trip
le_
pa
rtj(n
_p
art
,n_
an
gu
lar)
,&
trip
le_
pa
rtk(
n_
part
,n_
an
gu
lar)
com
mo
n/th
ree
bo
dy/
n_
an
g,
trip
le_
cos,
trip
le_
rij,
trip
le_
rik,
144
B.1. Molecular Dynamics Code
&tr
iple
_d
elta
ij,tr
iple
_d
elta
ik,
trip
le_
pa
rtj,
trip
le_
part
kd
ou
ble
pre
cisi
on
r_cu
toff(n
_ty
pe
,n_
typ
e),
r_sk
in(n
_ty
pe
,n_
typ
e),
&r_
cuto
ff_
2(n
_ty
pe
,n_
typ
e),
r_ra
ng
e_
2(n
_ty
pe
,n_
typ
e),
&r_
ran
ge
(n_
typ
e,n
_ty
pe
),r_
cuto
ff_
ma
xco
mm
on
/ccu
toffsk
in/
r_cu
toff,r
_sk
in,r
_cu
toff_
2,r
_ra
ng
e_
2,
&r_
ran
ge
,r_
cuto
ff_
ma
xd
ou
ble
pre
cisi
on
tra
ns_
un
its,d
0(n
_ty
pe
,n_
typ
e),
&m
sze
ta(n
_ty
pe
,n_
typ
e),
&m
sr0
(n_
typ
e,n
_ty
pe
),g
am
ma
(n_
typ
e,n
_ty
pe
)in
teg
er
msn
(n_
typ
e)
com
mo
n/m
ors
est
retc
h/
d0
,msr
0,g
am
ma
,msn
,msz
eta
pa
ram
ete
r(t
rans_
un
its=
50
3.2
28
62
)d
ou
ble
pre
cisi
on
dip
ole
(n_
dim
,n_
pa
rt),
avg
_d
ipo
le(0
:n_
dim
,n_
typ
e),
&a
vg_
dip
ole
_p
art
(0:n
_d
im,n
_p
art
),p
ol_
tota
l(n
_d
im),
&p
ol_
dip
ole
s(n
_d
im)
com
mo
n/c
po
larize
/d
ipo
le,a
vg_
dip
ole
,avg
_d
ipo
le_
pa
rt,
&p
ol_
tota
l,p
ol_
dip
ole
s
inte
ge
ris
ee
d,m
z(2
50
),kp
trd
ou
ble
pre
cisi
on
ran
do
m(n
_d
im)
com
mo
n/c
ran
do
m/
mz,
ise
ed
,kp
tr
do
ub
lep
reci
sion
pre
dic
t_co
ef(
0:n
_o
rde
r-1
,0:n
_o
rde
r),
&co
rre
ct_
coe
f(0
:n_
ord
er)
com
mo
n/c
pre
dic
t/p
red
ict_
coe
f,co
rre
ct_co
ef
do
ub
lep
reci
sion
t_d
yna
mic
,t_
dyn
am
ic_
1,t_
dyn
am
ic_
2,t_
dia
g,t_
nd
iag
&,t_
dia
g_
1,t_
nd
iag
_1,t_
dyn
am
ic_
cha
rge
com
mo
n/c
tdym
ic/
t_d
yna
mic
,t_
dyn
am
ic_
1,t_
dyn
am
ic_
2,t_
dia
g,t_
nd
iag
&,t_
dia
g_
1,t_
nd
iag
_1,t_
dyn
am
ic_
cha
rge
do
ub
lep
reci
sion
v_in
ter,
v_in
ter_
1,v
_in
ter_
2,
v_g
au
ge
com
mo
n/c
inte
r/v_
inte
r,v_
inte
r_1
,v_
inte
r_2
,v_
ga
ug
ed
ou
ble
pre
cisi
on
v_ch
ain
,prim
_e
st,p
rim
_e
st_
1,p
rim
_e
st_
2co
mm
on
/cp
rim
_est
/v_
cha
in,p
rim
_e
st,p
rim
_e
st_
1,p
rim
_e
st_
2d
ou
ble
pre
cisi
on
viri_
est
,viri_
est
_1
,viri_
est
_2
com
mo
n/c
viri_
est
/vi
ri_
est
,viri_
est
_1
,viri_
est
_2
do
ub
lep
reci
sion
v_q
eq
self,
v_re
alc
ou
lom
b,
v_sh
ort
ran
ge
,v_
cha
rge
com
mo
n/c
vqe
q/
v_q
eq
self,
v_re
alc
ou
lom
b,
v_sh
ort
ran
ge
,v_
cha
rge
do
ub
lep
reci
sion
v_th
ree
bo
dy
com
mo
n/v
thre
e/
v_th
ree
bo
dy
do
ub
lep
reci
sion
dip
ole
_cl
ass
(0:n
_d
im,1
2),
&dip
ole
_cl
ass
1(0
:n_
dim
,12
),&
dip
ole
_cl
ass
2(0
:n_
dim
,12
),d
ipo
le_
cla
ss4
(0:n
_d
im,1
2),
&d
ipo
le_
cou
nt
com
mo
n/c
dip
ole
cla
ss/
dip
ole
_cl
ass
,d
ipo
le_
cla
ss1
,&
dip
ole
_cl
ass
2,
dip
ole
_cl
ass
4,
dip
ole
_co
un
t
inte
ge
ri_
cor,
n_
cor,
i_m
ea
sure
pa
ram
ete
r(n
_co
r=2
04
8)
do
ub
lep
reci
sion
con
f_ce
ntr
(n_
dim
,n_
pa
rt)
do
ub
lep
reci
sion
cor_
ob
s(0
:n_
cor)
,co
r_fu
nc(
0:n
_co
r,n
_ty
pe
)d
ou
ble
pre
cisi
on
qd
ot_
cor(
0:n
_co
r),
qd
ot0
(n_
dim
,n_
pa
rt)
do
ub
lep
reci
sion
cor_
fun
c_A
(0:n
_co
r)co
mm
on
/cco
r/co
nf_
cen
tr,c
or_
ob
s,co
r_fu
nc,
i_m
ea
sure
com
mo
n/c
cor2
/co
r_fu
nc_
A,q
do
t_co
r,q
do
t0d
ou
ble
pre
cisi
on
cor_
fun
c_B
(0:n
_co
r),
&st
ore
d_
vel(n
_d
im,0
:n_
cor,
n_p
art
)co
mm
on
/cco
rfu
ncb
/co
r_fu
nc_
B,
sto
red
_ve
l
inte
ge
rd
i_tim
e,n
i_tim
e,ie
ff_
time
com
mo
n/c
rea
l_tim
e/
di_
time
,ieff_
time
pa
ram
ete
r(n
i_tim
e=
n_
time
_sc
al)
do
ub
lep
reci
sio
nco
r_ifu
nc(
0:n
_tr
ot-
1)
com
mo
n/c
icor/
cor_
ifun
c
do
ub
lep
reci
sio
ntim
e_
ob
sco
mm
on
/ctim
e_
ob
s/tim
e_
ob
s
inte
ge
rco
unt_
ifun
cco
mm
on
/cco
un
t_ifu
nc/
cou
nt_
ifun
c
inte
ge
rn
_p
bc
com
mo
n/c
n_
pb
c/n
_p
bc
inte
ge
rf_
movi
e!
f_m
ovi
e=
1;
write
mu
ltip
lefr
am
es
xyz-
file
!f_
mo
vie
=0
;d
on
ot
pa
ram
ete
r(f_
mo
vie
=0
)
inte
ge
rf_
con
fmo
vie
!f_
confm
ovi
e=
1;
write
mu
ltip
lefr
am
es
con
f-fil
e!
f_co
nfm
ovi
e=
0;
do
no
tp
ara
me
ter(
f_co
nfm
ovi
e=
0)
inte
ge
rf_
e_a
pp
lied
!f_
e_
ap
plie
d=
0;
no
ext
ern
al
ele
ctric
field
!f_
e_
ap
plie
d=
1;
ele
ctric
field
inx
dire
ctio
n!
f_e
_ap
plie
d=
2;
ele
ctric
field
iny
dire
ctio
n!
f_e
_ap
plie
d=
3;
ele
ctric
field
inz
dire
ctio
np
ara
me
ter(
f_e_
ap
plie
d=
1)
!C
AU
TIO
N:
for
Sca
nd
olo
po
ten
tial,
ple
ase
set
!=
==
==
==
tele
ctric
inm
etr
ic.f
/m
od
ule
!e
lect
ric_
field
acc
ord
ing
ly!!!
inte
ge
rf_
po
ten
tial
!---
-f_
po
ten
tial
=1
:H
arm
on
ico
scill
ato
r!
f_p
ote
ntia
l=
2;
Le
nn
ard
Jon
es
!f_
po
ten
tial
=3
;B
KS
po
ten
tial
!f_
po
ten
tial
=4
;A
ziz
!f_
po
ten
tial
=5
;M
SQ
Eq
po
tentia
l!
f_p
ote
ntia
l=
6;
MS
fluc-
Qp
ote
ntia
l!
f_p
ote
ntia
l=
7;
MS
DQ
Eq
po
ten
tial
!f_
po
ten
tial
=8
;V
ash
ish
tap
ote
ntia
l!
f_p
ote
ntia
l=
9;
Sca
nd
olo
po
ten
tial
pa
ram
ete
r(f_
po
ten
tial=
9)
inte
ge
rf_
charg
ea
dju
st!-
---
f_ch
arg
ea
dju
st=
1:
con
sta
nt
cha
rge
s!
f_ch
arg
ea
dju
st=
2;
self
con
sist
en
cy!
f_ch
arg
ea
dju
st=
3;
ext
en
de
dla
gra
ng
ian
!f_
charg
ea
dju
st=
4;
ma
trix
inve
rsio
nm
eth
od
pa
ram
ete
r(f_
cha
rge
ad
just
=1
)
do
ub
lep
reci
sio
nq
eq
ele
ctro
ne
g(n
_ty
pe),
qe
qh
ard
ne
ss(n
_ty
pe
),&
qe
qla
mb
da
i(n_
pa
rt),
qe
qla
mb
da
,q
eq
rec(
n_
pa
rt),
&q
eq
ma
ss(n
_ty
pe
),q
eq
old
cha
rge
(n_
pa
rt,0
:3),
qe
qfr
ictio
nin
teg
er
n_
ato
mty
pe
(n_
typ
e)
com
mo
n/q
eq
/q
eq
ele
ctro
ne
g,
qe
qh
ard
ness
,&
qe
qla
mb
da
i,q
eq
lam
bd
a,
qe
qre
c,q
eq
old
cha
rge
,&
qe
qm
ass
,q
eqfr
ictio
n,
n_
ato
mty
pe
do
ub
lep
reci
sio
nco
nst
an
t_ch
arg
e(n
_ty
pe
)co
mm
on
/flu
cqe
q/
con
sta
nt_
cha
rge
145
B. Programsd
ou
ble
pre
cisi
on
forc
e_
sca
l(n
_d
im+
3),
forc
e_
sca
l_in
ter(
n_
dim
+3)
&,s
cal_
0(n
_d
im+
3),
sca
l_x(
n_
ord
er,
n_
dim
+3
)d
ou
ble
pre
cisi
on
pre
ssu
re(n
_d
im+
3),
mass
_b
ox,
pre
ss,fric_
bo
xin
teg
er
f_p
ress
ure
com
mo
n/c
pre
ss/
forc
e_
sca
l_in
ter,
sca
l_0
,sca
l_x,
pre
ssu
re,
&fo
rce
_sc
al,p
ress
,f_
pre
ssu
reco
mm
on
/cp
ress
2/
ma
ss_
bo
x,fr
ic_
bo
x
do
ub
lep
reci
sio
nh
_m
at(
3,3
),h
_m
at_
2(3
,3),
h_
ma
t_d
ot(
3,3
),&
h_
ma
t_2
d(3
,3),
h_
ma
t_2
_in
v(3
,3),
g_
ma
t_do
t(3
,3),
h_
ma
t_in
v(3
,3)
com
mo
n/c
tenso
r/h
_m
at,h
_m
at_
2,h
_m
at_
do
t,h
_m
at_
2d
,h_
ma
t_2
_in
v,&
g_
ma
t_d
ot,h
_m
at_
inv
do
ub
lep
reci
sio
nm
et_
ten
_vo
i(n
_d
im+
3),
g_
voi_
do
t(n
_d
im+
3)
com
mo
n/c
voig
t/m
et_
ten
_vo
i,g_
voi_
do
t
do
ub
lep
reci
sio
nsc
al_
1(n
_d
im+
3),
volu
me
,vo
l_1
,vo
l_2
,&
sca
l_2(n
_d
im+
3,n
_d
im+
3),
v_p
ress
com
mo
n/c
pre
ss_
ob
s/sc
al_
1,s
cal_
2,v
_pre
ss,v
olu
me
,vo
l_1
,vo
l_2
do
ub
lep
reci
sio
nr_
ref(
n_
dim
,n_
pa
rt)
com
mo
n/c
r_re
f/r_
ref
inte
ge
ri_
grid
,n_
grid
pa
ram
ete
r(n
_g
rid
=2
56
)d
ou
ble
pre
cisi
on
g_
r(n
_ty
pe
,n_
typ
e,0
:n_
grid
+1
)co
mm
on
/cg
_r/
g_
r
inte
ge
ri_
pote
ntia
l,n_
po
ten
tial
pa
ram
ete
r(n
_p
ote
ntia
l=1
00
00
)d
ou
ble
pre
cisi
on
r_p
ot(
n_
typ
e,n
_ty
pe
,0:n
_p
ote
ntia
l),
&r_
po
t_d
(n_
typ
e,n
_ty
pe
,0:n
_p
ote
ntia
l)d
ou
ble
pre
cisi
on
r_p
ot_
1(n
_ty
pe
,n_
type
,0:n
_p
ote
ntia
l),
&r_
po
t_2
(n_
typ
e,n
_ty
pe
,0:n
_p
ote
ntia
l),
&r_
po
t_2
q(n
_ty
pe
,n_
typ
e,0
:n_
po
tentia
l),
&r_
po
t_d
_1
(n_
typ
e,n
_ty
pe
,0:n
_p
ote
ntia
l),
&r_
po
t_d
_2
(n_
typ
e,n
_ty
pe
,0:n
_p
ote
ntia
l),
&r_
po
t_d
_2
q(n
_ty
pe
,n_
typ
e,0
:n_
po
ten
tial)
com
mo
n/c
r_po
td/
r_p
ot_
1,r
_p
ot_
2,r
_p
ot_
2q
,r_
po
t_d
_1
,&
r_p
ot_
d_2
,r_
po
t_d
_2
q,r
_p
ot,r_
pot_
dco
mp
lex
tab
_e
xp_
ima
(-n
_p
ote
ntia
l:n_
pote
ntia
l)co
mm
on
/cta
b_
exp
_im
/ta
b_
exp
_im
a
inte
ge
ri_
run
,n_
run
com
mo
n/in
_ru
n/
i_ru
n,n
_ru
n
do
ub
lep
reci
sio
ne
rfcc
do
ub
lep
reci
sio
na
lph
a,q
_cu
t_2
,se
lf_en
erg
y,v_
ew
ald
,&
dq
(n_
dim
,n_
dim
),v_
cut,a
lph
a_
pre
fac
com
mo
n/c
ew
ald
/a
lph
a,q
_cu
t_2
,se
lf_e
ne
rgy,
v_e
wa
ld,d
q,v
_cu
t&
,alp
ha
_p
refa
c
inte
ge
rn
q_
ma
x(n
_d
im),
n_
rec_
vec,
n_
rec_
vec_
ma
x,i_
rec_
vec
com
mo
n/c
rec_
ew
ald
/n
q_
ma
x,n
_re
c_ve
cp
ara
me
ter
(n_
rec_
vec_
ma
x=1
2*n
_p
art
)in
teg
er
rec_
vec_
list(
n_
rec_
vec_
ma
x,n
_d
im)
com
mo
n/c
rec_
vec_
list/
rec_
vec_
list
do
ub
lep
reci
sio
nre
c_fo
rce
_o
ffse
t(n
_dim
+3
),re
c_p
ot_
offse
tco
mm
on
/re
c_o
ffse
t/re
c_fo
rce
_o
ffse
t,re
c_p
ot_
offse
t
do
ub
lep
reci
sio
nr_
cut_
sho
rt,e
_sh
ift_sh
ort
(n_
typ
e,n
_ty
pe
)
pa
ram
ete
r(r
_cu
t_sh
ort
=9
.0)
do
ub
lep
reci
sio
ne
la_
bo
rn(n
_d
im,n
_d
im,n
_d
im,n
_d
im),
&e
la_
bo
rn_
1(n
_d
im,n
_d
im,n
_d
im,n
_d
im),
time
_b
orn
com
mo
n/c
ela
stic
/e
la_
bo
rn,e
la_
bo
rn_
1,tim
e_
bo
rnd
ou
ble
pre
cisi
on
stra
in(n
_d
im,n
_d
im),
stra
in_
1(n
_d
im,n
_d
im),
&st
rain
_2
(n_
dim
,n_
dim
,n_
dim
,n_
dim
)co
mm
on
/cst
rain
/st
rain
,str
ain
_1
,str
ain
_2
inte
ge
rf_
op
t_re
cco
mm
on
/cf_
op
t/f_
op
t_re
c
do
ub
lep
reci
sio
nro
t_m
at(
n_
dim
,n_
dim
),e
ige
n(n
_d
im,n
_d
im)
com
mo
n/c
jaco
bi/
rot_
ma
t,e
ige
n
do
ub
lep
reci
sio
ne
la_
kin
(n_
dim
,n_
dim
)co
mm
on
/ce
la_
kin
/e
la_
kin
do
ub
lep
reci
sio
nfo
r_sc
a_
mfa
_co
rco
mm
on
/cfo
r_sc
a_
mfa
_co
r/fo
r_sc
a_
mfa
_co
r
inte
ge
ri_
ne
igh
_o
ri(n
_p
art
,4)
do
ub
lep
reci
sio
nh
ist_
an
g(3
,n_
grid
)co
mm
on
/ci_
ne
igh
_o
ri/
his
t_a
ng
,i_
ne
igh
_o
rid
ou
ble
pre
cisi
on
r_n
eig
h_
min
,r_
ne
igh
_m
ax,
ne
igh
_tim
eco
mm
on
/cr_
ne
igh
/r_
ne
igh
_m
in,
r_n
eig
h_
ma
x,n
eig
h_
time
do
ub
lep
reci
sio
no
rd_
pa
r,o
rd_
pa
r_1
,ord
_p
ar_
2,o
rd_
pa
r_4
,ord
_c
com
mo
n/c
ord
_pa
r/o
rd_
pa
r,o
rd_
pa
r_1
,ord
_p
ar_
2,o
rd_
pa
r_4
,ord
_c
do
ub
lep
reci
sio
no
rd_
pa
rB,o
rd_
pa
rB_
1,o
rd_
pa
rB_
2,
&o
rd_
pa
rB_
4,o
rdB
_c
com
mo
n/c
ord
_pa
rB/
ord
_p
arB
,ord
_p
arB
_1,o
rd_
pa
rB_
2,
&o
rd_
pa
rB_
4,o
rdB
_c
do
ub
lep
reci
sio
no
rd_
pa
rC,o
rd_
pa
rC_
1,o
rd_
pa
rC_
2,o
rd_
pa
rC_
4,o
rdC
_c
com
mo
n/c
ord
parC
/o
rd_
pa
rC,o
rd_
pa
rC_
1,o
rd_
pa
rC_
2,o
rd_
pa
rC_
4,o
rdC
_c
146
B.1. Molecular Dynamics Code
B.1.1. Inputfiles
Inputfile pimd.inp for BKS potential
3 f_potential, information available1 f_chargeadjust
10000 # of relaxation steps200000 # of observation steps
10000 # of steps between configuration output48674 random # init
0.130910E-03 time step3.000000e+02 temperature
0.579141E+00 0.329760E+00 masses0.763884E+02 0.763884E+02 friction0.464498E+01 0.763884E+02 mass + fr. of box
0.000000e+00 pressure1 0 = NVT; 1 = NpT0 1 = optimized Ewald
0.000000E+00 0.208934E+09 exp. energy parameters0.208934E+09 0.161167E+08 exp. energy parameters
0.000000E+00 0.487318E+01 inverse exp. lenght scales0.487318E+01 0.276000E+01 inverse exp. lenght scales
0.000000E+00 0.154971E+07 van de Waals strength0.154971E+07 0.203088E+07 van de Waals strength
0.300000E+00 0.200000E+02 alpha, v_cut
0.450000E+00 0.450000E+00 skin radius0.450000E+00 0.450000E+00 skin radius
Inputfile pimd.inp for fluctuating charge potential
6 f_potential, information available3 f_chargeadjust
50000 # of relaxation steps200000 # of observation steps
10000 # of steps between configuration output48748 random # init
0.130910E-03 time step3.000000e+02 temperature
0.579141E+00 0.329760E+00 masses0.763884E+02 0.763884E+02 friction0.464498E+01 0.763884E+02 mass + fr. of box
0.000000e+00 pressure1 0 = NVT; 1 = NpT0 1 = optimized Ewald
0.483676E+05 0.101435E+06 electronegativity0.809298E+05 0.155083E+06 hardness of EN
0.400000E-01 0.400000E-01 fictitious charge mass0.763884E+03 charge friction
0.295600E+00 0.459970E+02 MS bond strength D00.459970E+02 0.536300E+00 MS bond strength D0
0.341030E+01 0.161480E+01 MS bond length R00.161480E+01 0.378350E+01 MS bond length R0
0.117139E+02 0.880220E+01 MS force constant gamma0.880220E+01 0.104112E+02 MS force constant gamma
0.148810E+01 0.148810E+01 slater orbital exponent zeta0.186846E+01 0.186846E+01 slater orbital exponent zeta
3 2 principal quantum number n
0.300000E+00 0.000000E+00 alpha, v_cut
0.450000E+00 0.450000E+00 skin radius0.450000E+00 0.450000E+00 skin radius
147
B. Programs
Inputfile pimd.inp for fluctuating dipole potential
9 f_potential, information available1 f_chargeadjust
1000 # of relaxation steps6000 # of observation steps1000 # of steps between configuration output6811 random # init
0.130910E-03 time step0.300000E+03 temperature
0.579141E+00 0.329760E+00 masses0.763884E+02 0.763884E+02 friction0.464498E+01 0.763884E+02 mass + fr. of box
0.217290E+04 pressure1 0 = NVT; 1 = NpT
0.300000E+00 0.200000E+02 alpha, v_cut
0.450000E+00 0.450000E+00 skin radius0.450000E+00 0.450000E+00 skin radius
B.2. Analysis Programs
examf60.f
Reads the output filefort.60 and writes analysis output to standard out.The output contains averaged box dimensions, lattice constants, stress, volume perunit cell, elastic constants, polarization, dielectric constant and piezoelectric stress andstrain coefficients.The gaussj routine from “Numerical Recipes in Fortran” [74] needs to be included inthe code.
calcstrain.f
Reads the output filefort.60 and writes analysis output tofort.59 . Needs areference box matrix from standard in.The output is the strain with time, relative to a reference boxh0. The reference box isprompted at the start of the program.
148
B.2. Analysis Programs
exam
f60.
fp
rog
ram
exa
m_
f60
imp
licit
no
ne
inte
ge
rn
_b
in_
x,n
_b
in_
y,n
_b
in_
zp
ara
me
ter
(n_
bin
_x=
4,
n_
bin
_y=
3,
n_
bin
_z=
4)
inte
ge
ri_
rela
x,n
_re
lax,
n_
ob
ser
inte
ge
ri_
dim
,j_
dim
,n
_d
im,
e_
dim
,iv
_d
im,
voi_
ind
pa
ram
ete
r(n
_d
im=
3,
e_
dim
=3
)d
ou
ble
pre
cisi
on
vol_
1co
mm
on
/cvo
l_1
/vo
l_1
do
ub
lep
reci
sion
x(8
),sc
al(n
_d
im+
e_
dim
),sc
al_
1(n
_d
im+
e_
dim
),&
sca
l_2
(n_
dim
+e
_d
im,
n_
dim
+e
_d
im),
tem
p,
y(1
0),
&p
ol_
tota
l(n
_d
im),
po
l_d
ipo
les(
n_
dim
),p
ol_
fluc(
n_
dim
,n_
dim
),&
po
l_a
vg(n
_d
im),
po
lstr
ain
(n_
dim
+e
_dim
,n_
dim
)d
ou
ble
pre
cisi
on
a,b
,c,d
a,d
b,d
c,re
dp
ol_
avg
(n_
dim
),re
dp
ol(n
_d
im)
do
ub
lep
reci
sion
h_
ma
t(3
,3),
h_
i(3
,3),
h1
(3,3
),h
1_
i(3
,3)
&,
h1
_i_
avg
_i(3
,3),
h1
_i_
avg
(3,3
)d
ou
ble
pre
cisi
on
h(3
,3),
h0
(3,3
),h
t(3
,3),
h0
i(3
,3),
h0
ti(3
,3),
&h
0t(
3,3
)d
ou
ble
pre
cisi
on
s1(3
,3),
s2(3
,3),
stra
inm
(3,3
),&
stra
in(6
),st
rain
_1
(6),
stre
ss(6
),p
ols
tre
ss(6
,3),
stre
ss_
1(6
)
write
(*,*
)"H
ow
ma
ny
ste
ps
tod
isca
rd?
"re
ad
(*,*
)n
_re
lax
write
(*,*
)"T
em
p."
rea
d(*
,*)
tem
p
!fir
stru
n do
i_d
im=
1,
n_
dim
red
po
l_a
vg(i_d
im)=
0.d
0d
oj_
dim
=1
,n
_d
imh
1_
i_a
vg(i_
dim
,j_d
im)
=0
.d0
en
dd
oe
nd
do
do
i_re
lax
=1
,n
_re
lax
rea
d(6
0,’(
36
e1
5.7
)’)
(x(i_
dim
),i_
dim
=1
,8
),&
(sca
l(j_
dim
),j_
dim
=1
,n
_d
im+
e_
dim
),(y
(i_
dim
),i_
dim
=1
,10),
&(p
ol_
tota
l(i_
dim
),i_
dim
=1
,3),
(pol_
dip
ole
s(i_
dim
),i_
dim
=1
,3),
&(s
tre
ss(i_
dim
),i_
dim
=1
,6)
en
dd
o
n_
ob
ser
=0
do
i_d
im=
1,
n_
dim
+e
_d
imsc
al_
1(i_
dim
)=
0.
en
dd
o
90
1co
ntin
ue
rea
d(6
0,’(
36
e1
5.7
)’,e
nd
=9
02
)(x
(i_
dim
),i_
dim
=1
,8
),&
(sca
l(j_
dim
),j_
dim
=1
,n
_d
im+
e_
dim
),(y
(i_
dim
),i_
dim
=1
,10),
&(p
ol_
tota
l(i_
dim
),i_
dim
=1
,3),
(pol_
dip
ole
s(i_
dim
),i_
dim
=1
,3),
&(s
tre
ss(i_
dim
),i_
dim
=1
,6)
n_
ob
ser
=n
_ob
ser
+1
call
tra
ns_
to_
ten
s(sc
al,
h_
ma
t)ca
llin
v_m
at(
h_
ma
t,h
_i)
do
i_d
im=
1,
n_
dim
+e
_d
im
sca
l_1
(i_
dim
)=
sca
l_1
(i_
dim
)+
sca
l(i_
dim
)e
nd
do
call
tra
ns_
to_
ten
s(sc
al,
h1
)ca
llin
v_m
at(
h1
,h
1_
i)
do
i_d
im=
1,
n_
dim
po
l_to
tal(i_
dim
)=
po
l_to
tal(i_
dim
)-
po
l_d
ipo
les(
i_d
im)
!u
nco
mm
en
tfo
llow
ing
line
toco
nsi
de
ro
nly
po
lariza
tion
du
eto
dip
ole
s:!
po
l_to
tal(i_
dim
)=
po
l_dip
ole
s(i_
dim
)e
nd
do
do
i_d
im=
1,
n_
dim
do
j_d
im=
1,
n_
dim
h1
_i_
avg
(i_d
im,j_
dim
)=
&h1
_i_
avg
(i_
dim
,j_d
im)
+h1
_i(i_
dim
,j_d
im)
red
po
l_a
vg(i_
dim
)=re
dp
ol_
avg
(i_
dim
)+
h_
i(i_
dim
,j_d
im)
&*
po
l_to
tal(j_
dim
)e
nd
do
en
dd
o
go
to9
01
90
2co
ntin
ue
do
i_d
im=
1,
n_
dim
red
po
l_a
vg(i_
dim
)=re
dp
ol_
avg
(i_
dim
)/
n_
ob
ser
do
j_d
im=
1,
n_
dim
h1
_i_
avg
(i_
dim
,j_d
im)
=h
1_
i_a
vg(i_
dim
,j_d
im)
/n
_o
bse
re
nd
do
en
dd
o
do
i_d
im=
1,
n_
dim
+e
_d
imsc
al_
1(i_
dim
)=
sca
l_1
(i_
dim
)/
n_
ob
ser
en
dd
o
call
inv_
ma
t(h
1_
i_a
vg,
h1
_i_
avg
_i)
!ca
lcu
late
h0
,h
0ˆ-
1,
h0
’,h
0’ˆ-1
for
stra
inca
lltr
an
s_to
_te
ns(
sca
l_1
,h0
)w
rite
(*,*
)"h
0",
h0
(1,1
),h
0(2
,2),
h0(3
,3),
h0
(1,2
),h
0(2
,3),
h0(1
,3)
call
inv_
ma
t(h
0,h
0i)
call
tra
ns_
ma
t(h
0,h
0t)
call
inv_
ma
t(h
0t,h
0ti)
write
(*,*
)"h
0ti"
,h
0ti(
1,1
),h
0ti(
2,2
),h
0ti(
3,3
)
clo
se(6
0)
!se
con
dru
n
do
i_re
lax
=1
,n
_re
lax
rea
d(6
0,’(
36
e15
.7)’)
(x(i_
dim
),i_
dim
=1,
8),
&(s
cal(j_
dim
),j_
dim
=1
,n
_d
im+
e_
dim
),(y
(i_
dim
),i_
dim
=1
,10
),&
(po
l_to
tal(i_
dim
),i_
dim
=1
,3),
(po
l_d
ipo
les(
i_d
im),
i_d
im=
1,3
),&
(str
ess
(i_
dim
),i_
dim
=1
,6)
en
dd
o
n_
ob
ser
=0
do
i_d
im=
1,
n_
dim
+e
_d
imsc
al_
1(i_
dim
)=
0.
stra
in_
1(i_
dim
)=
0.
stre
ss_
1(i_
dim
)=
0.
149
B. Programsd
oj_
dim
=1,
n_
dim
+e
_d
imsc
al_
2(i_
dim
,j_d
im)
=0
.e
nd
do
en
dd
od
oj_
dim
=1
,n
_d
imp
ol_
avg
(j_
dim
)=0
.d
oi_
dim
=1
,6p
ols
tra
in(i_
dim
,j_d
im)=
0.
po
lstr
ess
(i_
dim
,j_d
im)=
0.
en
dd
od
oi_
dim
=1
,3p
ol_
fluc(
i_d
im,j_
dim
)=0
.e
nd
do
en
dd
o
10
0co
ntin
ue
rea
d(6
0,’(
36
e15
.7)’,e
nd
=2
00
)(x
(i_
dim
),i_
dim
=1
,8
),&
(sca
l(j_
dim
),j_
dim
=1
,n
_d
im+
e_
dim
),(y
(i_
dim
),i_
dim
=1
,10
),&
(po
l_to
tal(i_
dim
),i_
dim
=1
,3),
(po
l_d
ipo
les(
i_d
im),
i_d
im=
1,3
),&
(str
ess
(i_
dim
),i_
dim
=1
,6
)n
_o
bse
r=
n_
obse
r+
1d
oi_
dim
=1
,n
_d
im+
e_
dim
sca
l_1
(i_
dim
)=
sca
l_1
(i_
dim
)+
sca
l(i_
dim
)d
oj_
dim
=1,
n_
dim
+e
_d
imsc
al_
2(i_
dim
,j_d
im)
=sc
al_
2(i_
dim
,j_d
im)
+&
sca
l(i_
dim
)*
sca
l(j_
dim
)e
nd
do
en
dd
o
call
tra
ns_
to_te
ns(
sca
l,h
_m
at)
call
inv_
ma
t(h_
ma
t,h
_i)
do
i_d
im=
1,
n_
dim
po
l_to
tal(i_
dim
)=
po
l_to
tal(i_
dim
)-
po
l_d
ipo
les(
i_d
im)
!u
nco
mm
en
tfo
llow
ing
line
toco
nsi
de
ro
nly
po
lariza
tion
du
eto
dip
ole
s:!
po
l_to
tal(i_
dim
)=
po
l_dip
ole
s(i_
dim
)e
nd
do
do
i_d
im=
1,
n_
dim
red
po
l(i_
dim
)=
0.
do
j_d
im=
1,
n_
dim
iv_
dim
=vo
i_in
d(i_
dim
,j_d
im)
red
po
l(i_
dim
)=
red
po
l(i_
dim
)+
h_
i(i_
dim
,j_d
im)
*&
po
l_to
tal(j_
dim
)e
nd
do
en
dd
o
do
i_d
im=
1,
n_
dim
po
l_to
tal(i_
dim
)=
0.
do
j_d
im=
1,
n_
dim
po
l_to
tal(i_
dim
)=
po
l_to
tal(i_
dim
)&
+h
1_
i_a
vg_
i(i_
dim
,j_d
im)
*&
(re
dp
ol(j_
dim
)-
red
po
l_avg
(j_
dim
))e
nd
do
!co
mm
en
tou
tfo
llow
ing
line
toco
nsi
de
ro
nly
po
lariza
tion
du
eto
cha
rge
s:p
ol_
tota
l(i_
dim
)=
po
l_to
tal(i_
dim
)+
po
l_d
ipo
les(
i_d
im)
en
dd
o
do
i_d
im=
1,
n_
dim
po
l_a
vg(i_
dim
)=
po
l_a
vg(i_
dim
)+
po
l_to
tal(i_
dim
)e
nd
do
do
i_d
im=
1,
n_
dim
do
j_d
im=
1,
n_d
imp
ol_
fluc(
i_d
im,j_
dim
)=
po
l_flu
c(i_
dim
,j_d
im)
+&
po
l_to
tal(i_
dim
)*p
ol_
tota
l(j_
dim
)e
nd
do
en
dd
o
call
tra
ns_
to_
ten
s(sc
al,h
)ca
lltr
an
s_m
at(
h,h
t)ca
llm
ult_
mat(
h,h
0i,s
1)
call
mu
lt_m
at(
ht,s1
,s2
)ca
llm
ult_
mat(
h0
ti,s2
,str
ain
m)
do
i_d
im=
1,3
do
j_d
im=
1,3
if(i_
dim
.eq
.j_d
im)
&st
rain
m(i_
dim
,j_d
im)
=st
rain
m(i_
dim
,j_d
im)
-1.d
0st
rain
m(i_
dim
,j_d
im)
=0
.5d
0*
stra
inm
(i_
dim
,j_d
im)
en
dd
oe
nd
do
call
tra
ns_
to_
voig
t(st
rain
m,s
tra
in)
do
i_d
im=
1,
6st
rain
_1
(i_
dim
)=
stra
in_
1(i_
dim
)+
stra
in(i_
dim
)st
ress
_1
(i_
dim
)=
stre
ss_
1(i_
dim
)+
stre
ss(i_
dim
)e
nd
do
write
(44
,’(7f1
5.5
)’)
x(1
),(s
tra
in(i_
dim
),i_
dim
=1
,6)
do
i_d
im=
1,
6d
oj_
dim
=1
,3
po
lstr
ain
(i_
dim
,j_d
im)
=p
ols
tra
in(i_d
im,j_
dim
)+
&st
rain
(i_
dim
)*
po
l_to
tal(j_
dim
)p
ols
tre
ss(i_
dim
,j_d
im)
=p
ols
tre
ss(i_d
im,j_
dim
)+
&st
ress
(i_
dim
)*
po
l_to
tal(j_
dim
)e
nd
do
en
dd
og
oto
10
02
00
con
tinu
e
write
(*,*
)"O
bs.
Ste
ps"
,n
_o
bse
rd
oi_
dim
=1
,n
_d
im+
e_
dim
sca
l_1
(i_
dim
)=
sca
l_1
(i_
dim
)/
n_
obse
rst
rain
_1
(i_
dim
)=
stra
in_
1(i_
dim
)/
n_
ob
ser
stre
ss_
1(i_
dim
)=
stre
ss_
1(i_
dim
)/
n_
ob
ser
en
dd
ow
rite
(*,*
)"s
tra
in_
1",
(str
ain
_1
(i_
dim
),i_
dim
=1
,n_
dim
)w
rite
(*,*
)"s
tre
ss_
1",
(str
ess
_1
(i_
dim
),i_
dim
=1
,n_
dim
)
do
i_d
im=
1,
n_
dim
po
l_a
vg(i_
dim
)=
po
l_a
vg(i_
dim
)/
n_
ob
ser
en
dd
o
do
i_d
im=
1,
n_
dim
do
j_d
im=
1,
n_
dim
po
l_flu
c(i_
dim
,j_d
im)
=p
ol_
fluc(
i_d
im,j_
dim
)/
n_
ob
ser
po
l_flu
c(i_
dim
,j_d
im)
=(p
ol_
fluc(
i_dim
,j_d
im)
-&
pol_
avg
(i_
dim
)*p
ol_
avg
(j_
dim
))e
nd
do
en
dd
o
150
B.2. Analysis Programs
do
i_d
im=
1,
6d
oj_
dim
=1
,3p
ols
tra
in(i_d
im,j_
dim
)=p
ols
tra
in(i_
dim
,j_d
im)
/n
_o
bse
rp
ols
tra
in(i_d
im,j_
dim
)=(p
ols
tra
in(i_d
im,j_
dim
)-
&st
rain
_1
(i_
dim
)*p
ol_
avg
(j_
dim
))p
ols
tre
ss(i_d
im,j_
dim
)=p
ols
tre
ss(i_
dim
,j_d
im)
/n
_o
bse
rp
ols
tre
ss(i_d
im,j_
dim
)=(p
ols
tre
ss(i_d
im,j_
dim
)-
&st
ress
_1
(i_
dim
)*p
ol_
avg
(j_
dim
))e
nd
do
en
dd
o
do
i_d
im=
1,
n_
Dim
+e
_d
imd
oj_
dim
=1
,n
_d
im+
e_
dim
sca
l_2
(i_
dim
,j_d
im)
=sc
al_
2(i_
dim
,j_d
im)
/n
_o
bse
rsc
al_
2(i_
dim
,j_d
im)
=(
sca
l_2
(i_
dim
,j_d
im)
-&
sca
l_1
(i_d
im)
*sc
al_
1(j_
dim
))
en
dd
oe
nd
do
call
calc
_vo
l(sc
al_
1,v
ol_
1)
call
pie
zo_
coe
ff(p
ol_
avg
,sca
l_2
,sca
l_1
,te
mp
,po
lstr
ain
,po
lstr
ess
)ca
lld
iele
ctric_
con
st(p
ol_
fluc,
po
l_a
vg,s
cal_
2,s
cal_
1,te
mp
)
write
(*,*
)"A
vg.
Po
lariza
tion
"d
oi_
dim
=1
,3
write
(*,*
)p
ol_
avg
(i_
dim
)/vo
l_1
,"+
-",
&sq
rt(p
ol_
fluc(
i_d
im,i_
dim
))/v
ol_
1e
nd
do
write
(*,*
)"A
vg.
Sca
l.V
aria
b."
do
i_d
im=
1,
n_
dim
+e
_d
imw
rite
(*,’(
f15
.9a
f15
.9)’)
sca
l_1
(i_
dim
),"
+-"
,&
sqrt
(sca
l_2
(i_
dim
,i_d
im))
en
dd
oa
=sc
al_
1(1
)/n
_bin
_x
b=
sca
l_1
(2)/
sqrt
(3.)
/n_
bin
_y
c=sc
al_
1(3
)/n
_bin
_z
da
=sq
rt(s
cal_
2(1
,1))
/n_
bin
_x
db
=sq
rt(s
cal_
2(2
,2))
/sq
rt(3
.)/n
_b
in_
yd
c=sq
rt(s
cal_
2(3
,3))
/n_
bin
_z
write
(*,*
)"a
",a
,"+
-",
da
write
(*,*
)"b
",b
,"+
-",
db
write
(*,*
)"c
",c,
"+
-",
dc
write
(*,*
)"c
/a",
1.
/(s
qrt
(a*b
)/
c),"
+-
",sq
rt(
&(.
25
*((d
a/a
)**2
+(d
b/b
)**2
)+
dc*
*2)/
(a*b
))w
rite
(*,*
)"v
ol
",sq
rt(3
.)/2
*a*b
*c,"
+-
",sq
rt(.
75
*&
((d
a*b
*c)*
*2+
(a*d
b*c
)**2
+(a
*b*d
c)**
2))
write
(*,’(
af1
5.9
af1
5.9
af1
5.9
af1
5.9
af1
5.9
af1
5.9
a)’)
&"h
={"
,sca
l_1
(1),
",",
sca
l_1
(2),
",",
&sc
al_
1(3
),",
",sc
al_
1(4
),",
",sc
al_
1(5
),",
",sc
al_
1(6
),"}
"w
rite
(*,’(
af1
5.9
af1
5.9
af1
5.9
af1
5.9
af1
5.9
af1
5.9
a)’)
&"d
h=
{",s
qrt
(sca
l_2
(1,1
)),"
,",s
qrt
(sca
l_2
(2,2
)),"
,"&
,sq
rt(s
cal_
2(3
,3))
,","
,sq
rt(s
cal_
2(4
,4))
,","
,&
sqrt
(sca
l_2
(5,5
)),"
,",s
qrt
(sca
l_2
(6,6
)),"
}"w
rite
(*,’(
af1
5.9
af1
5.9
af1
5.9
af1
5.9
af1
5.9
af1
5.9
a)’)
&"P
={"
,po
l_a
vg(1
)/vo
l_1
,","
,pol_
avg
(2)/
vol_
1,"
,",
&p
ol_
avg
(3)/
vol_
1,"
}"w
rite
(*,’(
af1
5.9
af1
5.9
af1
5.9
af1
5.9
af1
5.9
af1
5.9
a)’)
&"d
P=
{",s
qrt
(po
l_flu
c(1
,1))
/vol_
1,"
,",
&sq
rt(p
ol_
fluc(
2,2
)/vo
l_1
),",
",sq
rt(p
ol_
fluc(
3,3
)/vo
l_1
),"}
"
write
(*,*
)"A
vg.
Flu
c.T
en
s."
do
i_d
im=
1,
n_
Dim
+e
_d
imd
oj_
dim
=1
,n
_d
im+
e_
dim
sca
l_2
(i_
dim
,j_d
im)
=sc
al_
2(i_
dim
,j_d
im)
/te
mp
en
dd
ow
rite
(*,’(
6e
13
.5)’)
&(
sca
l_2
(i_
dim
,j_d
im),
j_d
im=
1,
n_
dim
+e
_d
im)
en
dd
o
call
calc
_st
rain
(sca
l_2
,sc
al_
1)
call
calc
_e
lco
(sca
l_2
,sc
al_
1)
en
dp
rog
ram
!!
!!
!!
!!
!
sub
rou
tine
calc
_vo
l(sc
al_
1,v
ol_
1)
do
ub
lep
reci
sio
nsc
al_
1,
vol_
1,
h_
ma
t(3
,3)
call
tra
ns_
to_
ten
s(sc
al_
1,
h_
ma
t)vo
l_1
=d
ete
rm(h
_m
at)
en
dsu
bro
utin
e
!!
!!
!!
!!
!
sub
rou
tine
die
lect
ric_
con
st(p
ol_
fluc,
po
l_a
vg,
sca
l_2
,sca
l_1
,te
mp
)in
teg
er
i_d
im,
j_d
im,
n_
dim
,e
_d
im,
iv_
dim
,vo
i_in
din
teg
er
k_d
im,
l_d
im,
ij_d
im,
kl_
dim
pa
ram
ete
r(n
_d
im=
3,
e_
dim
=3
)d
ou
ble
pre
cisi
on
po
l_flu
c(n
_d
im,n
_d
im),
dk(
n_
dim
+e
_d
im)
do
ub
lep
reci
sio
nvo
l_1
,r_
du
mm
y,p
ol_
avg
(n_
dim
),te
mp
do
ub
lep
reci
sio
np
olc
orr
ect
(n_
dim
,n_
dim
),sm
at(
6,6
),&
sca
l_1
(n_
dim
+e
_d
im),
sca
l_2
(n_d
im+
e_
dim
,n
_d
im+
e_
dim
)co
mm
on
/cvo
l_1
/vo
l_1
call
calc
_sm
at(
sca
l_2
,sc
al_
1,
sma
t)
do
i_d
im=
1,
n_
dim
do
k_d
im=
1,
n_
dim
po
lco
rre
ct(i_
dim
,k_
dim
)=
0.
do
j_d
im=
1,
n_
dim
do
l_d
im=
1,
n_
dim
ij_d
im=
voi_
ind
(i_
dim
,j_d
im)
kl_
dim
=vo
i_in
d(k
_d
im,l_
dim
)p
olc
orr
ect
(i_
dim
,k_
dim
)=
po
lco
rre
ct(i_
dim
,k_
dim
)+
&sm
at(
ij_d
im,
kl_
dim
)*
po
l_a
vg(j_
dim
)*
po
l_a
vg(l_
dim
)e
nd
do
en
dd
oe
nd
do
en
dd
o
do
i_d
im=
1,
n_
dim
write
(*,*
)(p
olc
orr
ect
(i_
dim
,k_
dim
),k_
dim
=1
,3)
en
dd
o
write
(*,*
)"d
k_ij"
151
B. Programsd
oi_
dim
=1,
n_
dim
do
j_d
im=
1,
n_
dim
iv_
dim
=vo
i_in
d(i_
dim
,j_d
im)
!(a
ng
stro
m*
e)*
*2/(
ep
silo
n0
an
gst
rom
**3
kBK
)=
20
99
84
1d
k(iv
_d
im)
=(p
ol_
fluc(
i_d
im,
j_d
im))
&*2
09
98
41
/vo
l_1
/te
mp
write
(*,*
)i_
dim
,j_
dim
,(p
ol_
fluc(
i_d
im,
j_d
im)
&-p
olc
orr
ect
(i_
dim
,j_
dim
))&
*20
998
41
/vo
l_1
/te
mp
if(iv_
dim
.le.3
)d
k(iv
_d
im)
=d
k(iv
_d
im)
+1
en
dd
oe
nd
do
write
(*,*
)"A
vg.
die
lect
ric
con
sta
nt"
write
(*,’(
6f1
3.5
)’)
(dk(
iv_
dim
),iv
_d
im=
1,
6)
en
dsu
bro
utin
e
!!
!!
!!
!!
!
sub
rou
tine
pie
zo_
coe
ff(t
em
p,p
ols
tra
in,
po
lstr
ess
)in
teg
er
j_d
im,
k_d
imp
ara
me
ter
(n_
dim
=3
,e
_d
im=
3)
do
ub
lep
reci
sio
np
ols
tra
in(n
_d
im+
e_
dim
,n_
dim
),&
tem
p,
pols
tre
ss(6
,3)
write
(*,*
)"A
vg.
pie
zoe
lect
ric
stre
ssC
oe
ffic
ien
ts[C
b/m
ˆ2]"
do
k_d
im=
1,3
write
(*,’(
6f1
3.5
)’)
&(p
ols
tre
ss(j_
dim
,k_
dim
)*1
6.0
21
77
/te
mp
,j_d
im=
1,6
)e
nd
do
write
(*,*
)"A
vg.
pie
zoe
lect
ric
stra
inC
oe
ffic
ien
ts[1
0ˆ-
12
m/V
]"d
ok_
dim
=1
,3w
rite
(*,’(
6f1
3.5
)’)
&(p
ols
tra
in(j_
dim
,k_
dim
)*1
.16
04
5d
-6*1
.d1
2/
tem
p,j_
dim
=1,6
)e
nd
do
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
calc
_st
rain
(sca
l_2
,sc
al_
1)
imp
licit
no
ne
inte
ge
ri_
dim
,j_
dim
,k_
dim
,l_
dim
,n
_d
im,
jv_
dim
,iv
_d
im,
&a
_d
im,
voi_
ind
pa
ram
ete
r(n
_d
im=
3)
do
ub
lep
reci
sio
nsc
al_
2(6
,6),
h_
ma
t(3
,3),
sca
l_1
(6),
&h
_i(3
,3),
stra
in(6
),s_
2(3
,3,3
,3)
call
tra
ns_
to_
ten
s(sc
al_
1,
h_
ma
t)ca
llin
v_m
at(
h_
ma
t,h
_i)
do
i_d
im=
1,
n_
dim
do
j_d
im=
1,
n_
dim
iv_
dim
=vo
i_in
d(i_
dim
,j_d
im)
do
k_d
im=
1,
n_
dim
do
l_d
im=
1,
n_
dim
jv_
dim
=vo
i_in
d(k
_d
im,l_
dim
)s_
2(i_
dim
,j_
dim
,k_
dim
,l_
dim
)=
scal_
2(iv_
dim
,jv_
dim
)e
nd
do
en
dd
oe
nd
do
en
dd
o
do
i_d
im=
1,
n_
dim
do
j_d
im=
1,
n_
dim
iv_
dim
=vo
i_in
d(i_
dim
,j_d
im)
stra
in(iv_
dim
)=
0.
do
a_
dim
=1,
n_
dim
stra
in(iv_
dim
)=
stra
in(iv_
dim
)+
(&
sqrt
(s_
2(i_
dim
,a_
dim
,i_d
im,a
_d
im))
*h_
i(a
_d
im,j_
dim
)+
&sq
rt(s
_2(a
_d
im,i_
dim
,a_
dim
,i_d
im))
*h_
i(j_
dim
,a_
dim
))/2
.e
nd
do
en
dd
oe
nd
do
write
(*,*
)"s
tra
in"
write
(*,’(
6e
19.1
1)’)
(str
ain
(iv_
dim
),iv
_d
im=
1,6
)
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
tran
s_to
_vo
igt(
ma
trix
,ve
ctor)
imp
licit
no
ne
do
ub
lep
reci
sio
nm
atr
ix(3
,3),
vect
or(
6)
vect
or(
1)
=m
atr
ix(1
,1)
vect
or(
2)
=m
atr
ix(2
,2)
vect
or(
3)
=m
atr
ix(3
,3)
vect
or(
4)
=2
*m
atr
ix(1
,2)
vect
or(
5)
=2
*m
atr
ix(2
,3)
vect
or(
6)
=2
*m
atr
ix(3
,1)
en
dsu
bro
utin
e
!!
!!
!!
!!
!
sub
rou
tine
tran
s_to
_te
ns(
vect
or,
ma
trix
)im
plic
itn
on
ed
ou
ble
pre
cisi
on
ma
trix
(3,3
),ve
cto
r(6)
ma
trix
(1,1
)=
vect
or(
1)
ma
trix
(2,2
)=
vect
or(
2)
ma
trix
(3,3
)=
vect
or(
3)
ma
trix
(1,2
)=
vect
or(
4)
ma
trix
(2,1
)=
vect
or(
4)
ma
trix
(2,3
)=
vect
or(
5)
ma
trix
(3,2
)=
vect
or(
5)
ma
trix
(3,1
)=
vect
or(
6)
ma
trix
(1,3
)=
vect
or(
6)
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
inv_
ma
t(m
at,m
at_
inv)
imp
licit
no
ne
inte
ge
ri_
dim
,j_
dim
,si
gn
do
ub
lep
reci
sio
nm
at(
3,3
),m
at_
inv(
3,3
),d
et_
ma
tre
al
de
term
do
ub
lep
reci
sio
nvo
l_1
com
mo
n/c
vol_
1/
vol_
1
152
B.2. Analysis Programs
de
t_m
at
=d
ete
rm(m
at)
vol_
1=
de
t_m
at
do
i_d
im=
1,
3d
oj_
dim
=1
,3
ma
t_in
v(i_
dim
,j_d
im)
=0
.d0
en
dd
oe
nd
do
ma
t_in
v(1
,1)
=m
at(
2,2
)*m
at(
3,3
)-
ma
t(2
,3)*
*2m
at_
inv(
2,2
)=
ma
t(3
,3)*
ma
t(1
,1)
-m
at(
3,1
)**2
ma
t_in
v(3
,3)
=m
at(
1,1
)*m
at(
2,2
)-
ma
t(1
,2)*
*2m
at_
inv(
1,2
)=
-(m
at(
2,1
)*m
at(
3,3
)-
ma
t(2
,3)*
ma
t(3
,1))
ma
t_in
v(2
,3)
=-
(ma
t(3
,2)*
ma
t(1
,1)
-m
at(
3,1
)*m
at(
1,2
))m
at_
inv(
1,3
)=
+(m
at(
1,2
)*m
at(
2,3
)-
ma
t(1
,3)*
ma
t(2
,2))
do
i_d
im=
1,
3d
oj_
dim
=i_
dim
,3
ma
t_in
v(i_
dim
,j_d
im)
=m
at_
inv(
i_d
im,j_
dim
)/
de
t_m
at
ma
t_in
v(j_
dim
,i_d
im)
=m
at_
inv(
i_d
im,j_
dim
)e
nd
do
en
dd
o
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
tra
ns_
ma
t(m
at,m
at_
tra
ns)
imp
licit
no
ne
inte
ge
ri_
dim
,j_
dim
do
ub
lep
reci
sion
ma
t(3
,3),
ma
t_tr
an
s(3
,3)
do
i_d
im=
1,
3d
oj_
dim
=1
,3m
at_
tra
ns(
i_d
im,j_
dim
)=m
at(
j_d
im,i_
dim
)e
nd
do
en
dd
o
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
rea
lfu
nct
ion
de
term
(ma
t)im
plic
itn
on
ed
ou
ble
pre
cisi
on
ma
t(3
,3)
de
term
=m
at(
1,1
)*m
at(
2,2
)*m
at(
3,3
)+
2*m
at(
1,2
)*m
at(
2,3
)*m
at(
3,1
)&
-ma
t(1
,1)*
ma
t(2
,3)*
*2-m
at(
2,2
)*m
at(
3,1
)**2
-ma
t(3
,3)*
ma
t(1,2
)**2
en
dfu
nct
ion
!!
!!
!!
!!
!!
!
sub
rou
tine
mu
lt_m
at(
ma
t1,m
at2
,mu
lt)im
plic
itn
on
ein
teg
er
i_d
im,
j_d
im,
k_d
imd
ou
ble
pre
cisi
on
ma
t1(3
,3),
ma
t2(3
,3),
mu
lt(3
,3)
do
i_d
im=
1,
3d
oj_
dim
=1
,3m
ult(
i_d
im,j_
dim
)=0
.d0
do
k_d
im=
1,3
mu
lt(i_
dim
,j_dim
)=
mu
lt(i_
dim
,j_d
im)
&+
ma
t1(i_
dim
,k_
dim
)*
ma
t2(k
_d
im,j_
dim
)
en
dd
oe
nd
do
en
dd
o
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
sub
rou
tine
calc
_e
lco
(sca
l_2
,sc
al_
1)
imp
licit
no
ne
inte
ge
ri_
dim
,j_
dim
,k_
dim
,l_
dim
,m
_d
im,
n_
dim
pa
ram
ete
r(n
_d
im=
3)
do
ub
lep
reci
sio
nsc
al_
2(6
,6),
h_
1(6
,6),
sca
l_1
(6),
s_2
(6,6
,6,6
)d
ou
ble
pre
cisi
on
vol_
1,
rot_
6(6
,6),
eig
_6
(6,6
),sm
at(
6,6
)co
mm
on
/cvo
l_1
/vo
l_1
rea
lc_
11
,c_
12
,c_
13
,c_
14
,c_
33
,c_
44
,c_
66
call
calc
_sm
at(
sca
l_2
,sc
al_
1,
sma
t)w
rite
(*,*
)"s
_m
atr
ix"
do
i_d
im=
1,
6d
oj_
dim
=1
,6
sca
l_2
(i_
dim
,j_d
im)
=vo
l_1
*sm
at(
i_d
im,j_
dim
)e
nd
do
write
(*,’(
6e
13.5
)’)
(sca
l_2
(i_
dim
,j_d
im),
j_d
im=
1,6
)e
nd
do
call
ga
uss
j(sc
al_
2)
write
(*,*
)"E
l.C
on
st.
inG
Pa
"d
oi_
dim
=1,
6d
oj_
dim
=1
,6
if(i_
dim
.gt.3
)sc
al_
2(i_
dim
,j_d
im)
=sc
al_
2(i_
dim
,j_d
im)
/2
if(j_
dim
.gt.3
)sc
al_
2(i_
dim
,j_d
im)
=sc
al_
2(i_
dim
,j_d
im)
/2
en
dd
ow
rite
(*,’(
6e
13.5
)’)
(sca
l_2
(i_
dim
,j_d
im)/
72
.43
,j_d
im=
1,6
)e
nd
do
write
(*,*
)"#
c_1
1,
c_1
2,
c_1
3,
c_1
4,
c_3
3,
c_4
4,
c_6
6&
(Q
ua
rtz
)"
c_1
1=
(sc
al_
2(1
,1)
+sc
al_
2(2
,2)
)/
72
.43
/2
c_1
2=
sca
l_2
(1,2
)/
72
.43
c_1
3=
(sc
al_
2(1
,3)
+sc
al_
2(2
,3)
)/
72
.43
/2
c_1
4=
(sc
al_
2(1
,5)
-sc
al_
2(2
,5)
+sc
al_
2(4
,6)
)/
72
.43
/3
c_3
3=
sca
l_2
(3,3
)/
72
.43
c_4
4=
(sc
al_
2(5
,5)
+sc
al_
2(6
,6)
)/
72
.43
/2
c_6
6=
sca
l_2
(4,4
)/
72
.43
write
(*,"
(7f7
.1)"
)c_
11
,c_
12
,c_
13
,c_
14
,c_
33
,c_
44
,c_
66
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
calc
_sm
at(
sca
l_2
,sc
al_
1,
sma
t)im
plic
itn
one
inte
ge
ri_
dim
,j_
dim
,k_
dim
,l_
dim
,n_
dim
,iv
_d
im,
jv_
dim
,&
voi_
ind
,a
_d
im,
b_
dim
pa
ram
ete
r(n
_d
im=
3)
do
ub
lep
reci
sio
ntk
,sc
al_
2(6
,6),
h_
ma
t(3
,3),
sca
l_1
(6),
&s_
2(3
,3,3
,3),
h_
i(3
,3),
e_
2(3
,3,3
,3),
sma
t(6
,6)
call
tra
ns_
to_
ten
s(sc
al_
1,
h_
ma
t)ca
llin
v_m
at(
h_
ma
t,h
_i)
do
i_d
im=
1,
n_
dim
do
j_d
im=
1,
n_
dim
153
B. Programsiv
_d
im=
voi_
ind
(i_
dim
,j_d
im)
do
k_d
im=
1,
n_
dim
do
l_d
im=
1,
n_
dim
jv_
dim
=vo
i_in
d(k
_d
im,l_
dim
)s_
2(i_
dim
,j_
dim
,k_
dim
,l_
dim
)=
scal_
2(iv_
dim
,jv_
dim
)e
nd
do
en
dd
oe
nd
do
en
dd
o
do
i_d
im=
1,
n_
dim
do
j_d
im=
1,
n_
dim
do
k_d
im=
1,
n_
dim
do
l_d
im=
1,
n_
dim
e_
2(i_
dim
,j_
dim
,k_
dim
,l_
dim
)=
0.
do
a_
dim
=1
,n
_d
imd
ob
_d
im=
1,
n_
dim
e_
2(i_
dim
,j_d
im,k
_d
im,l_
dim
)=
&e
_2
(i_
dim
,j_d
im,k
_d
im,l_
dim
)+
&s_
2(i_
dim
,a_
dim
,b_
dim
,l_d
im)*
h_
i(a
_d
im,j_
dim
)*h
_i(b
_d
im,k
_d
im)
+&
s_2
(i_
dim
,a_
dim
,k_
dim
,b_
dim
)*h
_i(a
_d
im,j_
dim
)*h
_i(b
_d
im,l_
dim
)+
&s_
2(a
_d
im,j_
dim
,b_
dim
,l_d
im)*
h_
i(a
_d
im,i_
dim
)*h
_i(b
_d
im,k
_d
im)
+&
s_2
(a_
dim
,j_d
im,k
_d
im,b
_d
im)*
h_
i(a
_d
im,i_
dim
)*h
_i(b
_d
im,l_
dim
)e
nd
do
en
dd
oe
_2
(i_
dim
,j_
dim
,k_
dim
,l_
dim
)=
&e
_2
(i_
dim
,j_
dim
,k_
dim
,l_
dim
)/
4e
nd
do
en
dd
oe
nd
do
en
dd
o
do
i_d
im=
1,
n_
dim
do
j_d
im=
1,
n_
dim
iv_
dim
=vo
i_in
d(i_
dim
,j_d
im)
do
k_d
im=
1,
n_
dim
do
l_d
im=
1,
n_
dim
jv_
dim
=vo
i_in
d(k
_d
im,l_
dim
)sm
at(
iv_
dim
,jv_
dim
)=
e_
2(i_
dim
,j_
dim
,k_
dim
,l_
dim
)e
nd
do
en
dd
oe
nd
do
en
dd
o
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
inte
ge
rfu
nct
ion
voi_
ind
(i_
dim
,j_d
im)
inte
ge
ri_
dim
,j_
dim
if(i_
dim
.eq.j_
dim
)th
en
voi_
ind
=i_
dim
els
eif
(i_
dim
*j_
dim
.eq
.2)
the
nvo
i_in
d=
4e
lse
if(i_
dim
*j_
dim
.eq
.6)
the
nvo
i_in
d=
5e
lse
if(i_
dim
*j_
dim
.eq
.3)
the
nvo
i_in
d=
6e
lse
sto
P"I
nd
.in
voi_
ind
w.o
.se
nse
"e
nd
ife
nd
fun
ctio
n
calc
stra
in.f
pro
gra
mca
lcst
rain
imp
licit
no
ne
inte
ge
ri_
dim
,j_
dim
,n
_d
im,
e_
dim
pa
ram
ete
r(n
_dim
=3
,e
_d
im=
3)
do
ub
lep
reci
sio
nh
(3,3
),h
0(3
,3),
ht(
3,3
),h
0i(3
,3),
h0
ti(3
,3),
&h
0t(
3,3
)d
ou
ble
pre
cisi
on
s1(3
,3),
s2(3
,3),
stra
in(3
,3)
do
ub
lep
reci
sio
nx(
8),
sca
l(n
_d
im+
e_d
im),
y(1
0),
&p
ol_
tota
l(n
_d
im),
po
l_d
ipo
les(
n_
dim
)
write
(*,*
)"h
0(1
,1)
?"
rea
d(*
,*)
h0
(1,1
)w
rite
(*,*
)"h
0(2
,2)
?"
rea
d(*
,*)
h0
(2,2
)w
rite
(*,*
)"h
0(3
,3)
?"
rea
d(*
,*)
h0
(3,3
)w
rite
(*,*
)"h
0(1
,2)
?"
rea
d(*
,*)
h0
(1,2
)w
rite
(*,*
)"h
0(2
,3)
?"
rea
d(*
,*)
h0
(2,3
)w
rite
(*,*
)"h
0(1
,3)
?"
rea
d(*
,*)
h0
(1,3
)
h0
(2,1
)=
h0
(1,2
)h
0(3
,2)
=h
0(2
,3)
h0
(3,1
)=
h0
(1,3
)
call
inv_
ma
t(h0
,h0
i)ca
lltr
an
s_m
at(
h0
,h0
t)ca
llin
v_m
at(
h0
t,h
0ti)
10
0co
ntin
ue
rea
d(6
0,’(
30e
15
.7)’,e
nd
=2
00
)(x
(i_
dim
),i_
dim
=1
,8
),&
(sca
l(j_
dim
),j_
dim
=1
,n
_d
im+
e_
dim
),(y
(i_
dim
),i_
dim
=1
,10
),&
(po
l_to
tal(i_
dim
),i_
dim
=1
,3),
(po
l_d
ipo
les(
i_d
im),
i_d
im=
1,3
)
call
tra
ns_
to_
ten
s(sc
al,h
)ca
lltr
an
s_m
at(
h,h
t)ca
llm
ult_
mat(
h,h
0i,s
1)
call
mu
lt_m
at(
ht,s1
,s2
)ca
llm
ult_
mat(
h0
ti,s2
,str
ain
)
do
i_d
im=
1,3
do
j_d
im=
1,3
if(i_
dim
.eq
.j_d
im)
&st
rain
(i_
dim
,j_d
im)
=st
rain
(i_
dim
,j_d
im)
-1
.d0
stra
in(i_
dim
,j_d
im)
=0
.5d
0*
stra
in(i_
dim
,j_d
im)
en
dd
oe
nd
do
write
(59
,’(30
e1
5.7
)’)
x(1
),st
rain
(1,1
),st
rain
(2,2
),&
stra
in(3
,3),
stra
in(1
,2),
stra
in(2
,3),
stra
in(1
,3)
154
B.2. Analysis Programs
go
to1
00
20
0co
ntin
ue
en
dp
rog
ram
!!
!!
!!
!!
!
sub
rou
tine
tra
ns_
to_
ten
s(ve
cto
r,m
atr
ix)
imp
licit
no
ne
do
ub
lep
reci
sion
ma
trix
(3,3
),ve
cto
r(6
)m
atr
ix(1
,1)
=ve
cto
r(1
)m
atr
ix(2
,2)
=ve
cto
r(2
)m
atr
ix(3
,3)
=ve
cto
r(3
)m
atr
ix(1
,2)
=ve
cto
r(4
)m
atr
ix(2
,1)
=ve
cto
r(4
)m
atr
ix(2
,3)
=ve
cto
r(5
)m
atr
ix(3
,2)
=ve
cto
r(5
)m
atr
ix(3
,1)
=ve
cto
r(6
)m
atr
ix(1
,3)
=ve
cto
r(6
)e
nd
sub
rou
tine
!!
!!
!!
!!
!!
!
sub
rou
tine
tra
ns_
ma
t(m
at,m
at_
tra
ns)
imp
licit
no
ne
inte
ge
ri_
dim
,j_
dim
do
ub
lep
reci
sion
ma
t(3
,3),
ma
t_tr
an
s(3
,3)
do
i_d
im=
1,
3d
oj_
dim
=1
,3m
at_
tra
ns(
i_d
im,j_
dim
)=m
at(
j_d
im,i_
dim
)e
nd
do
en
dd
o
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
rea
lfu
nct
ion
de
term
(ma
t)im
plic
itn
on
ed
ou
ble
pre
cisi
on
ma
t(3
,3)
de
term
=m
at(
1,1
)*m
at(
2,2
)*m
at(
3,3
)+
2*m
at(
1,2
)*m
at(
2,3
)*m
at(
3,1
)&
-ma
t(1
,1)*
ma
t(2
,3)*
*2-m
at(
2,2
)*m
at(
3,1
)**2
-ma
t(3
,3)*
ma
t(1,2
)**2
en
dfu
nct
ion
!!
!!
!!
!!
!!
!
sub
rou
tine
mu
lt_m
at(
ma
t1,m
at2
,mu
lt)im
plic
itn
on
ein
teg
er
i_d
im,
j_d
im,
k_d
imd
ou
ble
pre
cisi
on
ma
t1(3
,3),
ma
t2(3
,3),
mu
lt(3
,3)
do
i_d
im=
1,
3d
oj_
dim
=1
,3m
ult(
i_d
im,j_
dim
)=0
.d0
do
k_d
im=
1,3
mu
lt(i_
dim
,j_dim
)=
mu
lt(i_
dim
,j_d
im)
&+
ma
t1(i_
dim
,k_
dim
)*
ma
t2(k
_d
im,j_
dim
)e
nd
do
en
dd
oe
nd
do
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
sub
rou
tine
inv_
ma
t(m
at,m
at_
inv)
imp
licit
no
ne
inte
ge
ri_
dim
,j_
dim
,si
gn
do
ub
lep
reci
sio
nm
at(
3,3
),m
at_
inv(
3,3
),d
et_
ma
tre
al
de
term
do
ub
lep
reci
sio
nvo
l_1
com
mo
n/c
vol_
1/
vol_
1
de
t_m
at
=d
ete
rm(m
at)
vol_
1=
de
t_m
at
do
i_d
im=
1,
3d
oj_
dim
=1,
3m
at_
inv(
i_d
im,j_
dim
)=
0.d
0e
nd
do
en
dd
om
at_
inv(
1,1
)=
ma
t(2
,2)*
ma
t(3
,3)
-m
at(
2,3
)**2
ma
t_in
v(2
,2)
=m
at(
3,3
)*m
at(
1,1
)-
mat(
3,1
)**2
ma
t_in
v(3
,3)
=m
at(
1,1
)*m
at(
2,2
)-
mat(
1,2
)**2
ma
t_in
v(1
,2)
=-
(ma
t(2
,1)*
ma
t(3
,3)
-m
at(
2,3
)*m
at(
3,1
))m
at_
inv(
2,3
)=
-(m
at(
3,2
)*m
at(
1,1
)-
ma
t(3
,1)*
ma
t(1
,2))
ma
t_in
v(1
,3)
=+
(ma
t(1
,2)*
ma
t(2
,3)
-m
at(
1,3
)*m
at(
2,2
))d
oi_
dim
=1,
3d
oj_
dim
=i_
dim
,3
ma
t_in
v(i_
dim
,j_d
im)
=m
at_
inv(
i_d
im,j_
dim
)/
de
t_m
at
ma
t_in
v(j_
dim
,i_d
im)
=m
at_
inv(
i_d
im,j_
dim
)e
nd
do
en
dd
o
en
dsu
bro
utin
e
!!
!!
!!
!!
!!
!
inte
ge
rfu
nct
ion
voi_
ind
(i_
dim
,j_d
im)
inte
ge
ri_
dim
,j_
dim
if(i_
dim
.eq.j_
dim
)th
en
voi_
ind
=i_
dim
els
eif
(i_
dim
*j_
dim
.eq
.2)
the
nvo
i_in
d=
4e
lse
if(i_
dim
*j_
dim
.eq
.6)
the
nvo
i_in
d=
5e
lse
if(i_
dim
*j_
dim
.eq
.3)
the
nvo
i_in
d=
6e
lse
sto
P"I
nd
.in
voi_
ind
w.o
.se
nse
"e
nd
ife
nd
fun
ctio
n
155
List of Figures
0.1. Phase diagram for the silica system.. . . . . . . . . . . . . . . . . . 3
1.1. Pair Correlation Function ofα-Quartz . . . . . . . . . . . . . . . . . 19
2.1. Averageβ-Quartz Structure. . . . . . . . . . . . . . . . . . . . . . . 242.2. Averageα-Quartz Structure. . . . . . . . . . . . . . . . . . . . . . . 242.3. Fourth-order cumulant for the fluctuating dipole potential. . . . . . . 262.4. Order parameter〈|Φ|〉 against Temperature for fluc-dipole. . . . . . 272.5. Fourth-order cumulant for the fluctuating charge potential. . . . . . . 282.6. Order parameter〈|Φ|〉 against Temperature for fluc-Q. . . . . . . . . 292.7. Radial distribution function at the Quartz Transition. . . . . . . . . . 302.8. Volume against Temperature at theα-β Transition . . . . . . . . . . . 312.9. c/a Ratio against Temperature at theα-β Transition . . . . . . . . . . 312.10.c/a Ratio against Temperature for fluc-Q. . . . . . . . . . . . . . . . 322.11. Order parameter against Temperature for fluc-dipole. . . . . . . . . . 332.12. Volume against Temperature for fluc-dipole. . . . . . . . . . . . . . 332.13.c/a Ratio in Quartz as a Function of Temperature. . . . . . . . . . . 342.14. O-Si-O bond angle against Temperature. . . . . . . . . . . . . . . . 352.15. Fourth Order Cumulant against Temperature. . . . . . . . . . . . . . 352.16. Definition of the atom numbering. . . . . . . . . . . . . . . . . . . . 362.17.c/a ratio in quartz as a function of the volume. . . . . . . . . . . . . 372.18. Models showing the formation ofπ orbitals in SiO4. . . . . . . . . . . 382.19. Correlation between bond distance and oxygen angle. . . . . . . . . 382.20. Average dipoles in theα- and theβ-quartz phase.. . . . . . . . . . . 392.21. Elastic constants. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412.22. Elastic constants. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422.23.α quartz: Phonon Density of States BKS. . . . . . . . . . . . . . . . 452.24.α quartz: Phonon Density of States fluc-charge. . . . . . . . . . . . 452.25.α quartz: Phonon Density of States fluc-dipole. . . . . . . . . . . . . 46
3.1. Snapshot of the Quartz II configuration. . . . . . . . . . . . . . . . . 483.2. Silicon Coordination in Quartz II. . . . . . . . . . . . . . . . . . . . 493.3. Pressure Driven Transition Path Ways in Quartz with fluc-Q. . . . . 503.4. Pressure Driven Transition Path Ways in Quartz with fluc-dipole. . . 51
157
List of Figures
3.5. Si-O Pair correlation around the Quartz II - Quartz II b transition. . . 523.6. Energy dispersive x-ray diffraction patterns of Quartz II. . . . . . . . 533.7. Comparison of X-Ray spectra at various pressures. . . . . . . . . . . 543.8. Interplanar spacing for the compression ofα-quartz . . . . . . . . . . 55
4.1. Time evolution of the volume in cristobalite. . . . . . . . . . . . . . 574.2. Time evolution of the volume in tridymite. . . . . . . . . . . . . . . 584.3. Snapshots of Tridymite. . . . . . . . . . . . . . . . . . . . . . . . . 584.4. Stishovite Equation of State. . . . . . . . . . . . . . . . . . . . . . . 594.5. c/a Ratio in Stishovite against Pressure. . . . . . . . . . . . . . . . . 604.6. Birch Coefficients of Stishovite against Pressure. . . . . . . . . . . . 614.7. Lattice Constantsa andb of Stishovite . . . . . . . . . . . . . . . . . 62
5.1. Illustration of the definition of the dipole. . . . . . . . . . . . . . . . 685.2. Comparison of piezo induced strain for different approaches. . . . . 705.3. Piezoelectrical strain coefficient against temperature. . . . . . . . . . 725.4. Distribution of the tilt angle in quartz. . . . . . . . . . . . . . . . . . 735.5. Pressure dependence ofα-quartz.. . . . . . . . . . . . . . . . . . . . 745.6. Relation between dipole and Si-O-Si angle. . . . . . . . . . . . . . . 755.7. Sketch of bond angle and dipole orientation. . . . . . . . . . . . . . 765.8. Relation between dipole orientation and absolute value. . . . . . . . 76
A.1. Sketch for Two Center Integrals. . . . . . . . . . . . . . . . . . . . 83
158
Bibliography
[1] M. P. Allen and D. J. Tildesley.Computer Simulation of Liquids. Oxford Sci-ence Publications, Oxford, 1987.
[2] D. Andrault, G. Fiquet, F. Guyot, and M. Hanfland.Science, 282:720, 1998.
[3] J. C. Axe and G. Shirane.Phys. Rev. B, 1:342, 1970.
[4] J. P. Bachheimer and G. Dolino.Phys. Rev. B, 11:3195, 1975.
[5] E. J. Banda, R. A. Craven, R. D. Parks, P. M. Horn, and M. Blume.Solid StateComm., 17:11, 1975.
[6] A. G. Beda.Soviet Physics - Solid State, 9:5, 1967.
[7] M. Benoit and W. Kob.Europhys. Lett., 60:269, 2002.
[8] K. Binder. Phys. Rev. Lett., 47:693, 1981.
[9] W. Bragg and R. E. Gibbs.Proc. Roy. Soc. London, A109:414, 1925.
[10] W. G. Cady.Piezoelectricity. Dover Publications, New York, 1964.
[11] R. Car and M. Parrinello.Phys. Rev. Lett., 55:2471, 1985.
[12] M. A. Carpenter, R. J. Hemley, and H. kwang Mao.J. Geophys. Res.,105:10807, 2000.
[13] M. A. Carpenter, E. K. H. Salje, A. Graeme-Barber, B. Wrucki, M. T. Dove,and K. S. Knight.Am. Mineral., 83:2, 1998.
[14] E. C. T. Chao, J. J. Fahey, J. Littler, and D. J. Milton.J. Geophys. Res., 67:419,1962.
[15] R. E. Cohen.Geophys. Res. Lett., 14:37, 1987.
[16] B. Coluzzi and P. Verrocchio.J. Chem. Phys., 116:3789, 2002.
[17] R. K. Cook and P. G. Weissler.Phys. Rev., 80:4, 1950.
159
Bibliography
[18] D. W. J. Cruickshank.J. chem. Soc., 1077:5486, 1961.
[19] E. Demiralp, 2001. private communication.
[20] E. Demiralp, T. Cagin, and W. A. Goddard III.Phys. Rev. Lett., 82:1708, 1999.
[21] T. Demuth, Y. Jeanvoine, J. Hafner, and J. G. Angyan.J. Phys.: Condens.Matter, 11:3833, 1999.
[22] G. Dolino, B. Berge, M. Vallade, and F. Moussa.J. de Physique I, 2:1461, 1992.
[23] W. A. Dollase.Acta Cryst., 23:617, 1967.
[24] M. T. Dove, D. A. Kreen, A. C. Hannon, and I. P. Swainson.Phys. Chem.Miner., 24:311, 1997.
[25] F. Ercolessi and J. B. Adams.Europhys. Lett., 26:583, 1994.
[26] P. P. Ewald.Ann. Phys., 64:253, 1921.
[27] P. W. Fowler and P. A. Madden.Phys. Rev. B, 31:5443, 1985.
[28] D. Frenkel and B. Smit.Understanding Molecular Simulation. Academic Press,London, 2nd edition, 2002.
[29] J. D. Gale.Phil. Mag. B, 73:3, 1996.
[30] J. D. Gale.J. Chem. Soc. Faraday Trans., 93:629, 1997.
[31] J. D. Gale.Mol. Simul., 29:291, 2003.
[32] F. Galeener.Phys. Rev. B, 19:4292, 1979.
[33] C. W. Gear. Numerical Initial Value Problems in ordinary Differential Equa-tions. Prentice Hall, Englewood Cliffs, NJ, 1971. Chap. 9.
[34] G. V. Gibbs, M. M. Hamil, S. J. Louisnathan, L. S. Bartell, and H. Yow.Amer.Mineral., 57:1578, 1972.
[35] H. Grimm and B. Dorner.J. Phys. Chem. Solids, 36:407, 1975.
[36] J. M. Haile.Molecular Dynamics Simulation: Elementary Methods. John Wileyand Sons, Inc., New York, wiley professional paperback series edition, 1997.
[37] J. Haines, O. Cambon, D. A. Keen, M. G. Tucker, and M. T. Dove.Appl. Phys.Lett., 81:2968, 2002.
160
Bibliography
[38] J. Haines, J. M. Leger, F. Gorelli, and M. Hanfland.Phys. Rev. Lett., 87:155503,2001.
[39] P. J. Heaney. Structure and chemistry of the low-pressure silica polymorphs. InP. J. Heaney, C. T. Prewitt, and G. V. Gibbs, editors,Silica - Physical Behaviour,Geochemistry, and Materials Applications, volume 29 ofRev. Mineral., page 1.Mineral. Soc. of Am., Washington D. C., 1994.
[40] R. H. Hemley, A. P. Jephcoat, H. K. Mao, L. C. Ming, and M. H. Manghnani.Nature, 334:52, 1988.
[41] R. J. Hemley. Pressure dependence of raman spectra in sio2 polymorphs:α-quartz, coesite, and stishovite. In M. H. Manghnani and Y. Syono, editors,HighPressure Research in Mineral Physics, volume 39 ofGeophys. Monogr. Ser.,page 347. AGU, Washington D. C., 1987.
[42] R. J. Hemley, M. D. Jackson, and R. G. Gordon.Eos Trans. AGU, 66:357, 1985.
[43] R. J. Hemley, C. T. Prewitt, and K. J. Kingma. High-pressure behaviour ofsilica. In P. J. Heaney, C. T. Prewitt, and G. V. Gibbs, editors,Silica - Phys-ical Behaviour, Geochemistry, and Materials Applications, volume 29 ofRev.Mineral., page 41. Mineral. Soc. of Am., Washington D. C., 1994.
[44] R. J. Hill and G. V. Gibbs.Acta Cryst., B35:25, 1979.
[45] U. T. Hochli and J. F. Scott.Phys. Rev. Lett., 26:1627, 1971.
[46] J. Horbach and W. Kob.Phys. Rev. B, 60:3169, 1999.
[47] J. B. Jones and E. R. Segnit.J. Geol. Soc. Australia, 18:419, 1972.
[48] P. Jund and R. Jullien.Phys. Rev. Lett., 83:2210, 1999.
[49] K. Kihara. Eur. J. Miner., 2:63, 1990.
[50] K. Kihara. Phys. Chem. Min., 19:492, 1993.
[51] K. J. Kingma, R. E. Cohen, R. J. Hemley, and H. K. Mao.Nature, 374:243,1995.
[52] K. J. Kingma, R. J. Hemley, H. K. Mao, and D. R. Veblen.Phys. Rev. Lett.,70:3927, 1993.
[53] K. J. Kingma, H. K. Mao, and R. J. Hemley.High Press. Res., 14:363, 1996.
[54] Klein and Hurlbut. Manual of Mineralogy, p. 527. John Wiley & Sons, 21stedition, 1962.
161
Bibliography
[55] M. B. Kruger and R. Jeanloz.Science, 249:647, 1990.
[56] D. J. Lacks and R. G. Gordon.J. Geophys. Res., 98:22147, 1993.
[57] A. Laio, S. Bernard, G. L. Chiarotti, S. Scandolo, and E. Tosatti.Science,287:1027, 2000.
[58] D. P. Landau and K. Binder, editors.A Guide to Monte Carlo Simulations inStatistical Physics. Cambridge University Press, Cambridge, 2000.
[59] S. J. Louisnathan and G. V. Gibbs.Amer. Mineral., 57:1614, 1972.
[60] M. H. M. Wilson, P. A. Madden and C. A. Angell.Phys. Rev. Lett., 77:4023,1996.
[61] C. H. Macgillavry, G. D. Rieck, and K. Lonsdale, editors.International Tablesof X-Ray Crystallography. Kynoch Press, Birmingham, 1962.
[62] H. K. Mao, J. Shu, J. Hu, and R. J. Hemley.Eos Trans. AGO, Fall Meet. Suppl.,75(44):662, 1994.
[63] R. M. Martin. Phys. Rev. B, 5:1607, 1972.
[64] L. McNeil and M. Grimsditch.Phys. Rev. Lett., 68:83, 1992.
[65] M. H. Muser. Average structure vs. real structure: Molecular dynamics studiesof silica. In K. A. Gernoth and M. L. Ristig, editors,Particle Scattering, X-RayDiffraction, and Microstructure of Solids and Liquids, volume 610 ofLectureNotes in Physics, pages 75–100. Springer, Berlin, 2003.
[66] M. H. Muser and K. Binder.Phys. Chem. Miner., 28:746, 2001.
[67] L. Nagel and M. O’Keeffe.Mater. Res. Bull., 6:1317, 1971.
[68] E. L. Nave, H. E. Stanley, and F. Sciortino.Phys. Rev. Lett., 88:035501, 2002.
[69] S. Nose.J. Chem. Phys., 81:511, 1984.
[70] R. G. Parr and W. Yang.Density-Functional Theory of Atoms and Molecules.Oxford Science, Oxford, 1989.
[71] M. Parrinello and A. Rahman.Phys. Rev. Lett., 45:1196, 1980.
[72] M. Parrinello and A. Rahman.J. Chem. Phys., 76:2662, 1982.
[73] A. Pasquarello and R. Car.Phys. Rev. Lett., 80:5145, 1998.
162
Bibliography
[74] W. H. Press, B. P. Flannery, S. A. Teukolsky, and W. T. Vetterling.NumericalRecipes in Fortran. Cambridge University Press, Cambridge, 2nd edition, 1992.
[75] D. L. Price and J. M. Carpenter.J. Non-Cryst. Solids, 92:153, 1987.
[76] A. K. Rappe, 2001. private communication.
[77] A. K. Rappe and W. A. Goddard III.J. Phys. Chem., 95:3358, 1991.
[78] S. W. Rick, S. J. Stuart, and B. J. Berne.J. Chem. Phys., 101:6141, 1994.
[79] G. Roma, Y. Limoge, and S. Baroni.Phys. Rev. Lett., 86:4564, 2001.
[80] N. L. Ross, J. F. Shu, and R. M. Hazen.Am. Min., 75:739, 1990.
[81] E. K. H. Salje, A. Ridgwell, B. Guttler, B. Wruck, M. T. Dove, and G. Dolino.J. Phys. Cond. Mat., 4:571, 1992.
[82] R. T. Sanderson.Science, 114:670, 1951.
[83] P. Schoffel. Diplomarbeit, Johannes Gutenberg-Universitat Mainz, 2000.
[84] D. Sebastiani. PhD thesis, Universitat Stuttgart, 2001. http://elib.uni-stuttgart.de/opus/volltexte/2001/792.
[85] J. Sefcik, E. Demiralp, T. Cagin, and W. A. Goddard III.J. Comput. Chem.,23:1507, 2002.
[86] G. S. Smith.Acta Cryst., 16:542, 1963.
[87] D. R. Spearing, I. Farnan, and J. F. Stebbins.Phys. Chem. Miner., 19:307, 1992.
[88] M. Sprik and M. L. Klein.J. Chem. Phys., 89:7556, 1988.
[89] S. M. Stishov and S. V. Popova.Geochem. (USSR), 10:923, 1961.
[90] P. Tangney and S. Scandolo.J. Chem. Phys., 117:8898, 2002.
[91] S. N. Taraskin and S. R. Elliot.Phys. Rev. B, 56:8605, 1997.
[92] Y. Tezuka, S. Shin, and M. Ishigame.Phys. Rev. Lett., 66:2356, 1991.
[93] M. P. Tosi.Solid St. Phys., 16:1, 1964.
[94] A. Toukmaji, C. Sagui, J. Board, and T. Darden.J. Chem. Phys., 113:10913,2000.
[95] J. S. Tse and D. D. Klug.Phys. Rev. Lett., 67:3559, 1991.
163
Bibliography
[96] J. S. Tse and D. D. Klug.J. Chem. Phys., 95:9176, 1991.
[97] J. S. Tse, D. D. Klug, and Y. L. Page.Phys. Rev. Lett., 69:3647, 1992.
[98] Y. Tsuchida and T. Yagi.Nature, 340:217, 1989.
[99] Y. Tsuchida and T. Yagi.Nature, 347:267, 1990.
[100] S. Tsuneyuki, H. Aoki, M. Tsukada, and Matsui.Phys. Rev. Lett., 64:776, 1990.
[101] B. van Beest, G. Kramer, and R. van Santen.Phys. Rev. Lett., 64:1955, 1990.
[102] W. Voigt. Lehrbuch der Kristallphysik. Teubner, Berlin, 1910.
[103] K. Vollmayr, W. Kob, and K. Binder.Phys. Rev. B, 54:15808, 1996.
[104] K. Vollmayr, J. D. Reger, M. Scheucher, and K. Binder.Z. Phys. B, 91:113,1993.
[105] R. M. Wentzcovitch, C. da Silva, J. R. Chelikowsky, and N. Binggeli.Phys.Rev. Lett., 80:2149, 1998.
[106] M. Wilson and P. A. Madden.J. Phys.: Condens. Matt., 5:2687, 1993.
[107] A. F. Wright and M. S. Lehmann.J. Solid. State. Chem., 36:372, 1981.
164