Skip to content

Commit

Permalink
Merge pull request i-pi#346 from venkatkapil24/enh/picg
Browse files Browse the repository at this point in the history
option to print spring forces
  • Loading branch information
venkatkapil24 authored Jun 10, 2024
2 parents 99fcf15 + f8c9d69 commit 66eba29
Show file tree
Hide file tree
Showing 14 changed files with 299 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ipi/engine/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ def open_stream(self, mode):
"positions",
"velocities",
"forces",
"forces_spring",
"Eforces",
"extras",
# "extras_component_raw", write out a single file as we don't know how to do contraction here
Expand Down Expand Up @@ -542,6 +543,7 @@ def write_traj(
"positions",
"velocities",
"forces",
"forces_spring",
"Eforces",
"forces_sc",
"momenta",
Expand Down
5 changes: 5 additions & 0 deletions ipi/engine/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -2803,6 +2803,11 @@ def __init__(self):
"help": "The force trajectories. Will print out one file per bead, unless the bead attribute is set by the user.",
"func": (lambda: 1.0 * self.system.forces.f),
},
"forces_spring": {
"dimension": "force",
"help": "The spring force trajectories. Will print out one file per bead, unless the bead attribute is set by the user.",
"func": (lambda: 1.0 * self.system.nm.fspring),
},
"Eforces": {
# if the dynamics is driven then 'forces' contains, on top of the 'usual' internal forces between the nuclei,
# an extra term due to the coupling of the external (driving) electric field with the dipole of the system
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
filename format
----------------------------------------------------------
ref_simulation.frc_0.xyz xyz
ref_simulation.frc_1.xyz xyz
ref_simulation.frc_2.xyz xyz
ref_simulation.frc_3.xyz xyz
ref_simulation.frc_spring_0.xyz xyz
ref_simulation.frc_spring_1.xyz xyz
ref_simulation.frc_spring_2.xyz xyz
ref_simulation.frc_spring_3.xyz xyz
3 changes: 3 additions & 0 deletions ipi_tests/regression_tests/tests/IO/FORCES-WATER/init.xyz
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1

H 0.00 0.0 0.0
35 changes: 35 additions & 0 deletions ipi_tests/regression_tests/tests/IO/FORCES-WATER/input.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<simulation verbosity='low'>
<output prefix='simulation'>
<properties filename='out' stride='1'> [ step, conserved, temperature{kelvin}, potential{electronvolt}, kinetic_cv ] </properties>
<trajectory filename='frc' stride='1'> forces </trajectory>
<trajectory filename='frc_spring' stride='1'> forces_spring </trajectory>
</output>
<total_steps>9</total_steps>
<prng>
<seed>31415</seed>
</prng>
<ffsocket name='lammps' mode='unix' pbc='false'>
<address>localhost</address>
</ffsocket>
<system>
<initialize nbeads='4'>
<file mode='xyz'> init.xyz </file>
<cell mode='abc' units='angstrom'> [100, 100, 100] </cell>
</initialize>
<forces>
<force forcefield='lammps'> </force>
</forces>
<motion mode='dynamics'>
<fixcom> False </fixcom>
<dynamics mode='nvt'>
<timestep units='femtosecond'> 0.5 </timestep>
<thermostat mode='pile_g'>
<tau units='femtosecond'> 100 </tau>
</thermostat>
</dynamics>
</motion>
<ensemble>
<temperature units='kelvin'> 300 </temperature>
</ensemble>
</system>
</simulation>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 0 Bead: 0 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 1 Bead: 0 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 2 Bead: 0 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 3 Bead: 0 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 4 Bead: 0 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 5 Bead: 0 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 6 Bead: 0 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 7 Bead: 0 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 8 Bead: 0 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 9 Bead: 0 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 0 Bead: 1 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 1 Bead: 1 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 2 Bead: 1 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 3 Bead: 1 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 4 Bead: 1 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 5 Bead: 1 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 6 Bead: 1 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 7 Bead: 1 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 8 Bead: 1 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 9 Bead: 1 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 0 Bead: 2 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 1 Bead: 2 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 2 Bead: 2 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 3 Bead: 2 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 4 Bead: 2 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 5 Bead: 2 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 6 Bead: 2 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 7 Bead: 2 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 8 Bead: 2 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 9 Bead: 2 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 0 Bead: 3 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 1 Bead: 3 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 2 Bead: 3 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 3 Bead: 3 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 4 Bead: 3 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 5 Bead: 3 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 6 Bead: 3 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 7 Bead: 3 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 8 Bead: 3 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 9 Bead: 3 forces{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 0 Bead: 0 forces_spring{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 1 Bead: 0 forces_spring{atomic_unit} cell{atomic_unit}
H 1.33083e-04 -8.29420e-04 2.04949e-03
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 2 Bead: 0 forces_spring{atomic_unit} cell{atomic_unit}
H 9.11726e-05 -1.41424e-03 2.81326e-03
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 3 Bead: 0 forces_spring{atomic_unit} cell{atomic_unit}
H -2.82200e-04 -5.35648e-03 1.04181e-03
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 4 Bead: 0 forces_spring{atomic_unit} cell{atomic_unit}
H -3.98218e-04 -9.16535e-03 3.65878e-04
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 5 Bead: 0 forces_spring{atomic_unit} cell{atomic_unit}
H 7.58582e-05 -1.21056e-02 2.35816e-05
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 6 Bead: 0 forces_spring{atomic_unit} cell{atomic_unit}
H -1.96160e-03 -1.52257e-02 1.21251e-03
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 7 Bead: 0 forces_spring{atomic_unit} cell{atomic_unit}
H -4.50058e-03 -1.80454e-02 3.19914e-03
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 8 Bead: 0 forces_spring{atomic_unit} cell{atomic_unit}
H -6.06433e-03 -2.26079e-02 3.67045e-03
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 9 Bead: 0 forces_spring{atomic_unit} cell{atomic_unit}
H -6.08896e-03 -2.70690e-02 4.89079e-03
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 0 Bead: 1 forces_spring{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 1 Bead: 1 forces_spring{atomic_unit} cell{atomic_unit}
H -5.38362e-04 8.76855e-04 -1.78418e-03
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 2 Bead: 1 forces_spring{atomic_unit} cell{atomic_unit}
H 2.41004e-04 1.77475e-03 -3.03554e-03
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 3 Bead: 1 forces_spring{atomic_unit} cell{atomic_unit}
H 2.31914e-03 4.06910e-03 -3.01859e-03
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 4 Bead: 1 forces_spring{atomic_unit} cell{atomic_unit}
H 2.87172e-03 7.44714e-03 -5.15087e-03
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 5 Bead: 1 forces_spring{atomic_unit} cell{atomic_unit}
H 2.35996e-03 1.06495e-02 -7.37124e-03
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 6 Bead: 1 forces_spring{atomic_unit} cell{atomic_unit}
H 3.23076e-03 1.31583e-02 -9.71268e-03
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 7 Bead: 1 forces_spring{atomic_unit} cell{atomic_unit}
H 4.02480e-03 1.54768e-02 -1.36703e-02
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 8 Bead: 1 forces_spring{atomic_unit} cell{atomic_unit}
H 5.84639e-03 1.86426e-02 -1.53576e-02
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 9 Bead: 1 forces_spring{atomic_unit} cell{atomic_unit}
H 5.85411e-03 2.27553e-02 -1.79081e-02
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 0 Bead: 2 forces_spring{atomic_unit} cell{atomic_unit}
H 0.00000e+00 0.00000e+00 0.00000e+00
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 1 Bead: 2 forces_spring{atomic_unit} cell{atomic_unit}
H -4.65932e-04 -1.31302e-03 7.42496e-04
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 2 Bead: 2 forces_spring{atomic_unit} cell{atomic_unit}
H -1.64179e-03 -2.89913e-03 -8.61653e-05
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 3 Bead: 2 forces_spring{atomic_unit} cell{atomic_unit}
H -3.64652e-03 -5.62083e-03 -2.45627e-03
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 4 Bead: 2 forces_spring{atomic_unit} cell{atomic_unit}
H -5.13607e-03 -8.95250e-03 -2.28135e-03
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 5 Bead: 2 forces_spring{atomic_unit} cell{atomic_unit}
H -5.09303e-03 -1.11950e-02 -1.65042e-03
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 6 Bead: 2 forces_spring{atomic_unit} cell{atomic_unit}
H -4.86442e-03 -1.31429e-02 -2.32531e-04
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 7 Bead: 2 forces_spring{atomic_unit} cell{atomic_unit}
H -5.20156e-03 -1.43182e-02 2.31198e-03
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 8 Bead: 2 forces_spring{atomic_unit} cell{atomic_unit}
H -6.61326e-03 -1.56211e-02 3.90764e-03
1
# CELL(abcABC): 188.97261 188.97261 188.97261 90.00000 90.00000 90.00000 Step: 9 Bead: 2 forces_spring{atomic_unit} cell{atomic_unit}
H -6.82088e-03 -1.80705e-02 6.13677e-03
Loading

0 comments on commit 66eba29

Please sign in to comment.