Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 20.14.3 #57

Merged
merged 4 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
name: actions

on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: '0 6 * * *'
- push
- pull_request

jobs:
test:
Expand Down Expand Up @@ -46,7 +40,8 @@ jobs:
- name: Run
run: |
cd testing
../packmol < water_box.inp
../packmol < ieee_signaling.inp
./test.sh "water_box.inp" "packmol.log" "Success!"
./test.sh "ieee_signaling.inp" "packmol.log" "Success!"
./test.sh "water_box_failed.inp" "packmol.log" "FORCED"
cd ..
shell: bash
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ cmake_install.cmake
tmpfile.txt
testing/ieee_signaling_box.pdb
testing/water_box.pdb
testing/water_box.pdb_FORCED
testing/packmol.log
14 changes: 7 additions & 7 deletions app/packmol.f90
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ program packmol
! If there are no variables (only fixed molecules, stop)

if(n.eq.0) then
call output(n,x)
call output(n,x, xyzout)
write(*,dash1_line)
write(*,*) ' There are only fixed molecules, therefore there is nothing to do. '
write(*,*) ' The output file contains the fixed molecules in the desired positions. '
Expand Down Expand Up @@ -701,7 +701,7 @@ program packmol
! Stop if only checking the initial approximation

if(check) then
call output(n,x)
call output(n,x,xyzout)
write(*,*) ' Wrote initial point to output file: ', trim(adjustl(xyzout))
if ( crd ) write(*,*) ' ... and to CRD file: ', trim(adjustl(crdfile))
stop
Expand Down Expand Up @@ -753,7 +753,7 @@ program packmol
write(*,*) ' Initial approximation is a solution. Nothing to do. '
write(*,*)
call swaptype(n,x,itype,3) ! Restore all-molecule vectors
call output(n,x)
call output(n,x,xyzout)
if( itype == ntype + 1 ) then
write(*,*) ' Solution written to file: ', trim(adjustl(xyzout))
if ( crd ) write(*,*) ' ... and to CRD file: ', trim(adjustl(crdfile))
Expand Down Expand Up @@ -849,7 +849,7 @@ program packmol
! If the solution was found for this type
if( fdist < precision .and. frest < precision ) then
call swaptype(n,x,itype,3) ! Restore all molecule vectors
call output(n,x)
call output(n,x,xyzout)
write(*,*) ' Current structure written to file: ', trim(adjustl(xyzout))
if ( crd ) write(*,*) ' ... and to CRD file: ', trim(adjustl(crdfile))
call writesuccess(itype,fdist,frest,fx)
Expand All @@ -869,7 +869,7 @@ program packmol
if ( fx < bestf ) bestf = fx
! If solution was found for all system
if ( fdist < precision .and. frest < precision ) then
call output(n,x)
call output(n,x,xyzout)
call writesuccess(itype,fdist,frest,fx)
write(*,*) ' Solution written to file: ', trim(adjustl(xyzout))
if ( crd ) write(*,*) ' ... and to CRD file: ', trim(adjustl(crdfile))
Expand All @@ -882,7 +882,7 @@ program packmol

! If this is the best structure so far
if( mod(loop+1,writeout) == 0 .and. all_type_fx < fprint ) then
call output(n,x)
call output(n,x,xyzout)
write(*,*) ' Current solution written to file: ', trim(adjustl(xyzout))
if ( crd ) write(*,*) ' ... and to CRD file: ', trim(adjustl(crdfile))
fprint = all_type_fx
Expand All @@ -892,7 +892,7 @@ program packmol

! If the user required printing even bad structures
else if ( mod(loop+1,writeout) == 0 .and. writebad ) then
call output(n,x)
call output(n,x,xyzout)
write(*,*) ' Writing current (perhaps bad) structure to file: ', trim(adjustl(xyzout))
if ( crd ) write(*,*) ' ... and to CRD file: ', trim(adjustl(crdfile))
end if
Expand Down
2 changes: 1 addition & 1 deletion fpm.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "packmol"
version = "20.14.2"
version = "20.14.3"
license = "MIT"
author = "Leandro Martinez, Ernesto Birgin, Jose Mario Martinez"
maintainer = "Leandro Martinez"
Expand Down
4 changes: 2 additions & 2 deletions src/checkpoint.f90
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ subroutine checkpoint(n,x)
&)") fx
write(*,dash3_line)

call output(n,x)
call output(n,x,xyzout)

write(*,*) ' The solution with the best function value was '
write(*,*) ' written to the output file: ', trim(adjustl(xyzout))
Expand All @@ -82,7 +82,7 @@ subroutine checkpoint(n,x)
write(*,*)
write(*,dash1_line)
xyzout_forced = trim(adjustl(xyzout))//'_FORCED'
call output(n,x)
call output(n,x,xyzout_forced)

write(*,*) ' The forced point was writen to the '
write(*,*) ' output file: ', trim(adjustl(xyzout_forced))
Expand Down
11 changes: 6 additions & 5 deletions src/output.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
! Subroutine output: Subroutine that writes the output file
!

subroutine output(n,x)
subroutine output(n, x, output_file_name)

use exit_codes
use sizes
Expand Down Expand Up @@ -36,6 +36,7 @@ subroutine output(n,x)
character(len=strl) :: pdb_atom_line, tinker_atom_line, crd_format
character(len=8) :: crdires,crdresn,crdsegi,atmname
character(len=strl) :: record
character(len=strl) :: output_file_name
character(len=5) :: i5hex, tmp_i5hex

! Job title
Expand Down Expand Up @@ -96,7 +97,7 @@ subroutine output(n,x)
! Write the output (xyz file)

if(xyz) then
open(30,file=xyzout,status='unknown')
open(30,file=output_file_name,status='unknown')
write(30,*) ntotat
write(30,*) title
ilubar = 0
Expand Down Expand Up @@ -143,7 +144,7 @@ subroutine output(n,x)
! write the output as a MOLDY file

if(moldy) then
open(30,file=xyzout,status='unknown')
open(30,file=output_file_name,status='unknown')
! For square moldy boxes, this must be the side dimensions of the box
sxmin = 1.d30
symin = 1.d30
Expand Down Expand Up @@ -351,7 +352,7 @@ subroutine output(n,x)
&f8.3,t55,a26 )"
crd_format='(2I10,2X,A8,2X,A8,3F20.10,2X,A8,2X,A8,F20.10)'

open(30,file=xyzout,status='unknown')
open(30,file=output_file_name,status='unknown')
if ( crd ) then
open(40,file=crdfile,status='unknown')
write(40,'("* TITLE ", a64,/&
Expand Down Expand Up @@ -696,7 +697,7 @@ subroutine output(n,x)

tinker_atom_line = "( i7,tr2,a3,3(tr2,f10.6),9(tr2,i7) )"

open(30, file = xyzout,status='unknown')
open(30, file = output_file_name,status='unknown')

write(30,"( i6,tr2,a64 )") ntotat, title

Expand Down
2 changes: 1 addition & 1 deletion src/title.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ subroutine title()
write(*,"(' PACKMOL - Packing optimization for the automated generation of', /&
&' starting configurations for molecular dynamics simulations.', /&
&' ',/&
&t62,' Version 20.14.2 ')")
&t62,' Version 20.14.3 ')")
write(*,hash3_line)

end subroutine title
25 changes: 25 additions & 0 deletions testing/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
#
# First argument: input file name
# Second argument: log file name
#
# Third argument: string to be searched in the log file, to declare that
# the test passed
#
# Example: ./test.sh "water_box.inp" "packmol.log" "Success!"
#
if ! [ -f $1 ]; then
echo "Error: input file not found: $1"
exit 1
fi
../packmol < $1 > $2
if ! [ -f $2 ]; then
echo "Error: Log file not generated: $2"
exit 1
fi
if ! grep -q $3 $2; then
echo "Error: could not find $3 in $2"
exit 1
fi
echo "Test passed."
exit 0
16 changes: 16 additions & 0 deletions testing/water_box_failed.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# A box with water for which the packing will fail
#

tolerance 2.0
filetype pdb
output water_box.pdb

maxit 2
nloop 1

structure water.pdb
number 2
inside box 0. 0. 0. 3.0 3.0 1.0
end structure