Module that contains dcdwriter class.
More...
Module that contains dcdwriter class.
◆ dcdwriter_close()
subroutine dcdfort_writer::dcdwriter_close |
( |
class(dcdwriter), intent(inout) |
this | ) |
|
|
private |
Closes DCD file.
- Parameters
-
[in,out] | this | dcdwriter object |
156 class(dcdwriter),
intent(inout) :: this
◆ dcdwriter_open()
subroutine dcdfort_writer::dcdwriter_open |
( |
class(dcdwriter), intent(inout) |
this, |
|
|
character (len=*), intent(in) |
filename |
|
) |
| |
Opens new file to write to.
- Parameters
-
[in,out] | this | dcdwriter object |
[in] | filename | name of new DCD file to write to |
62 character (len=*),
intent(in) :: filename
63 class(dcdwriter),
intent(inout) :: this
65 open(newunit=this%u, file=trim(filename), form=
"unformatted", access=
"stream", status=
"replace")
◆ dcdwriter_write_header()
subroutine dcdfort_writer::dcdwriter_write_header |
( |
class(dcdwriter), intent(inout) |
this, |
|
|
integer(kind=int32), intent(in) |
istart, |
|
|
integer(kind=int32), intent(in) |
nevery, |
|
|
real(kind=real32), intent(in) |
timestep, |
|
|
integer(kind=int32), intent(in) |
natoms |
|
) |
| |
|
private |
Writes header to new DCD file.
- Parameters
-
[in,out] | this | dcdwriter object |
[in] | istart | first timestep in file |
[in] | nevery | how often snapshots written (in timesteps) |
[in] | timestep | simulation timestep |
[in] | natoms | number of atoms in each snapshot |
79 integer(kind=int32) :: i
80 integer(kind=int32),
intent(in) :: istart, nevery, natoms
81 real(kind=real32),
intent(in) :: timestep
82 class(dcdwriter),
intent(inout) :: this
83 character (len=79) :: remarks1, remarks2
84 character (len=8) :: date
85 character (len=10) :: time
91 call date_and_time(date=date,time=time)
92 remarks1 =
"Created by libdcdfort" 93 remarks2 =
"REMARK Created on "//date//
" "//time
102 inquire(unit=this%u, pos=this%nframes_pos)
104 write(this%u) this%nframes
112 inquire(unit=this%u, pos=this%iend_pos)
114 write(this%u) this%iend
121 write(this%u) timestep
136 write(this%u) remarks1//c_null_char
137 write(this%u) remarks2//c_null_char
◆ dcdwriter_write_next()
subroutine dcdfort_writer::dcdwriter_write_next |
( |
class(dcdwriter), intent(inout) |
this, |
|
|
real(kind=real32), dimension(:,:), intent(in) |
xyz, |
|
|
real(kind=real64), dimension(6), intent(in) |
box_in |
|
) |
| |
|
private |
Writes snapshot to an open DCD file.
Writes a new snapshot to a DCD file. Header should have already been written.
- Parameters
-
[in,out] | this | dcdwriter object |
[in] | xyz | coordinates of all atoms in this snapshot |
[in] | box_in | box dimensions for this snapshot |
170 real(kind=real32),
intent(in) :: xyz(:,:)
171 real(kind=real64),
intent(in) :: box_in(6)
172 real(kind=real64) :: box(6)
173 class(dcdwriter),
intent(inout) :: this
174 integer(kind=int32) :: coord_size
176 coord_size =
size(xyz,1)*4
190 write(this%u) coord_size
192 write(this%u) xyz(:,1)
194 write(this%u) coord_size
195 write(this%u) coord_size
197 write(this%u) xyz(:,2)
199 write(this%u) coord_size
200 write(this%u) coord_size
202 write(this%u) xyz(:,3)
204 write(this%u) coord_size
206 inquire(unit=this%u, pos=this%curr_pos)
208 this%nframes = this%nframes+1
209 this%iend = this%iend + this%nevery
212 write(this%u, pos=this%nframes_pos) this%nframes
213 write(this%u, pos=this%iend_pos) this%iend
214 write(this%u, pos=this%curr_pos)